Skip to content
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

Support RSA SHA-2 (RFC8332) signatures #165

Closed
SURA907 opened this issue Nov 16, 2021 · 8 comments
Closed

Support RSA SHA-2 (RFC8332) signatures #165

SURA907 opened this issue Nov 16, 2021 · 8 comments
Labels

Comments

@SURA907
Copy link

SURA907 commented Nov 16, 2021

Cf golang/go#37278

Crypto already supports RSA SHA-2 (RFC8332) signatures

Only need to upgrade mod to support RSA SHA-2 (RFC8332) signatures

Thanks

SURA907 added a commit to SURA907/ssh that referenced this issue Nov 16, 2021
@SURA907
Copy link
Author

SURA907 commented Feb 10, 2022

It looks like x/crypto/ssh is not ready

@mikesmitty
Copy link

mikesmitty commented Apr 28, 2022

Looks like x/crypto/ssh added support recently. Could this be added now?
golang/crypto@5d542ad

@belak
Copy link
Collaborator

belak commented Apr 28, 2022

Is it really just updating the mod that's needed? That should be an easy fix.

@quackduck
Copy link

We do not have server support yet, so we're still waiting for that change to happen in x/crypto

Client support is already here and simply requires a go get -u golang.org/x/crypto

@quackduck
Copy link

Switching from x/crypto to rmohr/crypto would add both client and server support and fix this issue. The problem I see is that we would then be using a fork not officially maintained by the Go project and would be a bit out of date.

@gustavosbarreto
Copy link
Collaborator

Until gliderlabs/ssh package updates its direct dependency on crypto/ssh you have to update its on your go.mod project file by running go get -u golang.org/x/crypto in the project root dir.

@belak
Copy link
Collaborator

belak commented Aug 31, 2022

I think this should be fixed now - golang.org/x/crypto was updated and a new version (v0.3.5) has been tagged.

@belak belak closed this as completed Aug 31, 2022
@erwin
Copy link

erwin commented Oct 11, 2022

Perhaps I'm doing something wrong, but I've still been unable to connect when using an RSA key (rsa-sha2-256, rsa-sha2-512) unless I turn on the deprecated -oPubkeyAcceptedKeyTypes=+ssh-rsa flag...

Step 1: Build the ssh-publickey example, with latest versions of gliderlabs/ssh and x/crypto

cd /tmp/test
git clone https://github.com/gliderlabs/ssh/
cd ssh/_examples/ssh-publickey
go mod init github.demo/_examples/ssh-publickey
go get github.com/gliderlabs/ssh@latest
go get golang.org/x/crypto@latest
go build .
./ssh-publickey

Step 2: Then test connecting with an RSA key:

cd /tmp/test
ssh-keygen -q -t rsa -N "" -f test-key-rsa
ssh -F /dev/null -oStrictHostKeychecking=no -oUserKnownHostsFile=/dev/null \
-oPubkeyAcceptedKeyTypes=-ssh-rsa -i ./test-key-rsa localhost -p 2222

### output: "user@localhost: Permission denied (publickey)."

Step 3: Rebuild ssh-publickey with rmohr/crypto fork of x/crypto

cd /tmp/test/ssh/_examples/ssh-publickey
# edit go.mod

Add this line to go.mod, after

replace golang.org/x/crypto => github.com/rmohr/crypto v0.0.0-20211203105847-e4ed9664ac54

Download the replacement package with:

go get
go build .
./ssh-publickey

Final Step: Repeat test ssh connection

cd /tmp/test
ssh -F /dev/null -oStrictHostKeychecking=no -oUserKnownHostsFile=/dev/null \ 
-oPubkeyAcceptedKeyTypes=-ssh-rsa -i ./test-key-rsa localhost -p 2222

Should work and the SSH key should be echoed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants