1. Download and Install
wget http://sourceforge.net/projects/fail2ban/files/fail2ban-stable/fail2ban-0.8.4/fail2ban-0.8.4.tar.bz2
tar -xjvf fail2ban-0.8.4.tar.bz2
cd fail2ban-0.8.4
python setup.py install
2. Edit jail.conf
vi /etc/fail2ban/jail.conf
----------//---------
[DEFAULT]
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
# ban a host which matches an address in this list. Several addresses can be
# defined using space separator.
ignoreip = 127.0.0.1 192.168.1.0/24 <--------- ์ฌ๊ธฐ์ ์ง์ ๋ ์ฃผ์๋ fail2ban์ํด ๋ฐด๋นํ์ง ์๋๋ค
# "bantime" is the number of seconds that a host is banned.
bantime = 84600 <-------- 24์๊ฐ์ผ๋ก ๋ณ๊ฒฝ. ํด๋น ํธ์คํธ๊ฐ ๋ฐด๋๋ ์๊ฐ (๊ธฐ๋ณธ 600)
# A host is banned if it has generated "maxretry" during the last "findtime"
# seconds.
findtime = 600
# "maxretry" is the number of failures before a host get banned.
maxretry = 3 <------- ์์ faindtime ์๊ฐ์์ maxretry ํ์๋งํผ ๋ก๊ทธ์ธ ์คํจ์ ๋ฐด (๊ธฐ๋ณธ 3)
......
[ssh-iptables]
enabled = true <-------- sshd์ ์ฌ์ฉํ๊ธฐ ์ํด true๋ก ๋ณ๊ฒฝ
filter = sshd
action = iptables[name=SSH, port=ssh, protocol=tcp]
sendmail-whois[name=SSH, dest=you@mail.com, sender=fail2ban@mail.com]
logpath = /var/log/secure <------------ sshd.log์์ secure๋ก ๋ณ๊ฒฝ
maxretry = 5 <-------- ๋ณ๊ฒฝ์ ์ฌ๊ธฐ์ ์๋ ๊ฐ์ด ์์ default 'maxretry' ๊ฐ๋ณด๋ค ์ฐ์ ์ ๋๋ค
----------//---------
3. Copy start script and start service
cp files/redhat-initd /etc/init.d/fail2ban
chkconfig --add fail2ban
chkconfig fail2ban on
service fail2ban start
wget http://sourceforge.net/projects/fail2ban/files/fail2ban-stable/fail2ban-0.8.4/fail2ban-0.8.4.tar.bz2
tar -xjvf fail2ban-0.8.4.tar.bz2
cd fail2ban-0.8.4
python setup.py install
2. Edit jail.conf
vi /etc/fail2ban/jail.conf
----------//---------
[DEFAULT]
# "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
# ban a host which matches an address in this list. Several addresses can be
# defined using space separator.
ignoreip = 127.0.0.1 192.168.1.0/24 <--------- ์ฌ๊ธฐ์ ์ง์ ๋ ์ฃผ์๋ fail2ban์ํด ๋ฐด๋นํ์ง ์๋๋ค
# "bantime" is the number of seconds that a host is banned.
bantime = 84600 <-------- 24์๊ฐ์ผ๋ก ๋ณ๊ฒฝ. ํด๋น ํธ์คํธ๊ฐ ๋ฐด๋๋ ์๊ฐ (๊ธฐ๋ณธ 600)
# A host is banned if it has generated "maxretry" during the last "findtime"
# seconds.
findtime = 600
# "maxretry" is the number of failures before a host get banned.
maxretry = 3 <------- ์์ faindtime ์๊ฐ์์ maxretry ํ์๋งํผ ๋ก๊ทธ์ธ ์คํจ์ ๋ฐด (๊ธฐ๋ณธ 3)
......
[ssh-iptables]
enabled = true <-------- sshd์ ์ฌ์ฉํ๊ธฐ ์ํด true๋ก ๋ณ๊ฒฝ
filter = sshd
action = iptables[name=SSH, port=ssh, protocol=tcp]
sendmail-whois[name=SSH, dest=you@mail.com, sender=fail2ban@mail.com]
logpath = /var/log/secure <------------ sshd.log์์ secure๋ก ๋ณ๊ฒฝ
maxretry = 5 <-------- ๋ณ๊ฒฝ์ ์ฌ๊ธฐ์ ์๋ ๊ฐ์ด ์์ default 'maxretry' ๊ฐ๋ณด๋ค ์ฐ์ ์ ๋๋ค
----------//---------
3. Copy start script and start service
cp files/redhat-initd /etc/init.d/fail2ban
chkconfig --add fail2ban
chkconfig fail2ban on
service fail2ban start