-
Notifications
You must be signed in to change notification settings - Fork 7
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
Add support for sha2 rsa keys in local signer #138
Conversation
e1518bf
to
8e79254
Compare
Code Climate has analyzed commit 8e79254 and detected 0 issues on this pull request. View more on Code Climate. |
Hello @tierpod, I found that certificates are already signed with SHA-2 algorithm by default (https://cs.opensource.google/go/x/crypto/+/bc19a97f:ssh/certs.go;l=443) and it's the marshaling of it that apply the wrong "identifier" to it. I added a MarshalCertificate function with the missing detection. Can you test if it resolves your issue #133 ? |
Hello @pablo-ruth ! Thank you for your investigation. I tested this branch and unfortunately it doesn't fix my problem. If I print certificate after
and I still cannot use this certificate against Centos 7 server without
Server OS is Centos 7.9, openssh version is SSH-2.0-OpenSSH_7.4 Client OS is Fedora 36, openssh version is OpenSSH_8.8p1, OpenSSL 3.0.5 5 Jul 2022. I expected to see:
to fix my problem, but here I found the comment:
Sorry, I'm confused about it, maybe my problem is not connected with original issue. |
Ok thanks for your test, and you're right it's confusing ^^ So to try to better understand the problem I reproduce it without signmykey, using only "official" openssh tools (ssh-keygen). I used a Centos 7 with openssh 7.4 as a server, and a Fedora 36 with openssh 8.8 as a client. I generate an RSA SSH Certificate Authority:
I generate a "client" key pair:
I sign the client public key with the certificate authority:
I setup the CA public key on my remote Centos 7 server and I test to connect to it:
So I reproduce your issue. And like you if I add The confusing thing is that I use "up-to-date" ssh-keygen to generate the certificate, but if dump the cert file, it's still in
I tried to generate the certificate with multiple options, So I'm not sure it's possible to generate a certificate in a "sha-2" format with OpenSSH tools, and so I don't know what it should look like. |
I appreciate your job. As I see, it may be a problem with openssh client:
or with openssh server, something about server-sig-algs extension: I can indirectly confirm this. The same ssh client, the same certificate, 3 different servers:
So, I think, there is nothing we can do about it. The best choice is to generate new ECDSA or ED25519 keys
As for ssh-keygen Type output, it looks like it's OK that it is the same for any rsa type. |
To summarize: Certificate type ssh-rsa-cert-v01@openssh.com is like a container. Real sign algorithm can be sha1 (deprecated), sha2-256, and sha2-512 (still valid). The same is for ssh keys: ssh-rsa is like a container. Real algorithm can be sha1 (deprecated), sha2-256, sha2-512 And considering this, we shouldn't show depreciation warning for ssh-rsa-cert-v01@openssh.com type. And my first issue has wrong title 😄 |
Good finds! It's definitely clearer now :) So the problem arises when we have a "buggy" openssh client/server combination, and it's not a problem with the ssh-rsa cert container, thereby I'll close this PR since it creates a cert file with a bad format. You're right we shouldn't show a deprecation warning about the container format, but as this problem seems to be more and more frequent, and hard to debug for the end user, I think that replacing it with a warning when signing an "rsa" key should be helpful. Displaying the warning when signmykey signed only "rsa" keys (saying that you should generate a ssh keypair with another algorithm) feels like a good compromise. I'll open a new PR for that. |
Fix #133