kee-org / KeeFox

Legacy browser and XUL application integration with KeePass Password Safe. See https://github.com/kee-org/browser-addon for the new version for Firefox 57+
https://forum.kee.pm
418 stars 48 forks source link

KeePassRPC could not start listening for connections. #479

Closed axi92 closed 9 years ago

axi92 commented 9 years ago

keepassrcp

luckyrat commented 9 years ago

Do you have another copy of KeePass running on your computer?

If not, you will need to unblock the two ports as listed in the error message. They might be blocked due to SElinux/AppArmor or your other firewall / security software.

axi92 commented 9 years ago

I first installed one portable version on my usb drive. But I forgot my usb so i installed another local. Is that maybe the problem?

luckyrat commented 9 years ago

That might be the problem but only if they are both running at the same time. Check your task manager to ensure only one KeePass.exe instance ever runs at the same time.

axi92 commented 9 years ago

There is only one KeePass.exe

AndyHurz commented 9 years ago

same error. it occurs after installing Firefox 38.05...

luckyrat commented 9 years ago

@AndyHurz So if you roll back to v38 does the problem go away?

AndyHurz1 commented 9 years ago

@luckyrat: no change with prior versions (i.e. 37). Uninstalled Keepass and Keefox. reinstalled Keepass and Keefox again, no change. KeePassRPC.plgx will not automatically installed into Plugins-directory. manually copying KeePassRPC.plgx @axi92 error-screen appears. prior keefox asked for Firfox-authentification-key.

Keepass 2.29; KeeFox 1.4.8.1, Windows7/64

luckyrat commented 9 years ago

KeePassRPC.plgx will not automatically installed into Plugins-directory

This is strange. Do you get any error message when it tries to copy KeePassRPC.plgx automatically?

It sounds like something is forcing KeePass to run with limited privileges so it is not permitted to open network ports but I've never heard of that happening before so I can't suggest any specific programs to look for on your system.

If you can't find any specific programs or malware that is causing the problem, maybe try re-installing the .NET framework in case that has become corrupt.

AndyHurz1 commented 9 years ago

.NET framework reinstalled without success. Just recognized, error message is bit different, it complains about (missing) socket rights: keepass

by the way, i think it doesn't matter, firefox was always equipped with adblock plus and noscript addons.

http://jsfiddle.net/awDLc/125/ returns Keefox / Keepass WebSocket Test ERROR: undefined Could not connect to KeepassRPC (This is bad) DISCONNECTED

luckyrat commented 9 years ago

Yeah it's not related to Firefox or KeeFox; definitely a problem with the KeePass/KeePassRPC side of things so adblock+noscript wouldn't matter.

Maybe try checking your hosts* file? If something has removed localhost from there or done something else non-standard, it might be causing a problem.

* %SystemRoot%\System32\drivers\etc\hosts (requires an administrator privileged editor to save changes)

@axi92 This might all be useful information for you too but your problem is occurring earlier in the startup process so a fault with your .NET framework installation, Windows installation, or maybe some malware are all worth investigating too.

axi92 commented 9 years ago

The funny thing is the first instance of keefox was the portable one on my usb drive. The second was that local one that generates the error message... But i stopped investigating and uninstalled keefox at work, just using it at home.

luckyrat commented 9 years ago

@axi92 I take it that you had a portable KeePass installation on the USB stick too? And that is the one that worked OK?

It could have been due to a Windows/.NET customisation that was made to the work machine in order to prevent other applications like KeePass from having the normal level of privileges. Perhaps something that attempts to block unknown network connections to protect against data leaks (although if that is the case it's a bit broken/misconfigured since KeePassRPC never makes any external connections, only a local one to the same machine and hence shouldn't be affected by a well-behaving security system).

If you find out any more please let us know but I understand if you're not able to.

AndyHurz1 commented 9 years ago

@luckyrat what means 'something has removed localhost' ? nothing special in the hosts file, only a few entries like '127.0.0.1 zzz.com' ping to localhost is possible...

luckyrat commented 9 years ago

@AndyHurz1 I just mean that if the 127.0.0.1 localhost line has been removed by something like some strange security software or some malware.

I know some people have found that making sure that line is in their hosts file fixes KeePassRPC connectivity problems.

If your ping to localhost is already resolving to 127.0.0.1 then I don't understand why that line in the hosts file would be required but it wouldn't hurt to try.

I've just noticed that you have configured a custom port (19455). Do you get the same error message when you use the default? (12546)

Maybe thinking about when and why you changed the custom port might give you a clue about what could be causing KeePassRPC to be unable to have permissions to bind to the port.

Also try looking at the "Network" tab in Windows "Resource Monitor"; The "Listening Ports" section and "TCP Connections" section might give you a clue if something is already listening on the port (although normally this would result in a different error message, perhaps you've found a rare situation when this is not the case)

AndyHurz1 commented 9 years ago

hosts-file contains # localhost name resolution is handled within DNS itself. no change with 127.0.0.1 localhost entry. I don't know how to configure KeepassRPC-ports cause it isn't listed in Keepass plugins window anymore. Is it because of missing port permissions? indead in resource monitor/listening ports port 19455 is listed and in use by system and not allowed... ports

luckyrat commented 9 years ago

You can configure the port manually by editing your KeePass config file (this is the file that is changed when you normally change it through the plugin options window). Details can be found below the screenshots on this manual page but you essentially just change the value of the KeePassRPC.webSocket.port setting and then start KeePass.

19455 isn't in use by my system so I'm not sure why a system process has it in use on yours but a quick internet search brings up a number of results related to KeePassHTTP so it's possible that this port is used by that KeePass plugin by default. Try disabling the KeePassHTTP plugin for a test (or to get access to the usual KeePassRPC options window to change the port the to something else without resorting to the config file)?

That could explain why you're seeing an unusual error message - perhaps because KeePass is trying to start listening on the same port twice (from different plugins) we see this error message instead of the usual "port already in use" error.

AndyHurz1 commented 9 years ago

Thanks, that's it !! KeePassHTTP plugin is using port 19455 and KeePassRPC.webSocket.port in file KeePass.config.xml was also configured with 19455. Deleting this value did it :-)

Sorry, I probably tried to configure KeePassHTTP and accidentally changed KeePassRPC :-|

thanks again and KeeFox is a great addon...

luckyrat commented 9 years ago

No problem; I'm glad it's fixed. I'll include a check in the next KeeFox version so it is no longer possible to accidentally configure KeePassRPC to listen on the KeePassHTTP default port of 19455.