Closed loftkey closed 2 weeks ago
Well to make a long story short. Extensions marked critical must be verified. If they are not marked critical and they do not have to be verified but could be. if they are "known". Users can use the verify_fun to themselves verify extensions not verified by default or to make further or application specific checks this works both with pyblic_key directly or via TLS (ssl application).
When it comes to Extended Key Usage, we previously always checked it to include TLS-client/server use, as most commonly this extension is used in the peer cert. However it is allowed for CA certs so we changed it to only verify the peer-cert for TLS-clint/server use which makes more sense. And then it became unhandled for CAs, however it seems reasonable to check it for certificate signing if it is a CA so we could add that, as it seems other implementations do.
Awesome, thank you for your time and help. If you need any information about this issue let us know!
@loftkey So this was a little more involved then anticipated, but now finally I have shaped up my PR #8840 so that you can try it out. I still need to work some on a new test case.
@IngelaAndin We have tested your fix, and it is working! Thank you so much!
$ erl
Erlang/OTP 27 [erts-15.1] [source] [64-bit] [smp:4:4] [ds:4:4:10] [async-threads:1] [jit:ns]
Eshell V15.1 (press Ctrl+G to abort, type help(). for help)
1> ssl:start(), ssl:connect("127.0.0.1", 8443, [{verify, verify_peer}, {versions, ['tlsv1.3']}, {cacertfile, "bad_ca-chain.crt"}, {server_name_indication, disable}]).
{ok,{sslsocket,{gen_tcp,#Port<0.5>,tls_connection,undefined},
[<0.116.0>,<0.115.0>]}}
Describe the bug When x509 Extended Key Usage (EKU) is marked as critical on a Intermediate Certificate Authority (ICA) certificate within a cert chain Erlang OTP errors out with.
OpenSSL, Postgres, Redis, JVM, Chrome, GoLang stdlib, and the .NET framework have no issues with these same certificate chains.
To Reproduce
1 Setup Download attached zip file. Extract it and navigate to the resulting directory in bash shell.
2 Create Root CA
3 Good For Erlang Only extension marked as critical in the cert chain is
Basic Constraints
as that is necessary for valid CA certificates with x509 strict validation. 3.1 Create Intermediate CA3.2 Create Cert
3.3 Create CA Chain
3.4 Run TLS Test Server
3.5 Test TLS with OpenSSL
Happy Dance - everything looks good
3.6 Test with Erlang OTP 26 (in Erlang shell) Command:
Full Result (Happy Dance):
4 Bad For Erlang Critical is specified for Basic Constraints and EKU extensions for this test. Only change in the ICA cert extensions from #3 is that EKU is now marked as critical. 4.1 Create Intermediate CA
4.2 Create Cert
4.3 Create CA Chain
4.4 Run TLS Test Server
4.5 Test TLS with OpenSSL
Still Happy Dance!!
4.6 Test with Erlang OTP 26 (in Erlang shell) Command:
Full Result:
Expected behavior Certificate chains with an ICA that contain a critical EKU extension are seen as having a supported extension.
Affected versions Seen in both 25 and 26 major versions of Erlang OTP.
Additional context See attached ZIP file for files produced in the test steps above. minimalRepo.zip