tpm2-pkcs11 icon indicating copy to clipboard operation
tpm2-pkcs11 copied to clipboard

Multiple keys / Specific key selection for SSH

Open rally-dimi opened this issue 8 months ago • 1 comments

Is there a way to choose key using label or pid tp present to SSH service ? For example when connecting to gihub, when there are 2 keys, first key would be used and push would fail - if second one have permissions.

Host github-work
  HostName github.com
  User git
  PKCS11Provider /usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1
  ForwardAgent yes
  PasswordAuthentication no
  IdentitiesOnly yes

  
Host github-home
  HostName github.com
  User git
  PKCS11Provider /usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1
  PasswordAuthentication no
  IdentitiesOnly yes

rally-dimi avatar Nov 09 '23 09:11 rally-dimi

Some debug logs:

GIT_SSH_COMMAND="ssh -vvv" git clone [email protected]:<project>.git
...
debug1: Will attempt key: /usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1.6.0 RSA SHA256:<key1> agent
debug1: Will attempt key: /usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1.6.0 RSA SHA256:<key2> agent
...
debug1: Server accepts key: /usr/lib/x86_64-linux-gnu/libtpm2_pkcs11.so.1.6.0 RSA SHA256:<key1> agent
...
authenticated

rally-dimi avatar Nov 10 '23 08:11 rally-dimi