ambrop72 / badvpn

NCD scripting language, tun2socks proxifier, P2P VPN
Other
1.86k stars 603 forks source link

How to use ssl over socks5 via tun2socks #87

Open 578141611 opened 5 years ago

578141611 commented 5 years ago

There is new requirement to use ssl wrapping socks5 data.I already read the source code of tun2socks,but I find it is hard to implement this reqirement by modifying code.I want to use the BSSLConntion.c ,but I can not insert the code in here: // init SOCKS if (!BSocksClient_Init(&client->socks_client, socks_server_addr, socks_auth_info, socks_num_auth_info, addr, (BSocksClient_handler)client_socks_handler, client, &ss)) { BLog(BLOG_ERROR, "listener accept: BSocksClient_Init failed"); goto fail1; }

4-FLOSS-Free-Libre-Open-Source-Software commented 5 years ago

can't stunnel without modifying help you with that?

ambrop72 commented 5 years ago

I would indeed recommend an external approach like stunnel. Though it would be possible to add support for SSL based on the NSS library (not OpenSSL), since there is already NSS integration code present (https://github.com/ambrop72/badvpn/blob/master/nspr_support/BSSLConnection.h which is a layer that you insert on top of BConnection).

578141611 commented 5 years ago

I try to use openssl + bio to implement ssl over socks5,but I fail. @ambrop72 can you answer such question: (1)Why introduce PacketStreamSender In socksclient,but do not use in tun2socks.In my opinion,We should keep same socksclient and tun2socks (2)why all done opertion do not provide data buffer?

578141611 commented 4 years ago

@ambrop72 I have already add ssl over socks5 in tun2socks.

xDragonZ commented 4 years ago

Can you share us your implementation?

4-FLOSS-Free-Libre-Open-Source-Software commented 4 years ago

Can you share us your implementation?

@578141611 Please?

578141611 commented 4 years ago

@xDragonZ @4-FLOSS-Free-Libre-Open-Source-Software I can not shared the code,beacace of the limit of my company