Создаем файл /etc/fail2ban/filter.d/openvpn.conf со следующим содержимым:

# Примеры сообщений:
# Fri Sep 23 11:55:36 2016 TLS Error: incoming packet authentication failed from [AF_INET]59.90.146.160:51223
# Thu Aug 25 09:36:02 2016 117.207.115.143:58922 TLS Error: TLS handshake failed


[Definition]

failregex = ^ TLS Error: incoming packet authentication failed from \[AF_INET\]<HOST>:\d+$
            ^ <HOST>:\d+ Connection reset, restarting
            ^ <HOST>:\d+ TLS Auth Error
            ^ <HOST>:\d+ TLS Error: TLS handshake failed$
            ^ <HOST>:\d+ VERIFY ERROR
            ^ <HOST>:\d+ SIGUSR1\[soft,ping-restart\] received, client-instance restarting

ignoreregex =

Создаем локальную копию jail.conf:

cp -ivra /etc/fail2ban/jail.conf /etc/fail2ban/jail.local

Добавляем следующее содержимое:

[openvpn]

enabled  = true
port     = 1194
protocol = udp
filter   = openvpn
logpath  = /var/log/openvpn/siteovpn.log
maxretry = 3

bantime  = 604800  ;Бан на неделю - не меньфше ;)
ignoreip = 22.22.22.22 33.33.33.33 ;Этих не баним

Перезапускаем:

service fail2ban restart

Полезное

Просмотр состояния фильтра (openvpn):

root@veeampn:/# fail2ban-client status openvpn
Status for the jail: openvpn
|- Filter
|  |- Currently failed: 1
|  |- Total failed:     41
|  `- File list:        /var/log/openvpn/siteovpn.log
`- Actions
   |- Currently banned: 4
   |- Total banned:     4
   `- Banned IP list:   139.196.81.231 45.248.84.9 84.200.62.3 66.70.231.231

Просмотр заблокированных IP-адресов:

fail2ban-client status | grep "Jail list:" | sed "s/ //g" | awk '{split($2,a,",");for(i in a) system("fail2ban-client status " a[i])}' | grep "Status\|IP list"
root@veeampn:/# fail2ban-client status | grep "Jail list:" | sed "s/ //g" | awk '{split($2,a,",");for(i in a) system("fail2ban-client status " a[i])}' | grep "Status\|IP list"

Status for the jail: openvpn
   `- Banned IP list:   139.196.81.231 45.248.84.9 84.200.62.3 66.70.231.231
Status for the jail: sshd
   `- Banned IP list:

Разблокировка забаненного IP:

fail2ban-client set openvpn unbanip 111.222.333.444

Ротация логов OpneVPN - создаем файл /etc/logrotate.d/openvpn со следующим содержимым:

/var/log/openvpn/siteovpn.log {
  daily
  missingok
  copytruncate
  rotate 10
  compress
  delaycompress
}

Ссылки