mobius-software-ltd / pyton3-dtls

Datagram Transport Layer Security for Python
Apache License 2.0
6 stars 6 forks source link

Client not receiving or responding to Hello Verify Request #8

Open albion-packet-hooking opened 3 years ago

albion-packet-hooking commented 3 years ago

I've used your sample code and the various test files found within the project but I can't get any of them to get past the server responding to the Client Hello. I've tried it on Python 3.6 and 3.8.

Any insight or work being done on this project at the moment? Just checking before I dive into trying to understand it and see if I can fix it.

CLIENT:

DEBUG:dtls.util:Allocating BIO: 1820701169296
DEBUG:dtls.sslconnection:Allocating SSL CTX: 1820745966944
DEBUG:dtls.sslconnection:Allocating SSL: 1820747085472
DEBUG:dtls.sslconnection:Initiating handshake...
DEBUG:dtls.sslconnection:SSL_handshake_start:b'before SSL initialization':1
DEBUG:dtls.sslconnection:SSL_connect_loop:b'before SSL initialization':1
DEBUG:dtls.sslconnection:SSL_connect_loop:b'SSLv3/TLS write client hello':1

SERVER:

DEBUG:dtls.util:Allocating BIO: 1750033871312
DEBUG:dtls.demux.router:Created new connection for address: None
DEBUG:dtls.sslconnection:!!! _init_server where rsock != self._sock !!!
DEBUG:dtls.util:Allocating BIO: 1750033869520
DEBUG:dtls.sslconnection:Allocating SSL CTX: 1750034613648
DEBUG:dtls.sslconnection:Allocating SSL: 1750033101440
DEBUG:dtls.demux.router:Received datagram from peer: ('127.0.0.1', 59892)
DEBUG:dtls.demux.router:Forwarding datagram from peer: ('127.0.0.1', 59892), default: True
DEBUG:dtls.sslconnection:Invoking DTLSv1_listen for ssl: 1750033101440
DEBUG:dtls.sslconnection:Get cookie for ssl: 1750033101440
DEBUG:dtls.openssl:Returning cookie: [224, 101, 153, 246, 52, 25, 255, 182, 60, 229, 57, 105, 64, 149, 245, 249]

image

Here is the output from running echo_seq

C:\Python36\python.exe -m dtls.test.echo_seq
DEBUG:dtls.util:Allocating BIO: 1724623979104
DEBUG:dtls.demux.router:Created new connection for address: None
DEBUG:dtls.sslconnection:!!! _init_server where rsock != self._sock !!!
DEBUG:dtls.util:Allocating BIO: 1724623982048
DEBUG:dtls.sslconnection:Allocating SSL CTX: 1724623982624
DEBUG:dtls.sslconnection:Allocating SSL: 1724623983632
Listen invocation: 1
DEBUG:dtls.demux.router:Received datagram from peer: ('127.0.0.1', 62609)
DEBUG:dtls.demux.router:Forwarding datagram from peer: ('127.0.0.1', 62609), default: True
DEBUG:dtls.sslconnection:Invoking DTLSv1_listen for ssl: 1724623983632
DEBUG:dtls.sslconnection:Get cookie for ssl: 1724623983632
DEBUG:dtls.openssl:Returning cookie: [123, 230, 123, 157, 25, 190, 222, 179, 32, 144, 82, 51, 122, 65, 112, 227]
albion-packet-hooking commented 3 years ago

Just saw something weird. A client hello gets sent on a port, then another gets sent, the server sees the second one and responds to that port and the real client never gets it. Guessing that is the demux which is forwarding the packet. image

albion-packet-hooking commented 3 years ago

Seems like some kind of problem with this router and write BIO linkage or something.

I neutered the SSLConnection class down to just the basics and managed to connect and receive/send data.

Should note that the server still isn't able to send. Getting a peer unreachable.

sarain commented 3 years ago

Just chiming in that I'm also experiencing this problem. I haven't dug quite as deep as you have here but the symptoms match, with it getting hung after DEBUG:dtls.openssl:Returning cookie: on the server side. Just using the client example in the readme so far and don't have debug log prints there but it also hangs.