Gracefully handle corrupted private keys#61126
Conversation
|
Do we also plan to address the cause of the corruption? |
Not in this change. My understanding is that #59549 only requests handling the key once corrupted, as we don't have a way to properly reproduce the corruption. |
|
Nic suspects the corruption comes from here: Lines 339 to 352 in 8489b48 |
|
I agree that the corruption likely happens there, due to |
This change allows tsh to treat corrupted private keys as though they were not present (and trigger relogin flows) It also attempts to prevent said corruption in the first place.
f57219f to
b664a9e
Compare
This change allows tsh to treat corrupted private keys as though they were not present (and trigger relogin flows) It also attempts to prevent said corruption in the first place.
This change allows tsh to treat corrupted private keys as though they were not present (and trigger relogin flows) It also attempts to prevent said corruption in the first place.
|
This change updates tsh to gracefully handle corrupted private key files. Previously, if the key was corrupted, every tsh command would fail (including logout), and the only way to fix it would be to manually remove
~/.tsh. Now, if the key is corruptedtsh logoutwill successfully log out, and any command that callsRetryWithReloginwill also work properly.Part of #59549.
Changelog: Fixed corrupted private keys breaking tsh
Test Plan
Assume each test case starts logged in with a manually corrupted key (this can be done by running
echo "some data" > ~/.tsh/keys/<proxy-addr>/<teleport-user>.tsh statusreports that the session is no longer valid.tsh logoutsuccessfully logs out the user.tsh ls) successfully logs in when the key is corrupted.