iptables 방화벽을 비활성화 한 경우 유용한 방화벽 설정
신뢰할 수 있는 IP만 접속할 수 있는 화이트리스트를 구성할 때 유용함
/etc/hosts.allow 수정
# # hosts.allow This file describes the names of the hosts which are # allowed to use the local INET services, as decided # by the '/usr/sbin/tcpd' server. # sshd: 150.183. sshd: 172.16. sshd: 210.117. sshd: 210.125. sshd: 220.66. sshd: 220.92.
[ 리눅스 최근 사용자/IP 조회 ]를 참고하여, 최근~1000번째 접속 IP를 추려내어 적용하면 안전함.
/etc/hosts.deny 수정
# # hosts.deny This file describes the names of the hosts which are # *not* allowed to use the local INET services, as decided # by the '/usr/sbin/tcpd' server. # sshd: ALL
sshd 재시작
# CentOS sudo service sshd restart # Ubuntu sudo service ssh restart