twisteroidambassador / ptadapter

Pluggable Transports Python interface & standalone tunnels
GNU General Public License v3.0
60 stars 9 forks source link

Problem with ptadapter obfs3 and OPENVPN #11

Open morilp opened 1 year ago

morilp commented 1 year ago

I want to connect with ptadapter and obfs3 to openvpn server the config files are below:

Client config:

[client] exec = "D:\MyApp\ptadapter_config\obfs4proxy.exe"

state = "D:\MyApp\ptadapter_config\state"

tunnels = fn_obfs_4 fn_obfs_3 [fn_obfs_3] transport = obfs3 listen = 127.0.0.1:3883 upstream = x.x.x.x:10113

Server Config

[server] exec = /usr/bin/obfs4proxy -enableLogging state = ./state forward = 127.0.0.1:1194 tunnels = server_obfs4 server_obfs3 [server_obfs3] transport = obfs3 listen = 127.0.0.1:10113

i did use socks proxy on openvpn client also and after i click on connect button the below error occured on client terminal:

[2023-01-04 16:03:32,857] WARNING handler PT reported error while connecting to upstream ('x.x.x.x', 10113): PTSOCKS5ConnectError(<SOCKS5Reply.GENERAL_FAILURE: b'\x01'>) [2023-01-04 16:03:32,859] ERROR handler Unexpected error Traceback (most recent call last): File "C:\Users\Mori\AppData\Roaming\Python\Python311\site-packages\ptadapter\contexts.py", line 45, in log_unhandled_exc yield File "C:\Users\Mori\AppData\Roaming\Python\Python311\site-packages\ptadapter\console_script.py", line 52, in handle_client_connection async with contexts.log_unhandled_exc(handler_logger), \ File "C:\Program Files\Python311\Lib\contextlib.py", line 211, in aexit await anext(self.gen) File "C:\Users\Mori\AppData\Roaming\Python\Python311\site-packages\ptadapter\contexts.py", line 29, in aclosing_multiple_writers closetasks, = await asyncio.wait([w.wait_closed() for w in writers]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Program Files\Python311\Lib\asyncio\tasks.py", line 415, in wait raise TypeError("Passing coroutines is forbidden, use tasks explicitly.") TypeError: Passing coroutines is forbidden, use tasks explicitly. C:\Users\Mori\AppData\Roaming\Python\Python311\site-packages\ptadapter\console_script.py:52: RuntimeWarning: coroutine 'StreamWriter.wait_closed' was never awaited async with contexts.log_unhandled_exc(handler_logger), \ RuntimeWarning: Enable tracemalloc to get the object allocation traceback

Maybe its a bug idk but i have same problem when i tried obfs4 connection btw. Tanks for your great work.

twisteroidambassador commented 1 year ago

Hi,

your immediate problem is that the PT cannot connect to the server, and returned an error status. Looking at your server configuration, you're listening on the loopback address 127.0.0.1, which means only clients on the same host can connect to the server. Maybe you meant to listen on the wildcard address 0.0.0.0?

There's also an error when handling the failed connection. I will look into that later.

morilp commented 1 year ago

Thank you for your answer, but I found out through the tcpdump command that my connection with the server is established and the problem is that the obfs protocols are completely blocked in my country. now idk how can i connect to freedom world :)

twisteroidambassador commented 1 year ago

obfs3 is probably blocked pretty thoroughly in many places. obfs4 might work better, but sophisticated nation state censors are known to discover and block them as well. The other notable pluggable transports are meek and snowflake, but I don't know whether they are self-host friendly.