dlech / KeeAgent

ssh agent plugin for KeePass 2.x
http://lechnology.com/software/keeagent
Other
522 stars 35 forks source link

Auto load keys in Key Agent does not working #322

Closed asmcc closed 2 years ago

asmcc commented 2 years ago

Since a few months my Key Agent can not auto load my intergrated putty ppk-keys. I tested it at different computer and played with all possible options, but the auto load does not work! No error messages, no warnings in the user interface. Do you have debug functionality in Key Agent to debug this issue in more details? How I can activate this debug functionality or how I can view a log? Thanks!

dlech commented 2 years ago

If these are newly generated keys, then this is probably a duplicate of #316

asmcc commented 2 years ago

No, both key files (and I use only these two keys in KeePass) are "PuTTY-User-Key-File-2":

  1. ssh-ed25519
  2. ssh-rsa (standard putty setting)

This configuration worked so until march or april of 2021 without problems. After an update of KeePass it does not worked anymore. I have not changed the keys!

I can tested it, if you want. But you should say me, what can I do. For example: I can remove these keys from KeePass-database. I can generate new Putty keys. I can also generate a completly new KeePass-database and test it so. But I need a plan to test this issue.

I use also WinSCP an Putty. May be, that I updated both of these programs and may be, that putty own (new) Key Agent make problems. But I do not know, how I can test it.

neradp commented 2 years ago

I have the same problem :(

ezekielnewren commented 2 years ago

I think I might have run into this issue too, but with filezilla. I told it to use "interactive" authentication, and it worked initially, but not anymore. However I can still connect using putty just fine.

dlech commented 2 years ago

Can you provide a test .kdbx file that reproduces the issue?

asmcc commented 2 years ago

Today I tested the ppkv3 beta with my database ==> The same behaviour: keys were not loaded automatically. Therefore I think, that my issue has definitively another roots, as ppkv3 issue. I played today also with other options. The background for these experiments was, that I saw in an android application at my tablet definitevely more keys as only these 2, described above. For precise investigation I exported first my very big database in XML format. In this format you can investigate you whole database as clear text using a simple editor. And yes, I found more items in this XML file, as only 2 expected. The explanation for these items is the "history" of keepass. In the second step I deleted separatelly the whole history in my database but only for the items with ".ppk" and have now really only two items with ".ppk" includation. But this step with deleting of history is very tricky, if you have an active synchronisation of your database. You should deactivate the synchronisation first and push your local copy to the server separatelly, if you will delete the history. Otherwise it will be overwritten during next synchronistaion. See the discussion about this behavour here: https://sourceforge.net/p/keepass/discussion/329220/thread/a42accc383/

But unfortunatelly, also after this delete action and after using of the ppkv3 beta my keys were not loaded automatically.

And your idea with a test .kdbx file is very good! At the next opporunity I will play with a completelly new database, which include only 2-3 items with old and newer ppk files and will report here about these tests.

Can you recommend please some debugging options additionally to my "XML method"?

asmcc commented 2 years ago

After experiments with a fully new database under another windows account I hope, that I found the really cause for my issue: "KeePassAutoUnlock" plugin! My experiments:

  1. A fully new keepass database under another windows user was created.
  2. A older ppk file (created at 2016, definitivelly v2) added to the database and "activated" and "linked" in KeyAgent
  3. Database closed. Database opened again. Password tipped from keyboard ==> .ppk key is autoloaded in the KeyAgent
  4. Plugin "KeePassAutoUnlock" activated, password stored in the plugin. Database closed
  5. Database opened with active "KeePassAutoUnlock" (without input the password, since it is stored inside "KeePassAutoUnlock" plugin) ==> .ppk key is not loaded automatically within KeyAgent. But manually load using "ctrl-m" is at all times possible.

My assumption: I assume, that both plugins have an issue during start-up process of keepass. "KeyAgent" plugin miss the moment, when the database is automatically unlocked by "KeePassAutoUnlock" plugin and does not load the keys automatically. My question: Is it possible to change the start order of both plugins (like linux init.d with its S20_xxx S40_xxx) for further experiment purposes?

asmcc commented 2 years ago

Solution: YES! For my issue It was the start order for both plugins "KeeAgent" and "KeePassAutoUnlock", since default "KeeAgent" is alphabetically BEFORE "KeePassAutoUnlock" I renamed both plugin folder in "00_KeePassAutoUnlock" and "99_KeeAgent", so that "KeeAgent" plugin will be loaded now AFTER "KeePassAutoUnlock" plugin ==> Automatic load of keys at startup works now!

dlech commented 2 years ago

I think if the KeePassAutoUnlock plugin would use MainForm.OpenDatabase instead of Database.Open, it would fix the problem.

Since the problem is with a different extension and there is a workaround, I'm going to go ahead and close the issue.