PIA OpenVPN Client Encryption Patch

edited September 2016 in General VPN Support
Closing this thread for the time being to avoid misinformation as it's not currently relevant. These set-ups have since been modified and are no longer relevent. Please refer to the following Help Center article instead: https://helpdesk.privateinternetaccess.com/hc/en-us/articles/218984968-What-is-the-difference-between-the-OpenVPN-config-files-on-your-website-   - Dave R


We are releasing source code of the patch we apply to OpenVPN 2.2.2 for the bundled OpenVPN binaries we ship in all our clients.  We hope this helps the more technical users who wish to roll their own OpenVPN client setup stay more secure.

We will also post compiled binaries for all OSs at some point in the near future

pia_openvpn_patch.tar.bz2

==README==
- apply pia_openvpn.patch to OpenVPN 2.2.2* (included in this archive)
  [ http://swupdate.openvpn.org/community/releases/openvpn-2.2.2.tar.gz ]
  - tar xf openvpn-2.2.2.tar.gz && cd openvpn-2.2.2 && patch < ../pia_openvpn.patch

- compile patched OpenVPN normally
  - ./configure --enabled-password-save && make && sudo make install

- IMPORTANT: add the configuration option '--pia-signal-settings'

- to use a different cipher add the configuration option '--cipher CIPHER' 
  - supported ciphers are:
    - AES-128:       '--cipher aes-128-cbc'   << recommended
    - AES-256:       '--cipher aes-256-cbc'
    - Blowfish:      '--cipher bf-cbc'
    - No Encryption: '--cipher none'

- to use a different authentication digest add the configuration option '--auth DIGEST'
  - supported digests are: 
    - SHA1:              '--auth sha1'        << recommended
    - SHA256:            '--auth sha256'
    - No Authentication: '--auth none'

- to use differnet handshake encryption change the configuration option '--ca CERT'
  - supported handshake encryptions are:
    - RSA-2048:  '--ca ca_rsa2048.crt'        << recommended
    - RSA-3072:  '--ca ca_rsa3072.crt'
    - RSA-4096:  '--ca ca_rsa4096.crt'
    - ECC-256k1: '--ca ca_ecdsa256k1.crt'
    - ECC-256r1: '--ca ca_ecdsa256r1.crt'
    - ECC-521:   '--ca ca_ecdsa521.crt'

- for more information on vpn encryption choices see https://www.privateinternetaccess.com/pages/vpn-encryption

* our patch also includes a security patch which 2.2.2 requires 
  ( https://github.com/OpenVPN/openvpn/commit/11d21349a4e7e38a025849479b36ace7c2eec2ee )
«1

Comments

  • Thank you for this!
    We will also post compiled binaries for all OSs at some point in the near future
    Yay!! ^_^
  • Wow, I'm busy for a day, and this drops.

    Thanks PIA!
    I'll be checking it out in a few days and let you know what I think.

    Needless to say, apparently I was mistaken about PIA patching OpenVPN :)
  • I don't understand. OpenVPN 2.2.2 was released December 2011 which in internet terms is well past fossilized.

    Why not patch the latest version instead (2.3.6)?
  • Lol, there's always something to be complained about.
  • Lol, there's always something to be complained about.
    Yeah, but at least most of the complaints are legitimate.


  • edited March 2015
    I don't understand. OpenVPN 2.2.2 was released December 2011 which in internet terms is well past fossilized.

    Why not patch the latest version instead (2.3.6)?
    Often times more vulnerabilities are found is newer versions of OpenVPN and OpenVPN 2.2.2 is stable in that aspect. I think this is the reason why they use older OpenVPN versions. I personally think there maybe performance improvements and better compatibilities with newer operating systems in newer OpenVPN versions. Maybe this is a decision they came to the conclusion regardless, for security purposes.
  • edited March 2015
    I have been using OpenVPN GUI on Windows.

    I have taken the above 64bit binaries, and replaced the ones that ship with OpenVPN GUI.

    I have copied a config file, and added/changed the following:
    • cipher aes-256-cbc
    • auth sha256
    • ca ca_rsa4096.crt #got this file from the patch archive above
    • pia-signal-settings
    • link-mtu 1542
    I can connect to the VPN fine (to remote aus.privateinternetaccess.com on port 1194), however I get the following warnings:
    NOTE: OpenVPN 2.1 requires '--script-security 2' or higher to call user-defined scripts or executables

    WARNING: normally if you use --mssfix and/or --fragment, you should also set --tun-mtu 1500 (currently it is 1472)

    CRL: CRL crl.pem is from a different issuer than the issuer of certificate /C=US/ST=CA/L=LosAngeles/O=Private_Internet_Access/OU=Private_Internet_Access/CN=Private_Internet_Access/name=Private_Internet_Access/[email protected]

    WARNING: 'tun-mtu' is used inconsistently, local='tun-mtu 1472', remote='tun-mtu 1500'

    WARNING: 'cipher' is used inconsistently, local='cipher AES-256-CBC', remote='cipher BF-CBC'

    WARNING: 'auth' is used inconsistently, local='auth SHA256', remote='auth SHA1'

    WARNING: 'keysize' is used inconsistently, local='keysize 256', remote='keysize 128'

    Does the above log mean that SHA256/AES256 are not being used?
    Does it use the server settings instead?
    Should I be connecting on a different port number or change my config in some way?

    I'm also wondering if there are any changes to my MTU I should make? I'm on ADSL2, and my MTU is 1492. If setting it to something more appropriate in the OpenVPN connection config file will result in less fragmentation I'm happy to take suggestions!

    Thank you kindly for any advice.

    Edit: Formatting.
  • - IMPORTANT: add the configuration option '--pia-signal-settings'
    @p3591604: Did you?p, li { white-space: pre-wrap; }p3591604
  • This line needs changed.
    "link-mtu 1542"
    Change it to 1450 or less. 1500 is the maximum size any packet can be, and is reduced in tunneled packets by the tunneling overhead.

    And this needs to be in the shortcut you use to start. (The two dashes at the start tell me it is a command line suffix, rather than a config addition. Leave it in the config and try adding it to your shortcut and see if that helps.)
    "--pia-signal-settings"
  • edited March 2015
    OK, I have changed my link-mtu value to 1450.

    Now I am getting:
    WARNING: normally if you use --mssfix and/or --fragment, you should also set --tun-mtu 1500 (currently it is 1380)
    CRL: CRL crl.pem is from a different issuer than the issuer of certificate /C=US/ST=CA/L=LosAngeles/O=Private_Internet_Access/OU=Private_Internet_Access/CN=Private_Internet_Access/name=Private_Internet_Access/[email protected]
    WARNING: 'link-mtu' is used inconsistently, local='link-mtu 1450', remote='link-mtu 1542'
    WARNING: 'tun-mtu' is used inconsistently, local='tun-mtu 1380', remote='tun-mtu 1500'
    WARNING: 'cipher' is used inconsistently, local='cipher AES-256-CBC', remote='cipher BF-CBC'
    WARNING: 'auth' is used inconsistently, local='auth SHA256', remote='auth SHA1'
    WARNING: 'keysize' is used inconsistently, local='keysize 256', remote='keysize 128'
    As stated in my earlier post, I am using the OpenVPN GUI to connect. This is convenient because I can right click on the system tray icon and choose what country I want to connect to. I tried adding --pia-signal-settings to the shortcut, however it refuses to start with this unrecognised option.

    AFAIK there is no way to tell OpenVPN GUI to include an extra parameter when calling openvpn.exe

    I think I'm going to have to:
    • Call openvpn.exe at the command line, and pass in this parameter (as "pia-signal-settings" in the .ovpn connection file doesn't seem to work. OR
    • Rename openvpn.exe to openvpnold.exe, write a console app "openvpn.exe" that calls "openvpnold.exe --pia-signal-settings <and pass any other parameters> OR
    • Compile up a version of OpenVPN GUI with --pia-signal-settings hardcoded as a parameter for openvpn.exe

    I've got three avenues to try. Until I get the time to try them, I will just revert to using the standard .ovpn files I downloaded.

    Thanks for your help!

  • Good luck, and please keep us up to date on what method you use and how it works for you.
  • I wrote a .NET wrapper to catch the command line parameters passed by OpenVPN GUI and PIA Tray to openvpn.exe.

    I have also compared the OpenVPN logs generated between the PIA and OpenVPN Clients. They both have the same warnings

    It's my belief that putting pia-signal-settings in the .ovpn file is enough to connect with the chosen settings. Increasing the verbosity to 1, I can see that both methods result in the following being logged:

    Control Channel: TLSv1.2, cipher TLSv1/SSLv3 DHE-RSA-AES256-GCM-SHA384, 4096 bit RSA

    The warnings are just 'warnings' and I'm guessing just show the different default settings the client & server have. I imagine they agree upon a setting they both like during some handshake/negotiation process.

    So in the end I don't really need to do anything besides drop in the patched 2.2.2 openvpn binaries, and add/change the following settings in the .ovpn file
    • cipher aes-256-cbc
    • auth sha256
    • ca ca_rsa4096.crt
    • pia-signal-settings
    and it's good to go. OpenVPN GUI will connect fine.

    Commenting out "crl-verify crl.pem" in the .ovpn file removes the certificate issuer warning - I'm thinking it's just a server setting for specifying certificates that are to be immediately revoked: https://openvpn.net/index.php/open-source/documentation/howto.html#revoke

    Thanks again for these binaries - I'm going to use them moving forward.
  • VPNVPN
    edited March 2015
    Control Channel encryption is independent of Data Channel encryption, and the latter is more important to most people, and also what gets selected by "cipher" and "auth" settings.

    See these extracts from my log (I removed the timestamps to safe space):

    Data Channel Encrypt: Cipher 'BF-CBC' initialized with 128 bit key
    Data Channel Encrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
    Data Channel Decrypt: Cipher 'BF-CBC' initialized with 128 bit key
    Data Channel Decrypt: Using 160 bit message hash 'SHA1' for HMAC authentication
    Control Channel: TLSv1, cipher TLSv1/SSLv3 DHE-RSA-AES256-SHA, 2048 bit RSA


    These are from unpatched binaries, without any special encryption settings in the config.

    OpenVPN does use the same logic to parse options from the command line and the configuration files, so it should indeed work if put into the configuration file.

    The warnings about mismatched ciphers are indeed warnings, but please note that OpenVPN overrides the settings from the configuration with options it receives from the peer/server - if you and the server used different encryption settings, you couldn't read each others packets and no data will be transmitted (I've had this happen).

    If the CRL is only provided with one of the CAs' signatures, the warning will only disappear if you select that CA. Maybe a way around this could be using capath additionally to ca. I'm not sure if OpenVPN supports both options at the same time, but perhaps you'd like to try :)
  • My log has the following:
    WARNING: 'cipher' is used inconsistently, local='cipher AES-256-CBC', remote='cipher BF-CBC'
    WARNING: 'auth' is used inconsistently, local='auth SHA256', remote='auth SHA1'
    WARNING: 'keysize' is used inconsistently, local='keysize 256', remote='keysize 128'
    Data Channel Encrypt: Cipher 'AES-256-CBC' initialized with 256 bit key
    Data Channel Encrypt: Using 256 bit message hash 'SHA256' for HMAC authentication
    Data Channel Decrypt: Cipher 'AES-256-CBC' initialized with 256 bit key
    Data Channel Decrypt: Using 256 bit message hash 'SHA256' for HMAC authentication
    Control Channel: TLSv1.2, cipher TLSv1/SSLv3 DHE-RSA-AES256-GCM-SHA384, 4096 bit RSA
    As you can see 'cipher aes-256-cbc' and 'auth sha256' client options are being used even though they differ to the server settings.

    This makes your statement "but please note that OpenVPN overrides the settings from the configuration with options it receives from the peer/server" seem incorrect - at least with the patched binaries I am using.

    Yesterday I switched to using the "ca.crt" file included in the PIA Manager, instead of "ca_rsa4096.crt" in the PIA openvpn patch. Combined with commenting out "crl-verify crl.pem" I no longer have warnings about certificates/issuers.

    So everything is fine :-) At some point I might look at configuring the right MTU, however I won't get to that for a while.

    Thanks for the discussion guys - it's always good to learn something new!
  • those warnings are nothing to be concerned with.  you choose the settings you want.  there will be other lines if the server push changed parameters.

    use verb 5 to see more info.
  • edited March 2015
    The 'cipher/auth/keysize is used inconsistently' warnings can be safely ignored.  The 3 important log messages with regard to encryption are:

    Data Channel Encrypt: ...
    Data Channel Decrypt: ...
    Control Channel: ...

    Also, when using one of the certificates included in the pia_openvpn_patch archive you no longer need the 'crl-verify crl.pem' configuration option (which means you also no longer need the crl.pem file).
  • Yes, I am happy the source is made available.  But, I wish PIA would have instead just transitioned to using industry standard configurations.

  • I somewhat agree with cosmoxl, but am not totally sure what "industry standard configurations" means in this context. I don't have accounts with other VPN providers at this time.

    If you want to give users a choice regarding their crypto settings, you will either have to use different ports or a different set of IP addresses for each combination of crypto and MAC and CA. OpenVPN doesn't natively allow to negotiate these at runtime (TLS neither). PIA's patch adds this ability, meaning you can run different settings (per user) from the same IP address and port.

    I would guess that most competitors only offer one setting, which might not fit all purposes.
  • VPNVPN
    edited March 2015
    @Support: Are you saying that the other CAs will never have a CRL?
  • @VPN

    These CAs currently do not have or need a CRL.  If they ever did need one in the future it would be a different file anyway.
  • I somewhat agree with cosmoxl, but am not totally sure what "industry standard configurations" means in this context. I don't have accounts with other VPN providers at this time.

    If you want to give users a choice regarding their crypto settings, you will either have to use different ports or a different set of IP addresses for each combination of crypto and MAC and CA. OpenVPN doesn't natively allow to negotiate these at runtime (TLS neither). PIA's patch adds this ability, meaning you can run different settings (per user) from the same IP address and port.

    I would guess that most competitors only offer one setting, which might not fit all purposes.
    the idea to give users a choice is the sticking point.  what I meant by industry standard is that regular ovpn config files can be used by any openvpn client and it works.  that's currently not the case with PIA

    however, if PIA were to come out with an industry leading configuration generator which the user could use to generate an ovpn config with the necessary certs and keys and settings for the config wanted it could be done.

    but so far PIA have only wanted to conform everybody to their way - their app, and now their hacked version of openvpn.
  • Hm, but PIA wouldn't be able to allow all encryption settings on all available ports anymore - I don't see a way around the limitation. I suspect that other VPN providers just don't let the user choose.

    Can you give an example of a VPN provider that has choice via config file alone? I'd love to see how they accomplish it.
  • edited March 2015
    no, I don't know of other VPN providers that offer choices with regard to the overall openvpn encryption package.  there are some that are doing the xor thing, and other modifications meant to bypass firewalls and throttling.

    but regarding ports, does that really matter?  I've tested the PIA app with different settings and it always uses the port that I've specified.  It's not changing depending on the config.  but, I suppose their hacked openvpn triggers something in the server that other clients can't and is therefore able to use the other encryption settings.

  • @support

    Any more updates? Look forward to this being integrated into the PIA client.
  • @Gintama: This IS part of PIA Manager.
    What updates are you looking for?
  • > VPN > @Gintama: This IS part of PIA Manager. What updates are you looking for? I noticed that there are newer files than in the PIA Manager so I was asking if there were any more updates to it as of today. For example, it has a newer built of Openvpn 2.2, asking if there is a newer newer built.
  • They claim the binaries are built from the OpenVPN 2.2.2 source including the patch against the stated libraries.
    Which OpenVPN version is included in current the PIA Manager release?
  • I'm a little late to the thread cause I'm not here often, but I just wanted to say Thanks for releasing this. It's very cool that you can set the encryption without the PIA gui. Having options is always good, imo.
  • I downloaded and replaced the files contained in Win64.zip. I added the following parameters to my openvpn config file:

    --pia-signal-settings
    --cipher aes-128-cbc
    ca ca_rsa2048.crt (copied the crt files into config directory

    Upon connection I now get:

    WARNING: 'link-mtu' is used inconsistently, local='link-mtu 1558', remote='link-mtu 1542'
    WARNING: 'cipher' is used inconsistently, local='cipher AES-128-CBC', remote='cipher BF-CBC'

    I've read this thread and the info about link-mtu warnings. From other info I've read it seems you shouldn't mess with link-mtu unless you know what you doing and I don't know what i'm doing. So, how important is the warning, in laymens terms what impact will it have? 

    I did an MTU test and got the following:

    NOTE: Empirical MTU test completed [Tried,Actual] local->remote=[1557,1493] remote->local=[1509,1509]
    NOTE: This connection is unable to accomodate a UDP packet size of 1557. Consider using --fragment or --mssfix options as a workaround.



     
This discussion has been closed.