Appearance
Fail2ban
Fail2ban runs as systemd service.
Configuration
Edit or create /etc/fail2ban/jail.local file.
bash
[DEFAULT]
ignoreip = 127.0.0.1
# Time in seconds (negative number for permanent ban)
bantime = 86400
banaction = iptables-multiport
action = %(action_mwl)s
[sshd]
port = 22
# how many tries in ${findtime}
maxentry = 5
# Time in seconds
findtime = 600
enabled = true
backend = polling
[DEFAULT]
ignoreip = 127.0.0.1
# Time in seconds (negative number for permanent ban)
bantime = 86400
banaction = iptables-multiport
action = %(action_mwl)s
[sshd]
port = 22
# how many tries in ${findtime}
maxentry = 5
# Time in seconds
findtime = 600
enabled = true
backend = polling
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Commands
All commands need sudo privileges.
Jail status
Shows currently banned IP addresses and other stats.
bash
fail2ban-client status <JAIL>
fail2ban-client status <JAIL>
1
Unban IP address
bash
fail2ban-client set <JAIL> unbanip <IP>
fail2ban-client set <JAIL> unbanip <IP>
1
Unban all addresses
Unban addresses from all jails.
bash
fail2ban-client unban --all
fail2ban-client unban --all
1