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

error in libcrypto if loaded key is replaced #56

Open
dcousens opened this issue Jul 12, 2024 · 5 comments
Open

error in libcrypto if loaded key is replaced #56

dcousens opened this issue Jul 12, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@dcousens
Copy link
Contributor

dcousens commented Jul 12, 2024

When testing, I used ssh-tpm-keygen to replace an existing test.tpm that had already been loaded by my running ssh-tpm-agent:

$ ssh-tpm-agent -d
time=2024-07-13T00:54:01.989+10:00 level=INFO msg="Warning: ssh-tpm-agent is meant to run as a background daemon."
time=2024-07-13T00:54:01.989+10:00 level=INFO msg="Running multiple instances is likely to lead to conflicts."
time=2024-07-13T00:54:01.989+10:00 level=INFO msg="Consider using a systemd service."
time=2024-07-13T00:54:01.989+10:00 level=INFO msg="Listening on socket" path=/run/user/1000/ssh-tpm-agent.sock
time=2024-07-13T00:54:01.989+10:00 level=DEBUG msg="called loadkeys"
time=2024-07-13T00:54:01.989+10:00 level=DEBUG msg="skipping key: does not have .tpm suffix" name=/home/daniel/.ssh/config
...
time=2024-07-13T00:54:01.990+10:00 level=DEBUG msg="added TPM key" name=/home/daniel/.ssh/test.tpm
...

Then, without restarting ssh-tpm-agent and with ssh-tpm-keygen having replaced test.tpm, by then running ssh ... the following error is shown:

Load key "/home/daniel/.ssh/test.pub": error in libcrypto

The followup output for this interaction from ssh-tpm-agent -d is relatively minimal, with no indicative error:

time=2024-07-13T01:01:51.682+10:00 level=DEBUG msg="called extensions"
time=2024-07-13T01:01:51.682+10:00 level=DEBUG msg="called list"

Restarting ssh-tpm-agent resolves the problem.

@dcousens dcousens changed the title error in libcrypto if key is replaced error in libcrypto if loaded key is replaced Jul 12, 2024
@Foxboron Foxboron added the bug Something isn't working label Jul 12, 2024
@Foxboron
Copy link
Owner

Yep, this sounds like a bug :) Thanks!

@Foxboron
Copy link
Owner

I suspect this fixes you issue, but I haven't tested yet.

800e6c9

@dcousens
Copy link
Contributor Author

dcousens commented Jul 14, 2024

Doesn't appear to be resolved

# ssh-tpm-keygen -f test
#   and added test.pub to authorized keys

$ git rev-parse HEAD
54a466a8eec3b48b374e05908dfa11b112392c30

$ ./bin/ssh-tpm-agent -d
time=2024-07-14T10:16:44.485+10:00 level=INFO msg="Warning: ssh-tpm-agent is meant to run as a background daemon."
time=2024-07-14T10:16:44.485+10:00 level=INFO msg="Running multiple instances is likely to lead to conflicts."
time=2024-07-14T10:16:44.485+10:00 level=INFO msg="Consider using a systemd service."
time=2024-07-14T10:16:44.486+10:00 level=INFO msg="Listening on socket" path=/run/user/1000/ssh-tpm-agent.sock
time=2024-07-14T10:16:44.486+10:00 level=DEBUG msg="called loadkeys"
time=2024-07-14T10:16:44.486+10:00 level=DEBUG msg="skipping key: does not have .tpm suffix" name=/home/daniel/.ssh/config
# ...
time=2024-07-14T10:16:44.486+10:00 level=DEBUG msg="added TPM key" name=/home/daniel/.ssh/test.tpm
# ...

# ssh OK
time=2024-07-14T10:16:54.783+10:00 level=DEBUG msg="called extensions"
time=2024-07-14T10:16:54.784+10:00 level=DEBUG msg="called list"
time=2024-07-14T10:16:55.091+10:00 level=DEBUG msg="called signwithflags"

# ssh-tpm-keygen -f test
#   and added test.pub to authorized keys

# ssh ERROR
#   Load key "/home/daniel/.ssh/test.pub": error in libcrypto
time=2024-07-14T10:17:37.177+10:00 level=DEBUG msg="called extensions"
time=2024-07-14T10:17:37.177+10:00 level=DEBUG msg="called list"

Ps. thank you for fixing f8a5360 💛

@Foxboron
Copy link
Owner

Can't reproduce with the details you have given so far.

@dcousens
Copy link
Contributor Author

Interesting! I'll try and automate a reproduction when I can

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants