{"id":108,"date":"2023-01-18T17:04:29","date_gmt":"2023-01-18T16:04:29","guid":{"rendered":"https:\/\/www.funkgui.it\/?p=108"},"modified":"2023-01-18T17:09:34","modified_gmt":"2023-01-18T16:09:34","slug":"fail2ban-openvpn","status":"publish","type":"post","link":"https:\/\/www.funkgui.it\/index.php\/fail2ban-openvpn\/","title":{"rendered":"Fail2ban openvpn"},"content":{"rendered":"\n<p>Innanzitutto abilitare il log all&#8217;interno del file di configurazione del server con i comandi:<\/p>\n\n\n\n<p>log \/var\/log\/openvpn\/openvpn.log<br>verb 3<\/p>\n\n\n\n<p>Creare il il file di configurazione del filtro:<br><br>\/etc\/fail2ban\/filter.d\/openvpn.conf <\/p>\n\n\n\n<p>e scriverci:<\/p>\n\n\n\n<p>[INCLUDES]<br>before = common.conf<\/p>\n\n\n\n<p>[Definition]<br>failregex = ^ TLS Error: incoming packet authentication failed from [AF_INET]:\\d+$<br>^ :\\d+ Connection reset, restarting<br>^ :\\d+ TLS Auth Error<br>^ :\\d+ TLS Error: TLS handshake failed$<br>^ :\\d+ VERIFY ERROR<\/p>\n\n\n\n<p><br>Verificare le regular expressions con il proprio log:<\/p>\n\n\n\n<p>fail2ban-regex -v \/var\/log\/openvpn\/openvpn.log \/etc\/fail2ban\/filter.d\/openvpn.conf<\/p>\n\n\n\n<p>Creare il file di configurazione della jail:<br>\/etc\/fail2ban\/jail.d\/openvpn.conf<\/p>\n\n\n\n<p>e scriverci<\/p>\n\n\n\n<p>[openvpn]<br>enabled = true<br>port = 11194<br>protocol = udp<br>filter = openvpn<br>logpath = \/var\/log\/openvpn\/openvpn.log<br>maxretry = 3<\/p>\n\n\n\n<p>ovviamente modificare i parametri come necessario<\/p>\n\n\n\n<p>eseguire il restart del servizio fail2ban<br><\/p>\n\n\n\n<p>systemctl restart fail2ban.service<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Innanzitutto abilitare il log all&#8217;interno del file di configurazione del server con i comandi: log \/var\/log\/openvpn\/openvpn.logverb 3 Creare il il file di configurazione del filtro: \/etc\/fail2ban\/filter.d\/openvpn.conf e scriverci: [INCLUDES]before = common.conf [Definition]failregex = ^ TLS Error: incoming packet authentication failed from [AF_INET]:\\d+$^ :\\d+ Connection reset, restarting^ :\\d+ TLS Auth Error^ :\\d+ TLS Error: TLS handshake [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-108","post","type-post","status-publish","format-standard","hentry","category-generico"],"_links":{"self":[{"href":"https:\/\/www.funkgui.it\/index.php\/wp-json\/wp\/v2\/posts\/108","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.funkgui.it\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.funkgui.it\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.funkgui.it\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.funkgui.it\/index.php\/wp-json\/wp\/v2\/comments?post=108"}],"version-history":[{"count":3,"href":"https:\/\/www.funkgui.it\/index.php\/wp-json\/wp\/v2\/posts\/108\/revisions"}],"predecessor-version":[{"id":111,"href":"https:\/\/www.funkgui.it\/index.php\/wp-json\/wp\/v2\/posts\/108\/revisions\/111"}],"wp:attachment":[{"href":"https:\/\/www.funkgui.it\/index.php\/wp-json\/wp\/v2\/media?parent=108"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.funkgui.it\/index.php\/wp-json\/wp\/v2\/categories?post=108"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.funkgui.it\/index.php\/wp-json\/wp\/v2\/tags?post=108"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}