-
Notifications
You must be signed in to change notification settings - Fork 3k
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
SSL / TLS incompatibility when using ecdsa keys introduced in 26.5.2.3 (and 27.x) #8918
Comments
How to reproduce using the otp-dist-test repository: Terminal A, with OTP 26.2.5 installed running on my host
Terminal B, activating OTP 26.2.5.3 instead:
And the output in terminal A is:
|
Well that curve should be supported, we call it by its other name secp256r1. Does your certificates use sha (sha1) as hash function in its signature? |
Thanks Ingela!
Thanks Ingela - right, the curve works, but just to be clear: it works as long as I use 26.2.5.3 (or 27.1) to talk to each other - it is only when a node running an older version (26.2.5 or older) trying to talk to one of the newer nodes that it doesn't work. Could it be as simple as it having different names in the different versions?
I think so :) all the commands to generate the certificates are in the reproduction repository, I guess the |
Sorry, no, that's not it :) Presumably the error message from the node (B in the example above) running 26.2.5:
comes from |
Well as you observed I do not think it is a name conflict. The name that you used is not used at all by our code. But you provide the parameters. Anyway it is not a SHA1 - problem either as sha256 is part of SHA2 and supported by default. I think there existed some bug related to ECDSA signature algorithms, I will try to check a little later today when that was fixed. |
This change made in OTP-26.2.5.1 might be relevant.
|
If you do not configure the signature algorithms to be used yourselves you can inspect defaults using for instances |
Btw, the problem appears to have been introduced between 26.2.5.1 and 26.2.5.2. Ping works between 26.2.5 and 26.2.5.1, but not between 26.2.5.1 and 26.2.5.2. |
The ssl:signature_algs(default, 'tlsv1.3') gives the same result on both 26.2.5.1 and 26.2.5.2.
and the ssl_dist.conf we use is very basic, just points to the certificates.
|
The only change between those releases to the ssl application is:
´´´' which should not have any effect on you ECDSA-certs. Do you run different versions of cryptolib ? Could you verify what is the signature algorithm of your cert? You can decode it using public_key functions. |
Nope, it is all built on the same machine with the same openssl. The replication repo that Sebastian provided makes it really easy to reproduce, btw. |
The replication repo creates the certifidcates using openssl, very basic usage. |
Well, I will try that but I may not have time to try until end of next week as I have a conference to prepare and attend. |
|
Another observation is the following:
If b tries to net:ping(a@...) then you get
at node a (running 26.2.5.1) and the following on node b (running 26.2.5.2)
However, if I then do the ping in the other direction, ie, node a pings node b, then it works, |
Hum ... it just hit me on the way home that I just recently made a patch for a refactoring bug (related to RSA legacy signature schemes) that occurred in OTP-26.2.1 and that fix also included the following diff to handle TLS-1.3 schemes names in TLS-1.2 code.
This might explain your problem. Well now I do not have more time for this. So hope it helps otherwise I will have to be stalled to later. |
Thanks! No, worries, I'll continue digging in the meantime. Tried the patch without success. |
I did some wireshark traces and noticed that on a protocol level the initial hello looks a bit different between 26.2.5.1 and 26.2.5.2. When 26.2.5.2 attempts to talk to 26.2.5.1 (which fails) it sends the handshake extension |
The problem apperas to be related to this change in ssl.erl:
If I revert this, it works. |
I found this text in the ssl dokumentation The client will send a signature_algorithms_cert extension (in the client hello message), if TLS version 1.2 (back-ported to TLS 1.2 in 24.1) or later is used, and the signature_algs_cert option is explicitly specified. By default, only the signature_algs extension is sent with the exception of when signature_algs option is not explicitly specified, in which case it will append the rsa_pkcs1_sha1 algorithm to the default value of signature_algs and use it as value for signature_algs_cert to allow certificates to have this signature but still disallow sha1 use in the TLS protocol, since 27.0.1 and 26.2.5.2. Which appears to reference this behaviour. I experimented by setting the signature_algs setting in the dist-ssl.conf like this:
Which appears to work as a workaround. |
@jbevemyr Yes, that should work perfectly as a workaround. The reason I suggested the patch above is that it is a place where the signature_algorithm_cert extension was handled incorrectly for TLS-1.2. If that should help the patch needs to be applied to the node running the server on the older OTP-release. I am sure the problem is not with the code you referred above but with the handling code of that extension. When the signature_algoritm_cert extension is not sent it will default to the value of signature_algs. |
Hej @IngelaAndin - we tried explicitly listing the |
Describe the bug
We are currently running distributed nodes using tls, and based on Erlang/OTP version 26.2.5 in production. When I tried to upgrade to 27.1 I ran into a problem where an old node couldn't talk to a new node (which is what we need to do as part of our upgrade). The connection fails with (on the node running 26.2.5):
and on the node running version 26.2.5.3 it fails with:
After some experimenting I realized that it happens because we are using ecdsa keys using the prime256v1 curve (everything works fine if I use rsa keys or e.g. ED25519) but ecdsa is what we are using in production...
To Reproduce
Start a distributed node using version 26.2.5, and another using 26.2.5.3 and try to setup a connection between them. I have created a repository otp-dist-test which contains exact steps how to reproduce in the README file all you need are two Erlang installations - everything else is provided in the reproduction repository.
Expected behavior
That the nodes can talk to each other :)
Affected versions
26.2.5.3 and 27.1
Additional context
Looking at the diff
git diff OTP-26.2.5 OTP-26.2.5.3 -- lib/ssl/src
it seems the filtering of digest algos has changed unfortunately I'm not quite able to figure out what would need to be done to be able to accept a connection with 26.2.5. (Actually I just realized that all three versions post 26.2.5: 26.2.5.1, 26.2.5.2, and 26.2.5.3 have changes in them - I haven't been able to pinpoint which of these versions introduced the incompatibility).The text was updated successfully, but these errors were encountered: