-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
gpg-agent does not support SSH certificates, tsh should be aware of this #3169
Comments
In a recent discussion with a customer:
|
Interestingly, on the YubiKey side, at least 1 other user claims there is a way to make this work: drduh/YubiKey-Guide#43 |
This came up again with |
Had another conversation with a customer interested in this, who has some engineers using gpg-agent/yubikey. |
+1 |
Also ran into this. currently working around it with |
Fix is in review. FWIW, it appears that OpenSSH 8.2+ supports security keys now: https://buttondown.email/cryptography-dispatches/archive/cryptography-dispatches-openssh-82-just-works/. |
In particular, gpg-agent doesn't support SSH certificates, so writing to it is potentially disruptive for the user: https://dev.gnupg.org/T1756 User has two options: - pass `--no-use-local-ssh-agent` for individual calls to tsh - set `TELEPORT_USE_LOCAL_SSH_AGENT=false` to make it permanent Fixes #3169
In particular, gpg-agent doesn't support SSH certificates, so writing to it is potentially disruptive for the user: https://dev.gnupg.org/T1756 User has two options: - pass `--no-use-local-ssh-agent` for individual calls to tsh - set `TELEPORT_USE_LOCAL_SSH_AGENT=false` to make it permanent Fixes #3169
Is there anyway to disable And for those wondering how to resolve the error by removing the offending keys; they can be manually removed from within the |
There's not currently a way to stop SSH certs from being generated completely, but you can prevent |
Even using |
it appears that you can actually |
@Chili-Man What happens if you run |
@webvictim thanks, that works! I've updated my comment above to reflect that. |
@awly please look into the issue when working on U2F support for tsh. In addition to that we have requests for people who don't want the keys to be written to disk and stored only in memory in agent. I think we have to build a matrix of all possible combinations we are going to support and provide some UX that integrates well with U2f support you are adding. |
+1. Just shot myself in the foot with this, too. |
The only reason I was using gpg-agent was to use a yubikey GPG based auth for SSH. You can instead use PIV with Yubikey to achieve similar functionality, then use the regular SSH Agent instead of gpg-agent. See here for details on how to set this up: https://developers.yubico.com/PIV/Guides/SSH_with_PIV_and_PKCS11.html Using this method then lets teleport and yubikey coexist properly with a regular SSH Agent. |
@thardie unfortunately, it appears that PIV only works if your gpg key was an RSA 2048-bit key 😞 Seems to be an underlying issue with the specification for PIV |
Related to #5487 |
Sorry to comment on a closed issue, but this is happening again with Teleport Connect. However, this only happens when carrying out SSH operations outside of Teleport Connect. Teleport Conect itself works fine, as does e.g. We'r using yubikeys that use debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: get_agent_identities: ssh_fetch_identitylist: Invalid key length
debug1: Will attempt key: /Users/username/.ssh/id_rsa
debug1: Will attempt key: /Users/username/.ssh/id_ecdsa
debug1: Will attempt key: /Users/username/.ssh/id_ecdsa_sk
debug1: Will attempt key: /Users/username/.ssh/id_ed25519
debug1: Will attempt key: /Users/username/.ssh/id_ed25519_sk
debug1: Will attempt key: /Users/username/.ssh/id_xmss
debug1: Will attempt key: /Users/username/.ssh/id_dsa
debug1: Trying private key: /Users/username/.ssh/id_rsa
debug1: Trying private key: /Users/username/.ssh/id_ecdsa
debug1: Trying private key: /Users/username/.ssh/id_ecdsa_sk
debug1: Trying private key: /Users/username/.ssh/id_ed25519
debug1: Trying private key: /Users/username/.ssh/id_ed25519_sk
debug1: Trying private key: /Users/username/.ssh/id_xmss
debug1: Trying private key: /Users/username/.ssh/id_dsa
debug1: No more authentication methods to try.
git@domain.tld: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists. I don't know whether this has to do with the key length of the server, but openssh refuses to work with keys of length <1024: https://www.openssh.com/txt/release-7.6 The keys added by teleport connect to
Version numbersOS: |
@santiago-mooser Thanks for a comprehensive report. Could you check if connecting to a node through We think it's because Teleport Connect adds that flag to all SSH connections made from Connect. We're thinking of making it a configurable option in v16.4.x and v15.4.x and then turning it into an opt-in rather than an opt-out setting in v17. |
We don't currently have any SSH servers set up (only web applications, EKS and DBs), but we're adding the servers this month so I'll let you know as soon as onboard them to teleport It would be great if we could toggle it from the UI! This would fix the issue for all of our devs. |
Thanks for clarifying, it seems that I've made a mistake. Both you and another user on Zendesk who made a similar report did not really need to SSH into a node to trigger this problem. So I'm not sure how much this is related to SSH agent forwarding. Though there is yet another issue, #11662, which I think describes the same problem that you're having where accessing a node with agent forwarding is one of the repro steps. Alas, I suspect it might be due to tsh (and thus Connect) incorrectly guessing that your agent supports SSH certs, basically replicating the original problem described in this issue. When you run into the problem with |
Yes, it seems like tsh is guessing that the agent supports SSH certs. I think there's also a restriction on MacOS specifically about the key length (it only supports >=2048 bit keys nad I think the SSH certs added by teleport are 1028 bits?). I also asked the developer what his I've since asked the developer to add Any chance there's any updates on adding the |
Thanks, please do let us know if this had any effect, it should help with fixing the issue here.
I just pushed a PR that adds That being said, I still don't understand how exactly tsh manages to break gpg-agent. If Our logic of looking at |
Thank you so much! This fixed the issue for our devs |
What happened:
gpg-agent
to hold keys/certificatesgpg-agent
does not support SSH certificates (https://dev.gnupg.org/T1756)gpg-agent
is running and you log into a Teleport cluster,tsh
adds stuff to the agent that it doesn't understandWhat you expected to happen:
1)
tsh
should have a command-line flag which disables any attempt to write to a running agent2) Ideally,
tsh
would be able to detect whengpg-agent
is running rather thanssh-agent
and deliberately avoid writing its keys there.This would enable much smoother Teleport operations for Yubikey users.
tsh
still writes its certificates to~/.tsh/keys/<cluster>
, which means that people can use these for their Teleport operations instead.How to reproduce it (as minimally and precisely as possible): Run
gpg-agent
, log into a Teleport cluster usingtsh
then observe that what's in the agent is not a valid certificate (error fetching identities: Invalid key length
)Environment:
teleport version
):Teleport Enterprise v4.1.4git:v4.1.4-0-gc487a75c go1.13.2
tsh version
):Teleport v4.1.4 git:v4.1.4-0-gc487a75c go1.13.2
Fedora 30
The text was updated successfully, but these errors were encountered: