Skip to content

add obfuscate to openvpn connections ( very important for the users in china) - #3

Closed
sadan9 wants to merge 3 commits into
OpenVPN:masterfrom
sadan9:master
Closed

sadan9 wants to merge 3 commits into
OpenVPN:masterfrom
sadan9:master

Conversation

@sadan9

@sadan9 sadan9 commented Apr 18, 2013

Copy link
Copy Markdown

Chinese Government use GFW ( Great FireWall Of China .about it please look this:http://en.wikipedia.org/wiki/Great_Firewall_of_China) to block lot of website ,like Facebook , Twitter ,Youtube....

some chinese people use PPTP , L2TP ,OPENVPN , stunnel to bypassing GFW.
but after Dec 2012, GFW can block the connections of Openvpn. it's over looks like over Layer 7 because GFW can block the connections with any ports of TCP or UDP protocols.
some people think openvpn have feature codes in TLS handshake.

this change add obfuscate for openvpn connections to against the GFW.
there are tow parameter add to openvpn config file:
obfs-salt [secret]
-------this parameter is secret for obfuscate .
obfs-padlen [num]
------- this parameter optional. num=1~255. openvpn will add random data in the end of packages

@johntdyer

Copy link
Copy Markdown

Any thoughts if this is going to be merged in ?

@ngharo

ngharo commented Aug 22, 2013

Copy link
Copy Markdown

I kind of have a feeling patches like this will not be merged due to the constant changing DPI techniques used by firewalls. It seems like a never ending battle.

Not that this patch isn't GREAT for users that need it, I'm just afraid it'll create a burden on OpenVPN developers if they're maintaining support for it.

I will bring it up at the next OpenVPN developer meeting to get more official input.

Thanks!

lstipakov pushed a commit to lstipakov/openvpn that referenced this pull request Feb 27, 2015
…n:clp-master to clp-master

* commit '7cdd303b5404b43aae6b84360b0107657592e39b':
  Remove confusing flag check
  Fix possible NULL pointer dereference
@lipnitsk

Copy link
Copy Markdown

@ngharo Was there a decision made at the developer meeting?

@cron2

cron2 commented Oct 13, 2015

Copy link
Copy Markdown
Contributor

Hi,

On Mon, Oct 12, 2015 at 03:41:07PM -0700, Ilya Lipnitskiy wrote:

@ngharo Was there a decision made at the developer meeting?

No, we ran out of time.

gert

USENET is not the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]
fax: +49-89-35655025 [email protected]

@naivefun

Copy link
Copy Markdown

+1

@alimakki

Copy link
Copy Markdown

Can't this better be done with something like obfsproxy?
Perhaps making it easier to configure OpenVPN with obfs4 would be a more ideal approach.

@sadan9

sadan9 commented May 17, 2016

Copy link
Copy Markdown
Author

some device can't run obfs4.
ext. openvpn for iOS…

@mattock

mattock commented May 18, 2016

Copy link
Copy Markdown
Member

The OpenVPN development team has talked about adding obfuscation to OpenVPN many times in the past. We think obfuscation should be handled outside of OpenVPN by software that is designed for the job (e.g. obfsproxy). As mentioned above, it is a cat-and-mouse game, and we don't want to play that game. I believe obfsproxy does not need to be running locally (on the phone), so even if certain restricted platforms are unable to run it, there are workarounds. From what I've heard, commercial OpenVPN providers also tend to bundle obfsproxy instead of bundling obfuscation patches with OpenVPN.

I'll close this pull request soon unless somebody from the developer team objects.

@cron2

cron2 commented May 18, 2016

Copy link
Copy Markdown
Contributor

Hi,

On Tue, May 17, 2016 at 11:52:21PM -0700, Samuli Seppänen wrote:

I'll close this pull request soon unless somebody from the developer team objects.

We're not adding obfuscation code to OpenVPN - because, as you have mentioned,
it's an arm's race, so whenever we deploy something, the people that we want
to obfuscate from can see our commits and deploy countermeasures...

What I think would make sense is to add a plugin API for "packet mangling"
(so OpenVPN would create, encrypt and sign its outgoing packets and hand
it off to a plugin for obfuscation before sending, and incoming packets
would be de-obfuscated by the plugin before signature check / decryption).

I'm not going to implement this API any time soon, but I'm willing to
discuss and review, and potentially merge - provided the API is sane, and
does not add significant overhead to un-obfuscated packet flows.

gert

USENET is not the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]
fax: +49-89-35655025 [email protected]

@dsommers

Copy link
Copy Markdown
Member

Also see pull request #7 for similar arguments to why not use such static mangling/obfuscation methods into OpenVPN.

@johnx7271

Copy link
Copy Markdown

In reply to @cron2
An simple and effective way to obfuscate
Since openvpn is built on ssl, a simple way to obfuscate is to make it look like a https webserver until someone tell a spell (a secret code, like 芝麻开门) . Imagine you stand before a painting on a wall, before you say "芝麻开门", it remain a painting, no mater whatever you do or you say, but after you say a spell, a door is suddenly wide-open for you, and then you can do all the openvpn stuff.
To implement this, just re-route all the traffic which do not have a certain header, to a webserver (whatever, internal or external), and for the client to get this header, it must tell a spell.

@cron2

cron2 commented Feb 24, 2018 via email

Copy link
Copy Markdown
Contributor

@johnx7271

Copy link
Copy Markdown

hi @cron2

Sounds good, but why do you say "they can tell it because they are not stupid and have the source"? With the implementation I described, the regimes, even with full source at hand, wont be able to tell if a site is really an openvpn site or not, by just sniffing at the traffic exchanged. Unless the regime knows the exact spell, it wont find anything shady.

@schwabe

schwabe commented Feb 25, 2018

Copy link
Copy Markdown
Contributor

@johnx7271 VPN traffic without obfuscation really easy to identify just by traffic pattern analaysis. I think you really underestimate your adversary here.

@dsommers

Copy link
Copy Markdown
Member

What @schwabe says. For example, an https site doesn't have a constant stream of a relative similar packet size - which in VPN cases would typically be below 2KB (or probably even closer to 1500 bytes). So proper obfuscation need to account for bundling up bigger packets, which increases VPN tunnel latency. And it needs to have at least some periods with a longer or shorter packet send/receive delay. All this hits the general VPN tunnel performance in different ways.

And then comes the initial SSL/TLS handshake, which you need to comply to to have a proper SSL/TLS protocol. Here the certificates of server and client are transferred across the link unencrypted - where you can easily extract the certificate subjects and the reference to the signing CA. This means you can't even easily (or at least for a long time) even use fake "netflix.com" subject to disguise it as Netflix streaming - because it would be easy to spot it is a fake certificate as the signing CA would not match the official netflix.com certificates.

Yes, you might get around this for some time - but just until the DPI firewalls learns these tweaks and improves their detection algorithms.

Regardless, this obfuscation (even through a pure SSL/TLS connection) needs to happen outside the core OpenVPN. We are in the process of getting a plug-in API in place for OpenVPN so such obfuscation can be handled outside the core OpenVPN. This way DPI firewalls will have it more difficult as the obfuscation is not necessarily a "standard" obfuscation. It depends entirely on the plug-ins being deployed. We will most likely provide some simple sample plug-ins for obfuscation. But for larger scale deployments, it would be advisable to use a quite different obfuscation algorithm.

@johnx7271

Copy link
Copy Markdown

I agree that vpn traffic has abnormal statistical attributes for gfw detecting, and site certificate is also an issue. But isn't ssl the best foundation on which to build obfuscating? 1. ssl is secure, so it is very easy to hide something in it, and is very difficult for the middle man to have a full monitor of it. 2. ssl is widely used.
I am not familiar with vpn and openvpn implementation, I suppose that, openvpn operates on top of ssl, so all the openvpn traffic is completely hidden from middle man, for example, it can be designed such that, the server check for a spell in client request (or handshake), if it's correct, then it goes on to vpn processing flow, else it simply re-route to a web server. The spell is wrapped in ssl data payload, so probably it is not easy to use plun-in to implement these.

@dsommers

Copy link
Copy Markdown
Member

The OpenVPN wire protocol contains of a data channel and a control channel. The type of channel is indicated in on of the first bytes of the packet being sent over the wire. The control channel deploys the TLS protocol, where the configuration between client and server is exchanged as well as a key derivation process. This is also where the certificate/PKI handling is covered. The result of the key derivation process via the control channel is used as a symmetric encryption key which is used on the data channel. And it is the data channel which carries the tunnelled network data.

SSL/TLS itself is fairly robust and safe. But remember that when deploying that on-top of OpenVPN itself, you get two layers of encryption. This carries a noticable performance cost as well. And it is essentially pointless in regards to the tunnel security itself, as OpenVPN already uses the TLS protocol. But the packets reveals themself easily due to the special approach of encapsulating SSL/TLS packets for the control channel. The additional SSL/TLS layer only needs to disguise the first, say, 8 bytes, of a packet. And if used together with --tls-crypt (instead of --tls-auth), the control channel is encrypted - including the certificate handshake. An obfuscation method taking this approach will have a far better performance than adding encryption on top of everything in the packet.

And what you describe with separating and re-routing https traffic to a web server ... @cron2 already correctly pointed out that this "magic" is already present. Have a look at --port-share in the man page.

Now is the time to stop beating a dead horse.

@johnx7271

Copy link
Copy Markdown

"deploying that on-top of OpenVPN"? so you designed openvpn this way? I thought it should be openvpn over tsl/ssl. Then there would be no need for double encryption, and it can be made completely indistinguishable from tsl/ssl.

Anyway thank you.

@selvanair

Copy link
Copy Markdown
Contributor

FWIW, I detect some misunderstanding here. Some are talking about obfuscation within openvpn and providing plugin or other support for it. I think that is useless for bypassing GFW or anything of that level of sophistication and resources.

The other suggestion is to use openvpn over a TLS connection. I guess, no one responded because (i) that's not what this thread originally was about (ii) it doesn't require any support from openvpn --- e.g., just use stunnel as the TLS layer. That alone is easily detected unless TLS client auth is used and traffic to a real web server is multiplexed. A multiplexer like sslh or portshare within openvpn itself may help.

In a very limited testing I participated, openvpn through stunnel appeared to work well through GFW. But long running servers with sustained traffic will very likely alert GFW through statistical analysis.

Recap: Obfuscation is best handled outside OpenVPN and is more effectively discussed on forums dedicated to it.

@chipitsine

Copy link
Copy Markdown
Contributor

@selvanair - what do you think, it seems to make sense to add obfsproxy support to openvpn-gui (like privatetunnel and airvpn already do) ?

@selvanair

Copy link
Copy Markdown
Contributor

My first reaction would be no, but if any one submits a good quality patch that is easy to maintain, we could consider it. If you want to discuss this further, please start a thread in the GUI. This one has been beaten to death..

@johnx7271

johnx7271 commented Feb 26, 2018 •

Copy link
Copy Markdown

@selvanair,my "openvpn over a TLS connection" means different than yours, I mean:
openvpn should be (vpn specific stuff and plus some camouflage stuff) + tls,
Actually, there is a thing called socksvpn, which is vpn built on stunnel, my idea of openvpn should be like that. But I guess that means a re-writing of openvpn, a suggestion too late.
what you mean:
(the current entire openvpn) over(tunneled thru) tls.
You guys have the concept of class inheritance, in that language, (my_openvpn is tls) == true,
so it's almost a perfect obfuscate.

@dsommers

Copy link
Copy Markdown
Member

@johnx7271 said:

"deploying that on-top of OpenVPN"? so you designed openvpn this way? I thought it should be openvpn over tsl/ssl. Then there would be no need for double encryption, and it can be made completely indistinguishable from tsl/ssl.

Well, it has to be this way to get the best performance. SSL/TLS depends a bit too much on asymmetric encryption which is by far slower than symmetric encryption. I also believe there is a larger packet overhead with "proper" SSL/TLS connections than pure symmetric encryption. And the traffic we pass over the control channel ("proper" SSL/TLS) is fairly minimal to the amount of network data being transported (over the symmetrically encrypted data channel).

A few words on the impact the overhead in each packet results in. For example, users switching from --auth SHA1 (default [1]) to --auth SHA256 does report a measurable performance loss, as this change makes each OpenVPN packet 24 bytes longer. And users who deployed --auth SHA512 are really experiencing a more sluggish connection, as that grows each packet with 64 bytes per packet compared with SHA256. So each byte of overhead counts.

Another detail of this design. SSL/TLS is strictly designed for TCP connections, with reliability aspects (packet drops, resends, duplicate packets check, etc) being handled by the TCP stack. VPNs have the best performance with UDP (TCP over TCP is known challenge with VPNs), so the approach used by OpenVPN enables SSL/TLS over UDP - as the OpenVPN encapsulation adds the needed information in UDP packets to handle the reliability stuff built into the TCP stack.

Now you can argue that DTLS handles this with UDP. But DTLS was published in April 2006. The very first initial OpenVPN release arrived in May 2001 and the first version deploying a control channel was released in October 2002. And the OpenVPN wire protocol is mostly backwards compatible back to at least OpenVPN 2.0 - as long as you don't use OpenVPN features not available in such old clients. (Not that we recommend using such old clients)

So that is both the technical and historic background for the current design.

[1] Usage of SHA1 in the --auth SHA1 context is considered safe, as it is used with HMAC. HMAC-SHA1 is not currently known to be broken.

@dsommers

dsommers commented Feb 26, 2018 •

Copy link
Copy Markdown
Member

@chipitsine said:

@selvanair - what do you think, it seems to make sense to add obfsproxy support to openvpn-gui (like privatetunnel and airvpn already do) ?

It is truly sad to not see these VPN service providers interacting with the community to resolve this issue in a far more transparent way.

Once we get the plug-in interface involved, their hackish approach will no longer be needed. You just need to compile the obfuscation plug-in for the platforms you support and deploy that. Whatever this plug-in does can be whatever they implement it to do, so it could still carry some competition edge even though the core OpenVPN got a more native support for obfuscation.

But I agree with @selvanair. Both in this topic and about creating a new discussion thread.

@dsommers

Copy link
Copy Markdown
Member

I will now lock this discussion, I think we've reached as long as we can come.

@OpenVPN OpenVPN locked as resolved and limited conversation to collaborators Feb 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.