728x90
jail.conf 파일수정
================
/etc/fail2ban/jail.conf
bantime = -1
touch /etc/fail2ban/ip.blacklist
cd /etc/fail2ban/action.d/
cp iptables-multiport.conf iptables-multiport.conf.backup
vi iptables-multiport.conf
==========================
....
....
actionban = iptables -I fail2ban-<name> 1 -s <ip> -j DROP
....
actionban = iptables -I fail2ban-<name> 1 -s <ip> -j DROP
echo <ip> >> /etc/fail2ban/ip.blacklist
....
....
....
....
actionstart = iptables -N fail2ban-<name>
iptables -A fail2ban-<name> -j RETURN
iptables -I <chain> -p <protocol> -m multiport --dports <port> -j fail2ban-<name>
cat /etc/fail2ban/ip.blacklist | while read IP; do iptables -I fail2ban-<name> 1 -s $IP -j DROP; done
fail2ban 재시작
===============
service fail2ban restart
iptables 동작확인
================
iptables -L -v -n
차단해제
=========
ip.blacklist 에서 해당IP 삭제 후
/etc/init.d/fail2ban restart
참조
http://katselphrime.com/2015/01/22/how-to-make-fail2ban-ip-bans-persistent/
'IT > 리눅스(Linux)' 카테고리의 다른 글
리눅스 캐시 메모리 정리 방법 (0) | 2022.07.22 |
---|---|
Arch Linux 설치하기 (0) | 2022.05.22 |
Almalinux 또는 Rocky Linux에 htop을 설치하는 방법 (0) | 2022.03.10 |
Fail2ban으로 SSH서버 보안 강화하기 (0) | 2021.12.25 |
Rocky Linux 8에 Virtualbox 게스트 추가 기능을 설치하는 방법 (0) | 2021.12.18 |