18. 접속 IP 및 포트 제한
처음 설치시 아무런 설정도 되어 있지 않다. 반드시 설정해줘야 하는 부분이다.
[root@centos7 ~]# cat /etc/hosts.deny
#
# hosts.deny This file contains access rules which are used to
# deny connections to network services that either use
# the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
# The rules in this file can also be set up in
# /etc/hosts.allow with a 'deny' option instead.
#
# See 'man 5 hosts_options' and 'man 5 hosts_access'
# for information on rule syntax.
# See 'man tcpd' for information on tcp_wrappers
#
[root@centos7 ~]# vi /etc/hosts.deny
[root@centos7 ~]# cat /etc/hosts.allow
#
# hosts.allow This file contains access rules which are used to
# allow or deny connections to network services that
# either use the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
# See 'man 5 hosts_options' and 'man 5 hosts_access'
# for information on rule syntax.
# See 'man tcpd' for information on tcp_wrappers
#
[root@centos7 ~]# vi /etc/hosts.allow
[root@centos7 ~]#
[root@centos7 ~]#
[root@centos7 ~]# cat /etc/hosts.deny
#
# hosts.deny This file contains access rules which are used to
# deny connections to network services that either use
# the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
# The rules in this file can also be set up in
# /etc/hosts.allow with a 'deny' option instead.
#
# See 'man 5 hosts_options' and 'man 5 hosts_access'
# for information on rule syntax.
# See 'man tcpd' for information on tcp_wrappers
ALL:ALL
[root@centos7 ~]# cat /etc/hosts.allow
#
# hosts.allow This file contains access rules which are used to
# allow or deny connections to network services that
# either use the tcp_wrappers library or that have been
# started through a tcp_wrappers-enabled xinetd.
#
# See 'man 5 hosts_options' and 'man 5 hosts_access'
# for information on rule syntax.
# See 'man tcpd' for information on tcp_wrappers
sshd : 192.168.2.1
[root@centos7 ~]#
■ 대상 OS : SunOS, Linux, AIX, HP-UX
■ 취약점 개요
- Unix 시스템이 제공하는 Telnet, FTP 등 많은 네트워크 서비스를 통한 외부 비인가자의 불법적인 접근 및 시스템 침해사고를 방지하기 위하여 TCP Wrapper를 이용하여 제한된 IP주소에서만 접속할 수 있도록 설정
■ 보안대책
- 양호 : /etc/hosts.deny 파일에 ALL Deny 설정 후
/etc/hosts.allow 파일에 접근을 허용할 특정 호스트를 등록한 경우
- 취약 : 위와 같이 설정되지 않은 경우
■ 조치방법
- /etc/hosts.deny 파일에 ALL Deny 설정 후 /etc/hosts.allow 파일에 접근 허용 IP 등록
■ 보안설정 방법
◆ OS별 점검 파일 위치 및 점검 방법
- SunOS, Linux, AIX
All deny 적용 확인 및 접근 허용 IP 적절성 확인
#cat /etc/hosts.deny
#cat /etc/hosts.allow
- HP-UX
All deny 적용 확인 및 서비스 접근 가능 IP 확인
#cat /var/adm/inetd.sec
※ 위에 제시한 파일이 존재하지 않거나 All deny 설정이 적용되지 않은 경우 또는, 시스템 접근 제한 IP 설정 필요 시 아래의 보안설정 방법에 따라 설정을 변경
■ SunOS, Linux, AIX
1. vi 편집기를 이용하여 "/etc/hosts.deny" 파일을 연 후 (해당 파일이 없을 경우 새로 생성)
2. 아래와 같이 수정 또는, 신규 삽입 (All Deny 설정)
(수정 전) 설정 없음
(수정 후) ALL:ALL
3. vi 편집기를 이용하여 "/etc/hosts.allow" 파일을 연 후 (해당 파일이 없을 경우 생성)
(수정 전) 설정 없음
(수정 후) sshd : 192.168.0.148, 192.168.0.6 (다른 서비스도 동일한 방식으로 설정)
< TCP Wrapper 접근제어 가능 서비스 >
◾SYSTAT, FINGER, FTP, TELNET, RLOGIN, RSH, TALK, EXEC, TFTP, SSH
< TCP Wrapper는 다음 두 파일에 의해 접근이 제어됨 >
◾/etc/hosts.deny --> 시스템 접근을 제한할 IP 설정
◾/etc/hosts.allow --> 시스템 접근을 허용할 IP 설정
◾not in either --> 모든 접근 허용
■ HP-UX
- HP-UX 서버의 경우 "/var/adm/inetd.sec" 파일을 이용하여 서버 자체적으로 접근제어를 할 수 있으며, 해당 파일이 존재하지 않을 경우 "/usr/newconfig/var/adm/inetd.sec" 샘플 파일을 복사하여 사용
1. vi 편집기를 이용하여 "/var/adm/inetd.sec" 파일을 연 후 (해당 파일이 없을 경우 새로 생성)
2. 아래와 같이 수정 또는 신규 삽입 (ALL Deny 설정)
- telnet 으로의 모든 접속 차단 → telnet deny ****
- telnet 접속을 허용할 IP 등록 → telnet allow [telnet 접속 허용 IP 등록]
(다른 서비스들도 위와 동일한 방법으로 설정)
'리눅스 따라하기 > Centos7 취약점 점검' 카테고리의 다른 글
20. Anonymous FTP 비활성화 (0) | 2018.07.04 |
---|---|
19. Finger 서비스 비활성화 (0) | 2018.07.04 |
17. /$HOME/.rhosts, hosts.equiv 사용 금지 (0) | 2018.07.02 |
16. /dev에 존재하지 않는 device 파일 점검 (0) | 2018.07.02 |
15. world writable 파일 점검 (0) | 2018.07.02 |