Closed TinCanTech closed 3 years ago
After a major re-write of easytls-cryptv2-verify.sh
and client-connect/disconnect
, conntrac
is considerably more reliable.
Changes seem to be worse than before ..
Turns out Openvpn has a bug: https://community.openvpn.net/openvpn/ticket/160#comment:19
I applied a rebased version of JJK's patch:
tct@home:~/openvpn/master$ git diff
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 22357cfb..bccb82a7 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -557,6 +557,9 @@ setenv_stats(struct context *c)
static void
multi_client_disconnect_setenv(struct multi_instance *mi)
{
+ /* setenv incoming cert common name for script */
+ setenv_str (mi->context.c2.es, "common_name", tls_common_name (mi->context.c2.tls_multi, true));
+
/* setenv client real IP address */
setenv_trusted(mi->context.c2.es, get_link_socket_info(&mi->context));
tct@home:~/openvpn/master$
and it works.
Even with a patched version, Openvpn sometimes omits common_name
altogether for --client-disconnect
.
It looks like this bug is going to be around for a long time.
I have added code to catch and record disconnect failures, and also try a regexp method to remove the errant record.
Easy-TLS is a fully functional workaround to https://community.openvpn.net/openvpn/ticket/160
Closed: 9864cfab1f9dcc7712333db69daa4a2d7b815601
It is possible for a client session to be re-initialised by Opevpn without any notification to external scripts, thus breaking connection tracking.
The log below shows client
ub18
2021-08-31 16:21:10 us=977899 peer 2 (ub18) floated from 192.168.1.2:4439 to [AF_INET6]::ffff:192.168.1.2:1713
soft reset
: (What happened here?)2021-08-31 16:23:47 us=814582 ub18/192.168.1.2:2796 TLS: new session incoming connection from [AF_INET6]::ffff:192.168.1.2:2796
2021-08-31 16:23:47 us=883246 ub18/192.168.1.2:2796 TLS: move_session: dest=TM_ACTIVE src=TM_UNTRUSTED reinit_src=1
2021-08-31 16:23:47 us=883642 ub18/192.168.1.2:2796 TLS: tls_multi_process: untrusted session promoted to trusted
conn-trac
record in place and forgets theIP:Port
:5b24..=2A0F..=192.168.1.2=4439
Port4439
is the original connection as shown in the log.There is nothing I can do about this except come up with a completely new approach. Currently, the best solution appears to be this:
--setenv UV_tlskey 5b24.. --push-peer-info
in the clientinline
file. This will allow connection tracking to followtlskey-serial
for TLS-Crypt-V2 keys. I'll have to consider other TLS keys .. maybe it's not actually possible at all.Log of events: