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

[Feature request] Conditional loading of SSH keys #390

Open
schklom opened this issue Jun 16, 2023 · 5 comments
Open

[Feature request] Conditional loading of SSH keys #390

schklom opened this issue Jun 16, 2023 · 5 comments

Comments

@schklom
Copy link

schklom commented Jun 16, 2023

I manage SSH keys per client. So my laptop uses one SSH key for all purposes, same for my stationary computers.
When I am on my laptop, I want my laptop's SSH key to load. Same when I am on other computers.

I have not found a way to do that on KeeAgent. One machine uses Windows, the other uses Linux, so I can't put the same path for both.

KeePass implemented this condition to allow opening child databases depending on the hostname: https://sourceforge.net/p/keepass/discussion/329220/thread/509d35a111

@dlech
Copy link
Owner

dlech commented Jun 16, 2023

KeePass implemented this condition to allow opening child databases depending on the hostname

It sounds like this feature could solve your issue.

Another solution could be to use environment variables in the path of an external key file.

@schklom
Copy link
Author

schklom commented Jun 16, 2023

It sounds like this feature could solve your issue.

Exactly, but this is only for the plugin KeeAutoExec, hence this feature request :)

Another solution could be to use environment variables in the path of an external key file.

I guess this will do in the meantime.

@dlech
Copy link
Owner

dlech commented Jun 16, 2023

Exactly, but this is only for the plugin KeeAutoExec, hence this feature request :)

It seems like you can use both extensions together to do what you want. If you use the KeeAutoExec extension to load a per-host database, you can store the SSH keys in that database to get per-host keys.

@schklom
Copy link
Author

schklom commented Jun 16, 2023

Not ideal, but it should work. Thanks for the good idea!
I think I should keep the issue open because it was not really solved, but feel free to close it if you prefer :)

@spali
Copy link

spali commented Nov 12, 2024

Would have an additional use-case for this feature.
My problem is most of the time, I have a too many auth error due to many key get tried.
I use keeagent in multiple occasion with different devices. Most, if not all keys can are occasion specific.
But to use it with multiple devices I can't use the approach with KeeAutoExec and environment variables like hostname, as I don't have a environment variable that is reliable enough to have a unique value per occasion but on all devices.
I thought on the openssh constraint feature, but I have keys that are used to connect to hundred of virtual machines. So cant list them all... the only thing that would work would be username only... but thats not supported as openssh wants a host and I can't list all hosts as the names and keys are always changing.

Currently I have to load the keys manually on occasion when I start to work. A predefined set to load would help a lot or better a predefined set (or keys) based on hostname. This way I only need to maintain a list of hosts per occasion (keyset).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants