Keepassxc: macOS can not connect database in KeepassXC Browser extension (Firefox)

Created on 23 Feb 2018  Â·  12Comments  Â·  Source: keepassxreboot/keepassxc

Expected Behavior

I would expect to be able to set up a database connection to an opened database and use the extension.

Current Behavior

I turn on the new browser extension support in the 2.3 Beta application. Then I install the KeepassXC Browser extension into Firefox and try to establish a connection. The window asking me to define a name for the database settings never shows up and no connection is ever established.

I can not use the browser extension to fill data fields.

Steps to Reproduce (for bugs)

  1. Install 2.3.0-Beta1 on macOS Sierra
  2. Install KeepassXC-Browser Extension in Firefox 58.0.2
  3. Disable Legacy Browser Support
  4. Disable Legacy Browser Extension
  5. Enable Browser Support for new extension
  6. Try to establish connection

Context

The browser extension never establishes a connection with the app and does not work.

Debug Info

KeePassXC - Version 2.3.0-beta1
Build Type: PreRelease
Revision: 10bd73c

Libraries:

  • Qt 5.9.3
  • libgcrypt 1.8.2

Operating system: macOS Sierra (10.12)
CPU architecture: x86_64
Kernel: darwin 16.7.0

Enabled extensions:

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

INFO From Extension About

KeePassXC-Browser Version: 0.6.0

KeePassXC Version: unknown

bug build system macOS

Most helpful comment

This explains a lot. I'm investigating it. There's custom commands in the proxy/CMakeLists.txt that link the libraries to the ones inside the .app package. For some reason that might have failed.

EDIT: Confirmed it. keepassxc-proxy linking points to /usr/local/Cellar/qt/5.9.3/lib/ instead.
To fix it manually while waiting the official fix you can run the following commands:

  • install_name_tool -change /usr/local/Cellar/qt/5.9.3/lib/QtCore.framework/Versions/5/QtCore "@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore" /Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy
  • install_name_tool -change /usr/local/Cellar/qt/5.9.3/lib/QtNetwork.framework/Versions/5/QtNetwork "@executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork" /Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy

However, this requires Command Line Tools for Xcode package to be installed.

All 12 comments

Could you debug the extension and see if there's any error messages in the console? Also, can you look if keepassxc-proxy is up and running?

I have experianced the same issue.

To debug the extension, go to about:debugging and toggle the Enable add-on debugging checkbox. Then you can find the KeePassXC-Browser extension and click Debug under it. That should open a separate window where you can view the console.

Will do that later. How do I verify that the proxy is running?

Use the Activity Monitor application to see running processes.

It seems that the keepassxc-proxy binary cannot be launched, attempting to do it manually results in:

➜  ~ /Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy
dyld: Library not loaded: /usr/local/Cellar/qt/5.9.3/lib/QtNetwork.framework/Versions/5/QtNetwork
  Referenced from: /Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy
  Reason: image not found
[1]    7150 abort      /Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy

I don't have any Qt libraries installed, so I guess this is a linking issue in the build process?

The libraries are definitely present in the app container though, see

➜  ~ ls /Applications/KeePassXC.app/Contents/Frameworks
QtConcurrent.framework   QtNetwork.framework      libargon2.1.dylib        libsodium.23.dylib
QtCore.framework         QtPrintSupport.framework libgcrypt.20.dylib       libykpers-1.1.dylib
QtGui.framework          QtSvg.framework          libgpg-error.0.dylib     libyubikey.0.dylib
QtMacExtras.framework    QtWidgets.framework      libjson-c.2.dylib

Edit:
Here's the requested debug info (Firefox 58.0.2):

Connecting to native messaging host org.keepassxc.keepassxc_browser  keepass.js:870:5
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 514"  data: no]

This explains a lot. I'm investigating it. There's custom commands in the proxy/CMakeLists.txt that link the libraries to the ones inside the .app package. For some reason that might have failed.

EDIT: Confirmed it. keepassxc-proxy linking points to /usr/local/Cellar/qt/5.9.3/lib/ instead.
To fix it manually while waiting the official fix you can run the following commands:

  • install_name_tool -change /usr/local/Cellar/qt/5.9.3/lib/QtCore.framework/Versions/5/QtCore "@executable_path/../Frameworks/QtCore.framework/Versions/5/QtCore" /Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy
  • install_name_tool -change /usr/local/Cellar/qt/5.9.3/lib/QtNetwork.framework/Versions/5/QtNetwork "@executable_path/../Frameworks/QtNetwork.framework/Versions/5/QtNetwork" /Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy

However, this requires Command Line Tools for Xcode package to be installed.

Currently src/proxy/CMakeLists.txt points to /usr/local/opt/qt/lib/. Maybe the one building macOS binaries could make a symbolic link to that location from /usr/local/Cellar/qt/5.9.3/lib/ before building the package? The linkage can be checked with otool -L /Applications/KeePassXC.app/Contents/MacOS/keepassxc-proxy

Can confirm that the suggested commands fix the issue.

Can also confirm, I get the same error in the extension debugging session.

Ran the commands and now it works.

Great news! Now I know what to fix. Thanks guys :)

I didn't realize the CMakeLists.txt hardcodes the path to Qt. This should not be the case. /usr/local/opt/qt only works with the upstream Qt distribution, not with Homebrew.

Was this page helpful?
0 / 5 - 0 ratings