Fail2Ban works fine with the built-in jails, but my custom OpenVPN jail doesn't ban anything, neither does my NGINX-DoS jail. The output of sudo fail2ban-client status openvpn is:

Status for the jail: openvpn
|- Filter
|  |- Currently failed: 0
|  |- Total failed: 0
|  `- File list:    /var/log/openvpn.log
- Actions
|- Currently banned:    2
|- Total banned:    2
`- Banned IP list:

I changed the IP addresses, BTW. So the jail is working, but the output of iptables-save | grep returns nothing, so the IP is not being blocked. All other jails work fine.

My openvpn.conf file in filter.d is:

# Fail2Ban filter for selected OpenVPN rejections

before = common.conf


failregex = ^ TLS Error: incoming packet authentication failed from \
        ^ <HOST>:\d+ Connection reset, restarting
        ^ <HOST>:\d+ TLS Auth Error
        ^ <HOST>:\d+ TLS Error: TLS handshake failed$
        ^ <HOST>:\d+ VERIFY ERROR

ignoreregex = 

and the section in jail.local is:

enabled  = true
port     = 1194
protocol = tcp
backend = auto
filter   = openvpn
logpath  = /var/log/openvpn.log
action = sendmail[name=openvpn, dest=my_email@my_domain.com]
banaction = iptables-multiport

The same thing is happening with my NGINX jail, fail2ban-client says its banned, and I get an email saying an IP was banned, but nothing happens.

  • i use iptables -S | grep fail2ban to get the banned ips. I think it's more appropiate than iptables-save which has a specific saving purpose.
    – bistoco
    Jan 4, 2018 at 0:31
  • Still no output though Jan 4, 2018 at 0:32
  • The problem is not recording them, it does that just fine. The problem is that they don't get banned. Jan 4, 2018 at 0:58
  • Yes, but not the IPs that are supposed to be banned by the OpenVPN jail. The only problem is that jail, other jails ban IPs just fine Jan 4, 2018 at 0:59
  • 1
    I set my OpenVPN server to 1194 TCP so it can work behind a port multiplexer Aug 22, 2018 at 18:03

1 Answer 1


According to the fail2ban Wiki you might want to try setting protocol = udp instead of protocol = tcp. www.fail2ban.org Wiki

Your banaction 'iptables-multiport' will create a new iptables chain with all banned ips and add this chain to iptables INPUT chain. You can check if this chain is being created correctly with iptables -vnL. Look for a 'f2b-openvpn' chain at the 'Chain INPUT' section at the top of that output and then a 'CHAIN f2b-openvpn' section with all the banned IPs further down that output.

Also consider obfuscating your mail address from you config example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.