-
Notifications
You must be signed in to change notification settings - Fork 70
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
Unable to connect via secure tunnel when using authorized_keys and keyfile instead of password auth #455
Comments
I've tried the
Relevant releases of openssl/h on these branches: Do you have any specific configurations you've successfully used for private key authentication? I could try to reproduce. Other notes/observations:
|
Hello @dwalkes , thank you for sharing all of these details with us. You said you were able to connect to the device using the id/password but it is failing to connect over private key, can you tell us how did you create the private key? I am not sure if the private key you have generated is not working or it is an OpenSSH / OpenSSL issue. |
Hi @HarshGandhi-AWS thanks for the response.
Yes see the detail in the first post:
Regarding
The key works for local access Can you answer this question?
If you have a known working config and a specific verison of openssh/openssl tested I could try to reproduce with that version. |
For testing purpose I use an ubuntu EC2 instance. The key generated by ec2 service is the private key I am using to connect to the destination device. I tested device client again following these steps:
I was able to connect to the device successfully and did not face any issue. I suspect either the issue in on:
To narrow down the issue, can you run device client on your destination device enabling secure tunneling feature and try to connect to it using the private key? Would recommend running device client on a more powerful device than Raspberry pi to save time building client software locally. For testing locally, you can also run device client using our latest docker image hosted by us on this ECR repository. https://gallery.ecr.aws/aws-iot-device-client/aws-iot-device-client |
@HarshGandhi-AWS thank again for the response.
Which OS? Which version of openssl/openssh is used? (try
Sorry but I think that's exactly what I've done, or I don't understand what you are asking me to do differently than what I've already done.
I have a cross toolchain for this through yocto so this isn't an issue. |
OS: Ubuntu 22.04.4 LTS Please be patient with us until we try to produce this issue locally and find its root cause. So far I am able to connect to destination device using the private key generated by the EC2 instance. I will try to create a new private key following the steps mentioned above in the issue detail and see if I can connect to the destination device using it or not. Meanwhile, I would suggest using id/password for connecting to the device since it is working fine for you. |
@HarshGandhi-AWS thanks for the response. I'll try to reproduce a successful connection to an AWS image using the same setup and compare logs. It looks like this configuration is very similar to the
OK thanks.
Yes I'm doing this, however it's not a suitable solution for production deployment.
You should also be able to reproduce if you build an image using https://github.com/Trellis-Logic/meta-aws-iot-demo/?tab=readme-ov-file#host-dependencies for RPI 3 or 4. |
Hello @dwalkes , we were able to reproduce this issue locally. We suspect the issue is not the the device client itself but is on the web based secure tunneling which you were using to connect to the tunnel as a source. We are currently working with the console team to resolve this issue. Meanwhile if you want to connect to the device using private key you can use Local Proxy on your source device to connect to the tunnel. Team already tested it and it works fine when trying to connect as source using a device private key. |
Hi, same error trying to use pub/priv on a ubuntu desktop installed on a Jetson |
Any updates on the status of this one?
I'm unable to use the local proxy either, using password access or private key. Can you share more detail about exactly how you are connecting? I'm setting the key with
Then I'm starting the localproxy in source mode with Then attempting to connect with I get messages like this and the SSH command hangs without opening a terminal session.
|
@HarshGandhi-AWS may I have an update on this please? It's blocking production deployment for us. Thanks! |
Hello @dwalkes team is still working on this issue. Can you tell us why is this issue blocking your device deployment? The issue is on the cloud console and you can still use local proxy in source mode to connect to the device using the secure tunnel. That should be a good alternative for now. Can you use it to unblock yourself until our team works on fixing this console issue? |
I wasn't able to get this to work either, as described at #455 (comment) - if you have further details about how you were able to make this work please share. |
@dwalkes in your localproxy run command, try adding the arg ref: https://github.com/aws-samples/aws-iot-securetunneling-localproxy/releases/tag/v3.1.2 |
@RogerZhongAWS thanks that helps, I can confirm I'm able to use this command to start the proxy:
and then from the same host, I can use this command to reach the remote client
So this is in fact a workaround for me until the web console is fixed. |
Hello @dwalkes, I believe this issue is now resolved and you can use IoT Console with certificates to connect to your device over secure tunnel. Can you please verify and let us know is this issue can be closed now? |
@HarshGandhi-AWS same error unfortunately, traces look the same as initially shared in #455 (comment) with error message
I'm curious if you could share the debug3 messages from sshd on a working case for comparision. I'm setting Result in the faillure case looks like this:
Result in success case (ssh from the same network with the same key)
Note the difference in the failure case, same as before:
If you have the details about the ticket which was fixed in the web console I'd like to review the fix to try to understand what would have caused the libcrypto error previously and how this was resolved. |
@dwalkes Thank you for letting us know. I will escalate the issue to resolve this as soon as possible. Sorry for the inconvenience. |
Hello @dwalkes , upon speaking with console team we found that only PEM formatted (256 & 512) RSA keys are working with IoT Secure Tunneling console. Can you create the key in PEM format and retry?
|
Hi @HarshGandhi-AWS thanks I can confirm this fixes the issue. I can also continue to use my existing key after converting to pem with
|
Hi, indeed RSA PEM is working, but shall we update documentation to reflect current state? Currently it says:
While I believe |
Sure. We will work on updating the documentation. Thank you for confirming the fix is working for you. |
Acknowledged, will add it in the next update. Thanks. |
Describe the bug
I've got a repo at https://github.com/Trellis-Logic/meta-aws-iot-demo which leverages the meta-aws layer for demonstrating secure tunneling and jobs features with AWS IoT on Yocto Poky distribution (currently using the kirkstone branch).
Everything works great with SSH connection through the procedure described at https://github.com/Trellis-Logic/meta-aws-iot-demo/wiki/Creating-a-Secure-Tunnel as long as I use username/password authentication.
When I attempt to switch to private key authentication and
authorized_keys
I am unable to connect to the device through the secure tunnel. I'm able to connect with the same private key over the local network without issue.To Reproduce
ssh-keygen
and no password. I've tried-t rsa-sha2-512
,-t rsa-sha2-256
or-t ed25519
./home/root/.ssh/authorized_keys
ssh -i <private key> root@ip
can connect successfully.Expected behavior
I'm able to login with either password or private key authentication.
Actual behavior
The attempt to login with private key authentication fails with message "Failed to authenticate. Try again"
Logs
With verbose logging enabled in sshd (DEBUG3), I see this when I successfully login with the ssh key (over local network)
And I see this on the failure case when using AWS Secure Tunnel with the same private key
Difference appears to be:
Environment (please complete the following information):
Thanks for reviewing!
The text was updated successfully, but these errors were encountered: