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

Timeout or not connected to KeePassXC ( firefox 59 & OpenBSD) #102

Closed
zmyrgel opened this issue Apr 1, 2018 · 48 comments
Closed

Timeout or not connected to KeePassXC ( firefox 59 & OpenBSD) #102

zmyrgel opened this issue Apr 1, 2018 · 48 comments

Comments

@zmyrgel
Copy link

zmyrgel commented Apr 1, 2018

Keepassxc-browser does not connect at all with Firefox.

Expected Behavior

The plugin shows "Timeout or not connected to KeePassXC" and doesn't change when I hit "reload" button. I'd expect it to connect to the keepassxc database.

Current Behavior

Doesn't connect at all

Possible Solution

Not known, tested the same steps on chromium and it worked just fine.

Steps to Reproduce (for bugs)

  1. Enable new native browser extension in keepassxc and allow firefox to connect
  2. Install keepassxc-browser extension to firefox
  3. Try to connect the extension with the database

Debug info

Error: Promised response from onMessage listener at @moz-extension://202a47ac-4270-4cdc-b3cb-88c3d4333ee8/background/init.js:77:1 went out of scope keepassxc-browser.js:1244:17

KeePassXC - 2.3.1
keepassxc-browser - 1.0.1
Operating system: Mac/Win/Linux
Browser: Firefox
Proxy used: yes

@varjolintu
Copy link
Member

Check out this guide for troubleshooting.

@zmyrgel
Copy link
Author

zmyrgel commented Apr 1, 2018

Ok, checked the file "/home/tmy/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json" exists and has correct path.
When should the keepassxc-proxy be running? When I hit reload?
I don't see that in process list, when running it manually it stays on but prints following:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-tmy'

But even then the reload button does nothing.

@varjolintu
Copy link
Member

Does that temporary path exist? Have you tried to set XDG_RUNTIME_DIR?

@zmyrgel
Copy link
Author

zmyrgel commented Apr 1, 2018

Yes, the directory exists:

tmy@phobos facebook $ ls -la /tmp/runtime-tmy/ 
total 8
drwx------   2 tmy   wheel   512 Apr  1 09:10 ./
drwxrwxrwt  30 root  wheel  1024 Apr  1 12:17 ../
srwx------   1 tmy   wheel     0 Apr  1 09:10 kpxc_server=

I tried to set the dir to point under my home dir but that didn't help.

@varjolintu
Copy link
Member

What does the browser debug console say when doing reload?

@zmyrgel
Copy link
Author

zmyrgel commented Apr 1, 2018

Error​columnNumber: 1​fileName: "undefined"​lineNumber: 0​message: "Promised response from onMessage listener at @moz-extension://202a47ac-4270-4cdc-b3cb-88c3d4333ee8/background/init.js:77:1 went out of scope"​stack: ""​__proto__: Object { … } keepassxc-browser.js:1244:17

@varjolintu
Copy link
Member

Nothing else? That error is a non-issue.

@zmyrgel
Copy link
Author

zmyrgel commented Apr 1, 2018

Didn't see anything else regarding keepassxc. Nor does clicking and waiting connect... or it takes longer than minute to connect.

@varjolintu
Copy link
Member

I wonder if there's some kind of mixup going on. Does /tmp/kpxc_server exist too? Both KeePassXC and the proxy should use the same socket.

@zmyrgel
Copy link
Author

zmyrgel commented Apr 2, 2018

tmy@phobos tmy $ ls -l /tmp/runtime-tmy/ 
total 0
srwx------  1 tmy  wheel  0 Apr  1 09:10 kpxc_server=
tmy@phobos tmy $ ls -l /tmp | grep keep* 
-rw-r--r--  1 tmy      wheel   37 Apr  1 09:03 keepassxc-tmy.lock
srwx------  1 tmy      wheel    0 Apr  1 09:03 keepassxc-tmy.socket=
tmy@phobos tmy $ 

So the proxy uses /tmp/runtime-tmy and keepassxc uses /tmp?
I tried to set the proxy to /tmp but it warns:

tmy@phobos tmy $ XDG_RUNTIME_DIR=/tmp keepassxc-proxy 
QStandardPaths: wrong ownership on runtime directory /tmp, 0 instead of 1000

@varjolintu
Copy link
Member

Both KeePassXC and the proxy should use the same socket. Just making sure if there's something strange going on. Have you tried if connection works without the proxy? KeePassXC should be closed, then restart the browser and KeePassXC should open.

@gasinvein
Copy link

gasinvein commented Apr 3, 2018

Same problem here, on Fedora 27.

@ignacio-vc
Copy link

ignacio-vc commented Apr 3, 2018

I have a strange occurrence to report in this same vein. I have two computers, both with up-to-date Debian Sid + Firefox. On the first computer, the browser extension manages to connect to keepassxc out of the box, no problem. On the second computer, replicating the exact same steps, it does not work, giving the error message (Timeout or not connected to KeePassXC)

Also, in the extension menu, the KeePassXC version shows correctly as 2.3.1 on the first computer, but on computer 2 it shows as 'unknown', even though they have the exact same package from the Debian Sid repo.

I made sure that org.keepassxc.keepassxc_browser.json points to the correct path /usr/bin/keepassxc-proxy. and I observed that the extension wasn't launching the proxy as it should when opening Firefox.

So I went to the debug menu for the extension, and found messages such as this:

Error 5: Timeout or not connected to KeePassXC  keepass.js:954:5

Connecting to native messaging host org.keepassxc.keepassxc_browser  keepass.js:870:5

Failed to execute command "/usr/bin/keepassxc-proxy"  NativeMessaging.jsm:101
	this.NativeApp</this.startupPromise< resource://gre/modules/NativeMessaging.jsm:101:9

Failed to connect: Unknown error  keepass.js:846:5

Error 5: Timeout or not connected to KeePassXC  keepass.js:954:5

TypeError: keepass.nativePort is null[Learn More]  keepass.js:92:13

uncaught exception: false  (unknown)
[Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIMessageSender.sendAsyncMessage]"  nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)"  location: "JS frame :: resource://gre/modules/ExtensionUtils.jsm :: sendAsyncMessage :: line 524"  data: no]  (unknown)

I dug into the keepass.js file and it seems to me like keepass.nativePort is supposed to be null at the start and then gets assigned a value through the proxy, but for some reason on computer 2 it's not doing that, while on 1 it picked it up immediately and has a valid value. Any idea what could be causing this discrepancy? As far as I can tell, both computers have the same config options, and I didn't follow the procedure differently between them.

@varjolintu
Copy link
Member

NS_ERROR_NOT_INITIALIZED means that the keepassxc-proxy cannot be launched. I suppose it still works if you try to start it manually?

@varjolintu
Copy link
Member

This PR might help a little to the issue: keepassxreboot/keepassxc#1818

@zmyrgel
Copy link
Author

zmyrgel commented Apr 28, 2018

I closed the keepassxc process and tried the firefox extension still reports the same timeout message. So it won't work without proxy either.

@varjolintu
Copy link
Member

Well that's strange. Did the binary change from keepassxc-proxy to keepassxc in the json script?

@mircsicz
Copy link

mircsicz commented May 7, 2018

What is that you need to make sure they are the same bug?

@varjolintu
Copy link
Member

@mircsicz Did you check the troubleshooting guide?

@mircsicz
Copy link

mircsicz commented May 8, 2018

Just checked on my Mac:

mircsicz@MacBook-Pro ~ $ ls -l ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts
total 16
-rw-r--r-- 1 mirco staff 378 3 Apr 13:01 org.keepassxc.keepassxc_browser.json

mircsicz@MacBook-Pro ~ $ cat ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/org.keepassxc.keepassxc_browser.json
{
"allowed_origins": [
"chrome-extension://iopaggbpplllidnfmcghoonnokmjoicf/",
"chrome-extension://oboonakemofpalcgghocfoadofidjkkk/"
],
"description": "KeePassXC integration with native messaging support",
"name": "org.keepassxc.keepassxc_browser",
"path": "/Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy",
"type": "stdio"
}

mircsicz@MacBook-Pro ~ $ ls -l /Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy
-rwxr-xr-x 1 mirco staff 43648 6 Mär 23:16 /Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy

mircsicz@MacBook-Pro ~ $ ps ax|grep proxy
20942 ?? S 0:00.04 /Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy chrome-extension://oboonakemofpalcgghocfoadofidjkkk/

the only thing that suprise's me is that I've two allowed origins, rest should be fine...

@varjolintu
Copy link
Member

@mircsicz That looks fine. Any help using the official migration guide?

@mircsicz
Copy link

mircsicz commented May 8, 2018

Been there done that, it works after unlocking the DB and clicking Reload in the Browser extension.

@mircsicz
Copy link

mircsicz commented May 9, 2018

So what else could be done to solve the issue?

@phoerious
Copy link
Member

Please try out 2.3.3 when we release it in the evening. I had some problems with the connection as well, but the new builds seem to solve them.
We fixed some length inconsistencies in the native messaging protocol.

@varjolintu
Copy link
Member

@mircsicz I'm sorry if I don't understand but what's exactly the issue if using Reload in the browser extension works? Database needs to be open. In the next browser extension release reloading will be made automatically.

@mircsicz
Copy link

mircsicz commented May 9, 2018 via email

@varjolintu
Copy link
Member

@mircsicz It should. The next browser extension release fixes this also, and there's already a PR for KeePassXC 2.4.0 which uses the same unlock dialog with AutoType so it will work even better :)

@zmyrgel
Copy link
Author

zmyrgel commented May 11, 2018

Just tried again after updating to keepassxc-2.3.3 and keepassxc-browser-1.1.3 but same result, "Timeout or not connected to Keepassxc" persists.
I also tried killing the keepassxc from background and hitting reload from browser but it still didn't work.
Tested chrome and it continues to work just fine.

@zmyrgel
Copy link
Author

zmyrgel commented May 11, 2018

Console shows following:

Error: Promised response from onMessage listener at @moz-extension://202a47ac-4270-4cdc-b3cb-88c3d4333ee8/background/init.js:79:1 went out of scope
keepassxc-browser.js:1882:13

@varjolintu
Copy link
Member

I really cannot find a reason why Firefox doesn't work and Chrome works. Maybe I need to install OpenBSD VM and try it myself.

@prog-amateur
Copy link

I have exactly the same issue (Firefox / Linux). And I hqave found that "Firefox" checkbox is always unticked each time I close KeepassXC database (before, I have clicked on Apply and OK button).
By checking the troubleshooting guide, I have not found any file called org.keepassxc.keepassxc_browser.json this is strange.
I am not a developper so it is a bit complex to me.

@varjolintu
Copy link
Member

@prog-amateur Could you check if a location ~/.mozilla/native-messaging-hosts exists? And that .mozilla folder has permissions to write in it?

@varjolintu
Copy link
Member

varjolintu commented May 22, 2018

@zmyrgel I have problems debugging the extension from Firefox in OpenBSD. When clicking Debug from about:debugging nothing happens. Have you got the same problem? I even tried to set XDG_RUNTIME_DIR but that didn't help either.

@prog-amateur
Copy link

@varjolintu thank you for your help, I confirm that location ~/.mozilla/native-messaging-hosts does NOT exist but .mozilla folder has permission to write in other folders

@varjolintu
Copy link
Member

@prog-amateur Clicking the Firefox checkbox should create that directory and the JSON script. And it should also show warning if it didn't succeed. Of course you can try to create the file manually.

@prog-amateur
Copy link

prog-amateur commented May 22, 2018

There is neither folder nor warning. I have made a folder called native-messaging-hosts and tried to reload without success. I use the flatpack version, do you think it has any consequence ?

@zmyrgel
Copy link
Author

zmyrgel commented May 22, 2018

@varjolintu yeah, same issue when hitting debug. I was wondering if thats how it was supposed to function but apparently it should give some feedback when the debug is enabled.

@varjolintu
Copy link
Member

@zmyrgel It should open a separate window for debugging purposes. When that doesn't work the options are quite limited.. there's no other way to debug the background scripts.

@caseyjp11
Copy link

Firefox Quantum 60.0.1 Clean install of the application (Archlinux -current) following the steps in the install guide exactly.

Same error.

@varjolintu
Copy link
Member

@caseyjp11 Did troubleshooting guide help?

@TraceyC77
Copy link

TraceyC77 commented Jun 27, 2018

I have also been having problems with KeePassXC connecting to Firefox, intermittently, for a few weeks. For instance, it worked fine yesterday but today the browser extension will not connect to KeePassXC. Chromium connects fine. KeePassXC was started before either browser, after a fresh boot.

KeePassXC - 2.3.3 installed via deb package from the official PPA (not flatpack or snap)
keepassxc-browser - 1.1.7
Operating system: Ubuntu 18.04
Browser: Firefox 60.0.2 (64-bit)
Proxy used: yes
Firefox is checked / enabled in KeePassXC - Browser Integration (non-legacy)

Symptom:
After starting KeePassXC and then FireFox, the KeePassXC icon in the browser toolbar shows "KeePassXC-Browser has not been configured. Press the connect button to register and pair with KeePassXC. " with a "Connect" button. Clicking "Connect" has no effect.

The extension was working OK yesterday. In days previous, sometimes it would ask to form a new connection to the database (and I had to verify that I wanted to overwrite the existing one). Previously I had tried removing the connection & re-saving, but that only worked temporarily as you can see.

From the troubleshooting guide:

Path to keepassxc-proxy is correct:

ag path ~/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json
"path": "/usr/bin/keepassxc-proxy",

❯ file /usr/bin/keepassxc-proxy
/usr/bin/keepassxc-proxy: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=5c93379511b3b596263c796df1400ce047a0e69b, stripped

Proxy is running:

❯ pgrep -la keepassxc
2847 keepassxc
4627 /usr/bin/keepassxc-proxy chrome-extension://oboonakemofpalcgghocfoadofidjkkk/
6341 /usr/bin/keepassxc-proxy /home/tracey/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json [email protected]

Debugging output after clicking the extension icon:

08:12:16.658 [Exception... "Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIMessageSender.sendAsyncMessage]"  nsresult: "0xc1f30001 (NS_ERROR_NOT_INITIALIZED)"  location: "JS frame :: resource://gre/modules/ExtensionUtils.jsm :: sendAsyncMessage :: line 533"  data: no]  (unknown)
08:12:17.382 Unchecked lastError value: Error: Could not establish connection. Receiving end does not exist.  background.js:12869
08:12:18.378 Error: Promised response from onMessage listener went out of scope  background.js:8:1517636
08:12:18.383 Error: Promised response from onMessage listener went out of scope  background.js:11378:1
08:12:18.383 Error: Promised response from onMessage listener went out of scope  background.js:8:1517636
08:12:18.635 Unchecked lastError value: Error: Could not establish connection. Receiving end does not exist.  background.js:12869

I'm happy to assist in troubleshooting further, time permitting.

@varjolintu
Copy link
Member

@TraceyC77 If you open the /home/tracey/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json file where does the path point to? That JavaScript error means the native messaging host in the path does not exists.

@TraceyC77
Copy link

TraceyC77 commented Jun 28, 2018

Here are the contents of that file

{
    "allowed_extensions": [
        "[email protected]"
    ],  
    "description": "KeePassXC integration with native messaging support",
    "name": "org.keepassxc.keepassxc_browser",
    "path": "/usr/bin/keepassxc-proxy",
    "type": "stdio"
}

The file exists

❯ ll /usr/bin/keepassxc-proxy                                                                                                             [09:39:50]
-rwxr-xr-x 1 root root 23K May  9 12:57 /usr/bin/keepassxc-proxy*

@FrankySnow
Copy link

I had the same error (kubuntu 18.04, FF dev edition 62) until I found that the proxy wasn't automatically launched.
Turning on the setting "Update native messaging manifest files at startup" solved the problem.

@Christos11
Copy link

Hello,

I can't get the firefox addon to connect to my -otherwise working fine- KeePassXC installation. I get all the time the "Timeout or not connected to KeePassXC" message. I installed KeePassXC on my linux mint machine via the software manager. My debug info is as follows:

KeePassXC - Version 2.3.3
Revision: 0a155d8
Distribution: Flatpak

Libraries:

  • Qt 5.10.1
  • libgcrypt 1.7.3

Operating system: Linux 4.15.0-29-generic
CPU architecture: x86_64
Kernel: linux 4.15.0-29-generic

Enabled extensions:

  • Auto-Type
  • Browser Integration
  • Legacy Browser Integration (KeePassHTTP)
  • SSH Agent
  • YubiKey

The contents of my /home/pc/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json file are:

{
    "allowed_extensions": [
        "[email protected]"
    ],
    "description": "KeePassXC integration with native messaging support",
    "name": "org.keepassxc.keepassxc_browser",
    "path": "/var/lib/flatpak/exports/bin/org.keepassxc.KeePassXC",
    "type": "stdio"
}

The path /var/lib/flatpak/exports/bin/org.keepassxc.KeePassXC does not exist, and this is what the ffox debugging console reports too:

File at path "/var/lib/flatpak/exports/bin/org.keepassxc.KeePassXC" does not exist, or is not executable

but I'm not sure where this path should point to. Files like /usr/bin/keepassxc-proxy mentioned above do not exist on my machine either.

I've tried checking the "Update native messaging manifest files at startup" setting too, to no avail.

Please advise what I can do to get my browser talking to KPXC.

Thanks

@varjolintu
Copy link
Member

@kurobeats
Copy link

kurobeats commented May 27, 2019

Further to @Christos11's comment, I found a work around. The addon expects the flatpak to be installed in /var/lib/flatpak/exports/bin/ which it will be in 90% of cases. in 10% or so cases, the user has opt'd to install with the --user flag and so the flatpak will be located in $HOME/.local/share/flatpak/exports/bin/

My work around until a fix can be found is to modify $HOME/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json with the following:

{
    "allowed_extensions": [
        "[email protected]"
    ],
    "description": "KeePassXC integration with native messaging support",
    "name": "org.keepassxc.keepassxc_browser",
    "path": "/home/USERNAME/.local/share/flatpak/exports/bin/org.keepassxc.KeePassXC",
    "type": "stdio"
}

@rugk
Copy link

rugk commented May 5, 2020

FYI, for everyone following: I have found a working around involving some manual steps you need to do though for KeePassXC<->Firefox communication, if Firefox is flatpaked/sandboxed (works if KeePassXC is sandboxed or not). Read the full write-up/tutorial here.

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