-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
export-p12: use OpenSSLv3-compatible ciphers (AES-256-CBC & SHA256) with OpenSSL 1.1 #1081
Conversation
This makes the exported .p12 file readable by OpenSSLv3 without needing -legacy. Using "export-p12 <CN> legacy" will suppress this behavior. Fixes OpenVPN#966
Do you have anything better than a stab at ? For example, you could document your use case and |
From your code comment: Easy-RSA does not use PKCS files, it only exports them. What ever application does use PKCS files must be able to read those files, regardless of format. Example: OpenVPN must have built-in support to read both varieties of Easy-RSA does not need to force OpenSSL 1x to behave as OpenSSL 3x. I cannot find a reason to make the change suggested here. |
The scenario is where Easy-RSA is running on a server with OpenSSL 1.1 (as many LTS distros still are). The PKCS#12 files generated by I believe this problem is better solved by producing p12 files which are compliant with the cryptography policies of modern OpenSSL, rather than adding more options/shims to OpenVPN to support legacy ciphers (which they probably wouldn't want to do anyway). Also, it's possible for OpenSSL v3 to be installed without legacy support, or to have it disabled via system policy, and producing compliant files avoids both those issues. As I understand, it's actually OpenSSL itself erroring out when OpenVPN attempts to load the "legacy" p12 files:
In most GUI frontends, this is presented as a prompt for the .p12 bundle's password (even if it doesn't have one), which then refuses your password, as reported in OpenVPN/openvpn#238. In that issue they tell the reporter to recreate the p12 file without legacy ciphers, which this PR will do for easy-rsa. The p12 file produced with my changes is loaded properly by OpenVPN 2.6 + OpenSSL 3.x. I'm happy to add more documentation wherever is appropriate, but I can't find the |
More details: there are two types of PKCS#12 files produced, which I will call "modern" and "legacy". These are the ciphers reported by Modern
Legacy
OpenSSL 3.x will not load this file unless you add
Easy-RSA export-p12 outputThese tables describe the types of PKCS#12 files produced by Current state (git HEAD 70bb7ec)
With this PR
As you can see, this makes the output more consistent. |
I think you have covered everything. If there are further questions, I'm sure that you will have suitable answers. Thank you for these details, they make all the difference. |
Before I proceed further with this, I would like to hear some feedback from more senior members of OpenVPN. This is an unusual change in that, EasyRSA is taking a different default position with regard to using OpenSSL. Otherwise, EasyRSA follows OpenSSL defaults and then allows options to modify those defaults. This is the only example, that I can think of, where EasyRSA is taking an active role in what we expect of OpenSSL. Namely, forcing OpenSSL 1x to behave as 3x. This is a decision regarding EasyRSA policy toward the OpenSSL 1x to 3x transition. I think this change is a good idea but I have been wrong before. |
I believe that the issue being addressed here is directly related to OpenVPN/openvpn#505 Awaiting feedback from Openvpn.. |
When creating "crypto stuff", it makes sense to always use reasonably-recent algorithms - so generally, going for modern-format So, from OpenVPN upstream, this is a welcome change (not having looked at the code, but the conceptual change). |
[OpenVPN/openvpn#505] is about For the end user, a more practical option is to use That said, the legacy pkcs12 issue is unrelated. If easy-rsa is outputting pkcs12 files it looks useful to provide an option to use a more modern encryption instead of sticking to the OpenSSL default. I suppose that's the intent of this PR.
I wouldn't characterize it that way. Its more like not using default settings for pkcs12 creation on OpenSSL 1 as that is no longer considered secure. That said this is not a show-stopper as OpenVPN linked to OpenSSL3 can be made to read legacy pkcs12 files by loading the "legacy" provider. |
In case of pkcs12, macOS and Android will not import those AES256 ones. For those you actually still need the 3DES variants. PKCS12 support is currently an absolute minefield. |
Good news!
Good point!
Thank you. EasyRSA retains 'legacy' option for this landmine! I am happy to merge this as-is. However, with your permission, I will make some subsequent, minor changes to "style". Thank you everyone, for your help. |
Yes, you have my permission to make style changes. Thanks! |
@adaugherity This PR cannot be merged because the commit is not signed. I have an alternative PR prepared, which refers to this as the originating code. The second option above would save us all some time. |
Superseded-by: #1083 |
This is my stab at fixing #966. It makes the exported .p12 file readable by OpenSSL v3 without needing
-legacy
.I think it's better to have this on by default, but allow opting out where backwards compatibility is needed. To provide compatibility, I decide to make the "export-p12 CN legacy" option suppress this behavior and use the default ciphers.
(That option is no longer OpenSSL v3-only: it now provides "legacy" behavior on all versions of OpenSSL. For v3, it uses
-legacy
; for non-v3, it uses the default ciphers, omitting the keypbe/certpbe/macalg options.)