Hello, i'm trying to secure my future server mail, Is this Fail2ban configuration ok?
[DEFAULT]
#destemail = [email protected]
#sender = [email protected]
#sendername = Fail2Ban
#mta = sendmail
ignoreip = 127.0.0.1/8
ignorecommand =
bantime = 10d
findtime = 10m
maxretry = 3
maxmatches = %(maxretry)s
backend = systemd
usedns = warn
logencoding = auto
enabled = false
mode = normal
filter = %(name)s[mode=%(mode)s]
destemail = root@localhost
sender = root@<fq-hostname>
mta = sendmail
protocol = tcp
chain = input
port = 0:65535
fail2ban_agent = Fail2Ban/%(fail2ban_version)s
banaction = nftables-multiport
banaction_allports = nftables-allports
bantime.increment = true
bantime.factor = 2
bantime.maxtime = 60d
dbpurgeage = 30d
bantime.rndtime = 30m
[sshd]
enabled = true
port = 2157
backend = systemd
filter = sshd
logpath = /var/log/auth.log
maxretry = 2
mode = aggressive
[postfix]
enabled = true
port = smtp,ssmtp
filter = postfix[mode=auth]
logpath = /var/log/mail.log
ignoreip = 127.0.0.1/8 192.168.1.0/24
journalmatch = _SYSTEMD_UNIT=[email protected]
maxretry = 3
bantime.increment = true
bantime.factor = 2
[postfix-sasl]
enabled = true
filter = postfix[mode=auth]
port = smtp,submission,imap,imaps,pop3,pop3s
maxretry = 3
bantime = 12h
bantime.increment = true
bantime.factor = 2
bantime.maxtime = 5w
action = %(action_)s
journalmatch = _SYSTEMD_UNIT=[email protected]
logpath = /var/log/mail.log
[recidive]
backend = systemd
logpath = /var/log/fail2ban.log
enabled = true
maxretry = 2
banaction = nftables-allports
[dovecot]
enabled = true
filter = dovecot
logpath = /var/log/mail.log
maxretry = 3
Fai2ban is working perfectly with ssh.
Status for the jail: sshd
|- Filter
| |- Currently failed: 0
| |- Total failed: 0
| `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd
`- Actions
|- Currently banned: 2
|- Total banned: 2
`- Banned IP list: 185.156.xxxxx 5.90.xxxxx
[DEFAULT]
#destemail = [email protected]
#sender = [email protected]
#sendername = Fail2Ban
#mta = sendmail
ignoreip = 127.0.0.1/8
ignorecommand =
bantime = 10d
findtime = 10m
maxretry = 3
maxmatches = %(maxretry)s
backend = systemd
usedns = warn
logencoding = auto
enabled = false
mode = normal
filter = %(name)s[mode=%(mode)s]
destemail = root@localhost
sender = root@<fq-hostname>
mta = sendmail
protocol = tcp
chain = input
port = 0:65535
fail2ban_agent = Fail2Ban/%(fail2ban_version)s
banaction = nftables-multiport
banaction_allports = nftables-allports
bantime.increment = true
bantime.factor = 2
bantime.maxtime = 60d
dbpurgeage = 30d
bantime.rndtime = 30m
[sshd]
enabled = true
port = 2157
backend = systemd
filter = sshd
logpath = /var/log/auth.log
maxretry = 2
mode = aggressive
[postfix]
enabled = true
port = smtp,ssmtp
filter = postfix[mode=auth]
logpath = /var/log/mail.log
ignoreip = 127.0.0.1/8 192.168.1.0/24
journalmatch = _SYSTEMD_UNIT=[email protected]
maxretry = 3
bantime.increment = true
bantime.factor = 2
[postfix-sasl]
enabled = true
filter = postfix[mode=auth]
port = smtp,submission,imap,imaps,pop3,pop3s
maxretry = 3
bantime = 12h
bantime.increment = true
bantime.factor = 2
bantime.maxtime = 5w
action = %(action_)s
journalmatch = _SYSTEMD_UNIT=[email protected]
logpath = /var/log/mail.log
[recidive]
backend = systemd
logpath = /var/log/fail2ban.log
enabled = true
maxretry = 2
banaction = nftables-allports
[dovecot]
enabled = true
filter = dovecot
logpath = /var/log/mail.log
maxretry = 3
Fai2ban is working perfectly with ssh.
Status for the jail: sshd
|- Filter
| |- Currently failed: 0
| |- Total failed: 0
| `- Journal matches: _SYSTEMD_UNIT=sshd.service + _COMM=sshd
`- Actions
|- Currently banned: 2
|- Total banned: 2
`- Banned IP list: 185.156.xxxxx 5.90.xxxxx

