Ubuntu – Fail2ban Custom Port

debianfail2banSecuritysshUbuntu

I have a rule like this in my jail.local file:

[ssh-ddos]

enabled = true
port    = ssh,sftp
filter  = sshd-ddos
logpath  = /var/log/messages
maxretry = 4

If I want to use a custom port for SSH, does Fail2ban automatically infer it from my sshd_config file or should I specify the port numerically?

Best Answer

You must specify the custom port in the [ssh] section, something like this:

[ssh]
port=2317