-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
SSH agent plugin does not add ssh keys consistently after each database unlock #2902
Comments
Just to be clear, this is a 2.4.0 regression from 2.3.x? Thanks. |
@hifi Yes, my old version was |
Using the 2.4.0 snap in Here's how I tested with my key that is set to automatically add on unlock and remove on lock:
I tried this loop for 5 iterations and it kept consistently adding and removing my key. Since I've been using 2.4.0 since release day like this I haven't noticed my key would have not been re-added on unlock. |
If i open manually my database, my keys are loaded. If i open automatically at session openning by a launcher (bash -c "/usr/bin/secret-tool lookup keepass KeePassBdd | /usr/bin/keepassxc --pw-stdin <database_path>") they aren't. They are if i lock/unlock the database. This config was ok in previous version. KeePassXC - Version 2.4.0 (from official PPA) Libraries:
Operating system: Ubuntu 18.10 Enabled extensions:
|
I have now reproduced both of the issues and split the --pw-stdin into #2912. Thank you for the reports, will fix these for 2.4.1. |
This wasn't the refactor itself but an attempted fix just after. |
So the issue lies here: keepassxc/src/sshagent/SSHAgent.cpp Lines 232 to 235 in d7660da
Ping @phoerious, just adding I don't have more time to dig into this right now but this definitely is a 2.4.1 target as it's an easy to fix regression. |
Also would like to note that |
@xenithorb |
The root cause of this issue is that the structure that stores which keys have been loaded is not cleared (right or wrong) after the database is locked. The reason for this is because the setting "remove keys on database lock" is not enabled. Coupled with the setting for the agent to remove the key after a timeout, you can be left with a deadlock scenario where the key is never re-added unless KeePassXC is restarted or you do it manually. There are two options to fix this:
|
* Keys that were previously added do not show an error message (they are most likely still in the agent) * Shifted to using the KeeAgentSettings class to guide behavior of addIdentity function * Fixes #2902
* Keys that were previously added do not show an error message (they are most likely still in the agent) * Shifted to using the KeeAgentSettings class to guide behavior of addIdentity function * Fixes #2902
Just to be clear the keys are added successfully after the initial db unlock after the app starts. but if the database gets locked automatically or manually, the subsequent database unlocks don't add the ssh keys.
Expected Behavior
Keepassxc should add the ssh private keys after each unlock, and if the keys already exist in the
ssh-agent
they still get re-added ( and the life time gets refreshed, that's the behavior I'm used to )Current Behavior
The keys are added to the agent in the initial unlock, but not after subsequent unlocks.
Steps to Reproduce
ssh-add -D
ssh-add -l
( keys should exist this time )ctrl+l
) or (tools > lock databases
)ssh-add -D
ssh-add -l
The keys should exist at this point but they don't
If you close the whole app and restart it and unlock the database, the keys will be added as expected.
Debug Info
KeePassXC - Version 2.4.0
Revision: c51752d
Libraries:
Operating system: Arch Linux
CPU architecture: x86_64
Kernel: linux 5.0.2-arch1-1-ARCH
Enabled extensions:
The text was updated successfully, but these errors were encountered: