sorry for the delay… I had been busy with other projects…
@stephdl great implementation of the jail…!
thanks!
unfortunately, the jail doesn’t ban me if I use wrong tls settings in order to connect… [quote=“stephdl, post:4, topic:6207”]
fail2ban-regex /var/log/openvpn/openvpn.log /etc/fail2ban/filter.d/openvpn.conf
[/quote]`]# fail2ban-regex /var/log/openvpn/openvpn.log /etc/fail2ban/filter.d/openvpn.conf
Running tests
Use failregex filter file : openvpn, basedir: /etc/fail2ban
Use log file : /var/log/openvpn/openvpn.log
Use encoding : UTF-8
Results
Failregex: 0 total
Ignoreregex: 0 total
Date template hits:
|- [# of hits] date format
| [4810] (?:DAY )?MON Day 24hour:Minute:Second(?:.Microseconds)?(?: Year)?
`-
Lines: 4840 lines, 0 ignored, 0 matched, 4840 missed
[processed in 0.32 sec]
Missed line(s): too many to print. Use --print-all-missed to print all 4840 lines`
some of the missed lines are: SENT CONTROL [UNDEF]: 'AUTH_FAILED' (status=1) | WWWSun Mar 19 18:24:49 2017 us=9638 192.168.2.103:62562 SIGTERM[soft,delayed-exit] received, client-instance exiting | Sun Mar 19 18:24:58 2017 us=844525 MULTI: multi_create_instance called | Sun Mar 19 18:24:58 2017 us=844578 192.168.2.103:60462 Re-using SSL/TLS context | Sun Mar 19 18:24:58 2017 us=844591 192.168.2.103:60462 LZO compression initialized | Sun Mar 19 18:24:58 2017 us=844653 192.168.2.103:60462 Control Channel MTU parms [ L:1602 D:1212 EF:38 EB:0 ET:0 EL:3 ] | Sun Mar 19 18:24:58 2017 us=844662 192.168.2.103:60462 Data Channel MTU parms [ L:1602 D:1450 EF:102 EB:143 ET:0 EL:3 AF:3/1 ] | Sun Mar 19 18:24:58 2017 us=844676 192.168.2.103:60462 Local Options String: 'V4,dev-type tun,link-mtu 1602,tun-mtu 1500,proto UDPv4,comp-lzo,cipher AES-256-CBC,auth SHA512,keysize 256,key-method 2,tls-server' | Sun Mar 19 18:24:58 2017 us=844681 192.168.2.103:60462 Expected Remote Options String: 'V4,dev-type tun,link-mtu 1602,tun-mtu 1500,proto UDPv4,comp-lzo,cipher AES-256-CBC,auth SHA512,keysize 256,key-method 2,tls-client' | Sun Mar 19 18:24:58 2017 us=844690 192.168.2.103:60462 Local Options hash (VER=V4): 'aaa173e3' | Sun Mar 19 18:24:58 2017 us=844700 192.168.2.103:60462 Expected Remote Options hash (VER=V4): '9c102b00' | RSun Mar 19 18:24:58 2017 us=844731 192.168.2.103:60462 TLS: Initial packet from [AF_INET]192.168.2.103:60462 (via [AF_INET]192.168.2.99%em1), sid=c97f1cc4 a7197df0 | WRRWWWRRRWRFailed to open the accounts database | Sun Mar 19 18:24:59 2017 us=963178 192.168.2.103:60462 WARNING: Failed running command (--auth-user-pass-verify): external program exited with error status: 1 | Sun Mar 19 18:24:59 2017 us=963202 192.168.2.103:60462 TLS Auth Error: Auth Username/Password verification failed for peer | Sun Mar 19 18:24:59 2017 us=963218 192.168.2.103:60462 WARNING: 'link-mtu' is used inconsistently, local='link-mtu 1602', remote='link-mtu 1542' | Sun Mar 19 18:24:59 2017 us=963228 192.168.2.103:60462 WARNING: 'cipher' is used inconsistently, local='cipher AES-256-CBC', remote='cipher BF-CBC' | Sun Mar 19 18:24:59 2017 us=963235 192.168.2.103:60462 WARNING: 'auth' is used inconsistently, local='auth SHA512', remote='auth SHA1' | Sun Mar 19 18:24:59 2017 us=963242 192.168.2.103:60462 WARNING: 'keysize' is used inconsistently, local='keysize 256', remote='keysize 128' | WRSun Mar 19 18:24:59 2017 us=964154 192.168.2.103:60462 Control Channel: TLSv1.2, cipher TLSv1/SSLv3 DHE-RSA-AES256-GCM-SHA384 | Sun Mar 19 18:24:59 2017 us=964181 192.168.2.103:60462 Peer Connection Initiated with [AF_INET]192.168.2.103:60462 (via [AF_INET]192.168.2.99%em1) | RSun Mar 19 18:25:01 2017 us=36034 192.168.2.103:60462 PUSH: Received control message: 'PUSH_REQUEST' | Sun Mar 19 18:25:01 2017 us=36056 192.168.2.103:60462 Delayed exit in 5 seconds | Sun Mar 19 18:25:01 2017 us=36064 192.168.2.103:60462 SENT CONTROL [UNDEF]: 'AUTH_FAILED' (status=1) | WWWSun Mar 19 18:25:06 2017 us=393799 192.168.2.103:60462 SIGTERM[soft,delayed-exit] received, client-instance exiting
similarly with the other authentication methods (certificate only, certificate + user + password)…
I don’t know why it doesn’t work in such situations…