IT 이야기/리눅스 Tip

CentOS 7, 'Firewalld'설정방법과 'iptables'과의 차이 下 - 일본서버호스팅 제이피서버

KDSVPN 2017. 9. 10. 19:47
반응형

 

 

 일본서버호스팅

 일본서버호스팅

  일본서버호스팅

XML 파일로 정의된 서비스를 추가하기 일본서버호스팅

  일본서버호스팅

서비스 정의 파일은 /usr/lib/firewalld/services 에, XML 형식의 파일로 저장되어 있습니다.

CentOS 7에서는 "http" "https" "ssh" 등의 주요 서비스는 미리 정의되어 있습니다.

 일본서버호스팅

예를들면 "ssh 정의 파일 (ssh.xml)」의 내용은 다음과 같습니다.

 일본서버호스팅

# cat /usr/lib/firewalld/services/ssh.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
 <short>SSH</short>
 <description>Secure Shell (SSH) is a protocol for logging into and executing
commands on remote machines. It provides secure encrypted communications. If you
plan on accessing your machine remotely via SSH over a firewalled interface,
enable this option. You need the openssh-server package installed for this option
to be useful.</description>
 <port protocol="tcp" port="22"/>
</service>

 일본서버호스팅

개별적으로 정의를 추가하려면 /etc/firewalld/services 에, 서술 형식에 따라 XML 형식의 파일을 만듭니다.

 일본서버호스팅

예를 들어, "전자 메일 클라이언트에서 메일에 사용하는 포트이며, 서브 미션 포트 (TCP 587번 포트)를

submission 서비스로 등록하는" 경우는 다음과 같이 작업합니다.

 일본서버호스팅

 일본서버호스팅

1. "submission.xml" 파일 만들기 일본서버호스팅

 일본서버호스팅

/etc/firewalld/services/ 디렉토리 아래에 "submission.xml"파일을

"#vi /etc/firewalld/services/submission.xml" 으로 만듭니다.  일본서버호스팅

내용은 다음과 같습니다. 일본서버호스팅

 일본서버호스팅

  1. <?xml version="1.0" encoding="utf-8"?>
  2. <service>
  3. <short>submission</short>
  4. <description>(서비스에 관한 설명을 기입)
  5. </description>
  6. <port protocol="tcp" port="587"/>
  7. </service>

 일본서버호스팅

2. 설정을 반영하기 위해 리로드 일본서버호스팅

 일본서버호스팅

# firewall-cmd --reload
success

 일본서버호스팅

 일본서버호스팅

3. 추가되었는지 확인 일본서버호스팅

 일본서버호스팅

# firewall-cmd --get-services
RH-Satellite-6 amanda-client bacula bacula-client dhcp dhcpv6 dhcpv6-client dns freeipa-ldap freeipa-ldaps freeipa-replication ftp high-availability http https imaps ipp ipp-client ipsec iscsi-target kerberos kpasswd ldap ldaps libvirt libvirt-tls mdns mountd ms-wbt mysql nfs ntp openvpn pmcd pmproxy pmwebapi pmwebapis pop3s postgresql proxy-dhcp radius rpc-bind rsyncd samba samba-client smtp ssh submission telnet tftp tftp-client transmission-client vdsm vnc-server wbem-https

 일본서버호스팅

ssh와 telnet 에서 작업한 "submission"가 추가되어있는 것을 확인할 수 있습니다.

 일본서버호스팅

 일본서버호스팅

결론 일본서버호스팅

 일본서버호스팅

지금까지 iptables를 이용한 패킷 필터링은 INPUT / OUTPUT / FORWARD 각 체인에 대한 정확한

설정을 해야 했습니다.  일본서버호스팅

또한 iptables 명령은 많은 옵션을 제대로 파악하고 있지 않으면 설정이 어려운 문제가 있었습니다.

 일본서버호스팅

CentOS 7 Firewalld는 iptables의 패킷 필터링 설정의 관리 방법이 크게 변경 된 것으로, 지금까지

iptables의 패킷 필터링에 익숙해 있던 시스템 관리자에게는 문제가 될 수도 있습니다.

 일본서버호스팅

그러나 Firewalld는 "INPUT 방향 제어를 특화" 시킨 점, 그리고 zone과 서비스의 결합을 통해

"허용/거부 설정의 구조가 이해하기 쉽게" 되고 "설정의 확인도 용이"하게 되었습니다.

또한 zone과 서비스를 결합한 관리 구조는 프로토콜이나 포트와 세션 등의 행동을 의식하지 않고

설정할 수 있기 때문에 "TCP / IP의 깊은 지식이 없는 관리자도 관리하기 쉬워졌다"고 말할 수 있습니다.

 일본서버호스팅

관리가 간소화 된 것으로, 지금까지 iptables 패킷 필터링 설정을 관리해 온 시스템 관리자에게도

번거로운 작업에서 해방되는 장점이 있습니다.

이 기회에 꼭 기억하고 활용합시다. 일본서버호스팅

 일본서버호스팅

 일본서버호스팅

 일본서버호스팅

 일본서버호스팅

 일본서버호스팅

 일본서버호스팅

 일본서버호스팅

반응형