서버/리눅스
[CentOS] ssh무작위공격 대비 Fail2ban 설정
usioo
2022. 7. 11. 22:09
https://usioo-14.tistory.com/m/5 / https://usioo-14.tistory.com/m/4
지난글에 이어 ssh무작위 공격을 대비한 마지막 Fail2ban 설정을 공유하려 합니다
1. SSH 포트변경
2. root계정 원격접속제한
3. wheel 권한 설정
4. fail2ban
ㅁ Fail2Ban 설정
아래 명령어로 fail2ban을 설치 합니다.
# yum install -y fail2ban
그리고 아래 설정파일에서 입맛대로 정책 설정을 합니다
vim /etc/fail2ban/jail.d/local.conf
설정 후 fail2ban을 시작해줍니다
# systemctl enable fail2ban
# systemctl start fail2ban
제대로 설정하였다면 아래 명령어로 벤된 ip를 조회 할 수 있습니다
# fail2ban-client status
fail2ban 관련 로그는 아래 파일에서 확인가능합니다
# vim /var/log/fail2ban.log