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

Remove all keepass ssh keys without locking db #8346

Open
darrellenns opened this issue Aug 9, 2022 · 5 comments · May be fixed by #10649
Open

Remove all keepass ssh keys without locking db #8346

darrellenns opened this issue Aug 9, 2022 · 5 comments · May be fixed by #10649

Comments

@darrellenns
Copy link

Summary

A menu item/keyboard shortcut to remove all keepass keys from the ssh agent.

Context

When working with many different ssh keys in keepass, often I need to remove the all keys I was using from the agent (for example, when finished working with a group of servers). Currently the options for doing this are:

  • Lock the DB, then unlock it again
  • Find each relevant entry in the DB, and use the right click menu or keyboard shortcut to remove the key
  • Remove the keys using the agent (ssh-add, pageant, etc)

None of these options are very convenient. Ideally, there should be a menu item/keyboard shortcut that removes keys in the same manner as a DB lock, but without having to lock the DB. Like a DB lock, this should only affect the keepass entries and not any other (non-keepass) keys currently held by the agent.

@AlexpFr
Copy link
Contributor

AlexpFr commented Apr 27, 2024

I have implemented a function that replicates the behavior of the ssh-add -D command.

A button has been added directly in the entry and a second one is placed in the Tools menu.

I see at least three use cases:

  • Clearing the agent before adding a new key, this prevents ssh from testing unused keys.
  • Ensuring that the agent no longer contains any keys before using agent forwarding.
  • Clearing the agent before leaving the workstation without having to open a terminal.

I chose to indiscriminately delete all keys, @darrellenns suggested deleting only the keys that Keepassxc manages.

Switching between these two approaches is rather simple, just by changing the slot in a single connect function.
It is possible to let the user choose the approach. I was thinking of eventually adding a checkBox in the agent configuration page to toggle between the two modes.

Screenshot:

Flush SSH Agent identities screenshot

@droidmonkey
Copy link
Member

droidmonkey commented Apr 28, 2024

Neat! Flush is kind of a weird word, though. Maybe stick with "Clear Agent".

AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue Apr 28, 2024
@AlexpFr
Copy link
Contributor

AlexpFr commented Apr 28, 2024

My initial intention with flush was to emphasize that key deletion was done indiscriminately in the agent.
Similar to flushing a DNS cache, starting fresh.

But indeed, using the term clear is more elegant.
I can modify all instances of flush to clear.

What else needs to be done before proposing a PR?

@droidmonkey
Copy link
Member

Looks good otherwise, just make sure the Tools menu item is hidden if ssh agent is disabled.

AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue Apr 28, 2024
@AlexpFr
Copy link
Contributor

AlexpFr commented Apr 28, 2024

I made two commits on my repo:

  • The first one fixes the button visibility issue.
  • The second one replaces occurrences of the word flush with clear.

AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue Apr 28, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue Apr 28, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue Apr 29, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue Apr 29, 2024
@AlexpFr AlexpFr linked a pull request May 1, 2024 that will close this issue
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 1, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 5, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 5, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 5, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 5, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 5, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 5, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 5, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 7, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 7, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 7, 2024
AlexpFr added a commit to AlexpFr/keepassxc that referenced this issue May 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants