keepassxc-browser icon indicating copy to clipboard operation
keepassxc-browser copied to clipboard

KeepassXC-Browser will not connect to Brave-Browser.

Open Querzion opened this issue 2 years ago • 39 comments

Done this multiple times. Followed it, did not work. Brave is basically Chromium, but it's still not chromium, It shouldn't be treated as if it's the same browser, regardless of it using the Chrome extension or not.

Expected Behavior

I use Firefox and Brave browser. So I activate them in the browser integration. image

This has happened EVERY time that I try to connect to Brave, after every re-install of the computer this always happen. I Enable the browser, I go to the browser integration and flush the old stuff. image

Then I connect Firefox, and then I TRY to connect Brave... "KeePassXC-Browser has encountered an error: Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings." I even have Chrome & Chromium activated because Brave is based on Chromium. Even so, Brave fails and then on random; month's down the road it might just connect out of nowhere, which happened in the old distro. I used Manjaro then. I use Arco now. image

Current Behavior

The extension will not connect, period.

Steps to Reproduce (for bugs)

Install Brave (Flatpak). image Sync Brave to Chain. (KeepassXC - Browser extension gets installed). image Install KeepassXC (Flatpak). image Enable Browser Integration. Reset connections. Connect Extension to KeepassXC database. Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings.

Only in Brave might I add. Firefox works fine, Chrome worked out of the box in the last OS install.

Debug Info - Browser Extension;

KeePassXC - unknown KeePassXC-Browser - 1.8.3.1 Operating system: Linux x86_64 Browser: Chrome/Chromium 107.0.0.0

Debug Info - KeepassXC; KeePassXC - Version 2.7.4 Revision: 63b2394 Distribution: Flatpak

Qt 5.15.6 Debugging mode is disabled.

Operating system: KDE Flatpak runtime CPU architecture: x86_64 Kernel: linux 6.0.8-arch1-1

Enabled extensions:

  • Auto-Type
  • Browser Integration
  • SSH Agent
  • KeeShare
  • YubiKey

Cryptographic libraries:

  • Botan 2.19.1

Querzion avatar Nov 15 '22 17:11 Querzion

I suggest to read the other threads that include Flatpak browsers: https://github.com/keepassxreboot/keepassxc-browser/issues/1267.

varjolintu avatar Nov 15 '22 17:11 varjolintu

I do have the same problem, even when I installed Brave via apt on Ubuntu 20.04. KeepassXC is installed via AppImage, and does not give any problems when connecting to Firefox of Chrome. However there is no way I can connect to KeepassXC-Browser using Brave.

It first say:

KeePassXC-Browser has encountered an error:

Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings.

And when I press reload:

KeePassXC-Browser has encountered an error:

Key exchange was not successful.

When I try to connect from the "Connected Databases", nothing happens when I press "connect", while on other browsers the window to create a new association key pops up.

These are my details:

KeePassXC - Version 2.7.4 Revision: 63b2394 Distribution: AppImage

Qt 5.15.2 Debugging mode is disabled.

Operating system: Ubuntu 20.04.5 LTS CPU architecture: x86_64 Kernel: linux 5.14.0-1054-oem

Enabled extensions:

  • Auto-Type
  • Browser Integration
  • SSH Agent
  • KeeShare
  • YubiKey
  • Secret Service Integration

Cryptographic libraries:

  • Botan 2.19.1

KeePassXC-Browser - 1.8.3.1 Operating system: Linux x86_64 Browser: Chrome/Chromium 107.0.0.0

Brave version 1.46.110 Chromium:107.0.5304.1100 (Official Build) beta (64-bit)

basillicus avatar Nov 22 '22 14:11 basillicus

@basillicus So.. does Ubuntu install Brave as Snap via apt?

varjolintu avatar Nov 22 '22 14:11 varjolintu

@basillicus And what are your findings when you read the https://github.com/keepassxreboot/keepassxc-browser/wiki/Troubleshooting-guide ?

varjolintu avatar Nov 22 '22 15:11 varjolintu

  1. The path for the native message script for Brave browser is not indicated. I found it here: ~/.config/BraveSoftware/Brave-Browser/NativeMessagingHosts/org.keepassxc.keepassxc_browser.json

  2. The content of the file seems correct:

{
    "allowed_origins": [
        "chrome-extension://pdffhmdngciaglkoonimfcmckehcpafo/",
        "chrome-extension://oboonakemofpalcgghocfoadofidjkkk/"
    ],
    "description": "KeePassXC integration with native messaging support",
    "name": "org.keepassxc.keepassxc_browser",
    "path": "/home/david/software/keepassXC/KeePassXC-2.7.4-x86_64.AppImage",
    "type": "stdio"
}

  1. The keepassxc-proxy binary is not running, and I can not run it manually. If I run

I can monitor it, but when I try monitoring the process with brave,

sudo strace -f -p $(pgrep brave) 2>&1 | grep keepass

it does not work, I believe because the command pgrep brave returns multiple PIDs

  1. The Unix Domain socket path check also seems correct. The file /run/user/1001/org.keepassxc.KeePassXC.BrowserServer is a symbolic link to itself, what is correct. And also have the socket file /run/user/1001/app/org.keepassxc.KeePassXC/org.keepassxc.KeePassXC.BrowserServer

So I believe the problem is that keepassxc-proxy is not launched by Brave?

If I have firefox open and run ps aux | grep -i keepassxc-proxy I can see the binary running, however it does not happen when only Brave is running.

basillicus avatar Nov 22 '22 16:11 basillicus

@basillicus That means Brave tries to start the proxy from some other location. It's strange if strace doesn't give you any results. You can try to enable support from Chrome and Chromium from KeePassXC, because for some reason Brave sometimes uses those config paths instead of their own.

varjolintu avatar Nov 22 '22 17:11 varjolintu

I've tried using the stable release of Brave ( v1.45.131 ) instead of the Beta one, and it works well with the KeepassXC version 2.7.4 . Looks like the problem is with Brave beta and not KeepassXC-Browser @Querzion maybe try to update your Flatpack installed Brave version from v.1.45.123 --> v1.45.131 and check if that solves your problem?

--Edit:

I've issued the bug on Brave forums if someone wants to follow up

basillicus avatar Nov 23 '22 13:11 basillicus

@basillicus That explains it. We don't directly support Beta browsers, but if you wish to use it, you must provide the right path for the Native Messaging script manually using the Custom Browser feature. Usually that's no the default, but some -beta or -develop etc. added to the config path.

varjolintu avatar Nov 23 '22 13:11 varjolintu

Oh! well so that means it may not be a Brave Beta bug either? Should I remove the bug report then?

I really do not know what flag should I use, plus I do not want to customize KeepassKC that much as it may stop working with the other explorers like Chrome or Firefox. As long as it works with the stable Release of Brave, I am happy.

basillicus avatar Nov 23 '22 14:11 basillicus

I get exactly this behavior, but with Chromium. Chromium has never connected, and the messages were identical to the above. Brave on Linux Mint connects perfectly every time. No Snap involved.

What's going on?

Thomas

thomas-neuburger avatar Jan 15 '23 10:01 thomas-neuburger

@thomas-neuburger The Chromium's Native Messaging path is correct, and not some distro-specific?

varjolintu avatar Jan 15 '23 10:01 varjolintu

@thomas-neuburger The Chromium's Native Messaging path is correct, and not some distro-specific?

Thanks for the reply. Not sure what that means. What's the native messaging path?

When Chromium launches, KeePassXC is activated (the window awakens and receives focus). So there's communication between Chromium and KeePass. But apparently not the right kind.

Linux Mint 20.3.

From the About page on Chromium: KeePassXC - [2.7.4] KeePassXC-Browser - 1.8.4 Operating system: Linux x86_64 Browser: Chrome/Chromium 108.0.0.0

thomas-neuburger avatar Jan 15 '23 10:01 thomas-neuburger

@thomas-neuburger Check https://github.com/keepassxreboot/keepassxc-browser/wiki/Troubleshooting-guide.

varjolintu avatar Jan 15 '23 11:01 varjolintu

The extension can't even seem to detect the system KeePassXC version from the Brave flatpak either; I directed even enabled read and write support to the native messaging path and read-only access to the keepassxc-proxy binary and it still didn't make any difference. :/

ThisNekoGuy avatar Jan 15 '23 13:01 ThisNekoGuy

@ThisNekoGuy Are you Brave Flatpak is able to use Native Messaging? https://github.com/flatpak/xdg-desktop-portal/pull/705

varjolintu avatar Jan 15 '23 13:01 varjolintu

By default, probably not (as you noted), but I did provide a filesystem path to the folder via flatseal... so I expected it to work but I'm either otherwise missing something or I was wrong in thinking that was a solution.

ThisNekoGuy avatar Jan 15 '23 15:01 ThisNekoGuy

I think I answered my question regarding Chromium not connecting to the KeepassXC database.

I typically run Brave and Chromium at the same time. Brave launches automatically on login. Chromium is open only if I need it. So Brave is always connected to KeepassXC. The "NativeMessaging" file for both browsers point to the same extension ID: oboonakemofpalcgghocfoadofidjkkk.

Is it possible that both connections (from Brave and from Chromium) can't be active at the same time if Keepass is already connected to one of them?

As I said, when I try to connect from Chromium (with Brave already successfully connected), Keepass pops up out of the try, but Chromium shows a connection failure.

Thomas

thomas-neuburger avatar Jan 16 '23 14:01 thomas-neuburger

@thomas-neuburger There are no restrictions for the same connection, unless you are using same connection name for both browsers. That's not allowed.

varjolintu avatar Jan 16 '23 14:01 varjolintu

Thanks for the fast reply. Where is the connection name set? It seems the two config files are identical, character for character.

Thomas

EDIT:

Here's the complete contents of the Chromium version of the NativeMessagingHosts file:

{ "allowed_origins": [ "chrome-extension://pdffhmdngciaglkoonimfcmckehcpafo/", "chrome-extension://oboonakemofpalcgghocfoadofidjkkk/" ], "description": "KeePassXC integration with native messaging support", "name": "org.keepassxc.keepassxc_browser", "path": "/home/thomasn/Applications/KeePassXC-2.7.4-x86_64_2203fb14036f8806d01a903020aebd71.AppImage", "type": "stdio" }

thomas-neuburger avatar Jan 16 '23 14:01 thomas-neuburger

@thomas-neuburger KeePassXC -> Database Settings -> Browser Integration -> Stored keys. The names and values should match with your extension settings (Connected Databases). Do not use identical names.

varjolintu avatar Jan 16 '23 14:01 varjolintu

That helps. When I go to the program itself (KeepassXC) and do what you suggested, I see just one key, the one from Brave. How do I create/generate the key needed by Chromium?

@varjolintu Your help is really appeciated.

Thomas

thomas-neuburger avatar Jan 16 '23 14:01 thomas-neuburger

@thomas-neuburger You should clear any Connected Databases from the Chromium side and reconnect it to the extension under a different name.

varjolintu avatar Jan 16 '23 14:01 varjolintu

That's the problem. There are no connected databases on the Chromium side. And there's no way that I can see to add one using the Chromium UI. Clicking the Connect button (below) does nothing.

image

Thomas

thomas-neuburger avatar Jan 16 '23 14:01 thomas-neuburger

@thomas-neuburger What does the extension popup say when you open it from the toolbar icon? Do that when your database is open and active in KeePassXC.

varjolintu avatar Jan 16 '23 15:01 varjolintu

Github isn't showing me your last question, but if I understand what you asked, here's the answer.

The first image shows what happens in Chromium when I click the Keepass icon in the extension bar (it has an x on it):

image

When I click Reload, KeepassXC pops to the foreground and nothing else happens.

HTH,

Thomas

thomas-neuburger avatar Jan 16 '23 15:01 thomas-neuburger

@thomas-neuburger What happens if KeePassXC is closed before you hit the Reload?

varjolintu avatar Jan 17 '23 05:01 varjolintu

@varjolintu Good thought. Didn't help though. Under any variation of actions, with Keepass either not launched or launched but locked, clicking Reload launches the program (if not launched) or brings the launched, locked program to the foreground, waiting for the password.

Once the PW is entered, no connection from Chromium is possible.


I wonder if unchecking the Setting that restricts only one instance of Keepass from running at the same time would help. Not sure I want to complicate my setup that way though.

Also, this is just the KeepassxC-Browser app. There are others that seem to do the same thing:

image

Would love to get this solved. But I'm unwilling to delete a working Brave setup to fix it. Still open to thoughts, including from the developer.

Thomas

thomas-neuburger avatar Jan 17 '23 10:01 thomas-neuburger

@thomas-neuburger The extension should not launch KeePassXC but the keepassxc-proxy process. So there's something strange happening with the AppImage. The behavior you are seeing is not normal. I'd advice you to use a normal install from PPA or even Flatpak version.

The other extensions you linked cannot use KeePassXC. Those use either the old HTTP connection method (KeePassXC no longer supports this) or connect to your database directly from the extension (not recommended).

varjolintu avatar Jan 17 '23 10:01 varjolintu

So there's something strange happening with the AppImage.

Agree that this may be true. But why then would Brave work with exactly the same native hosts file?

Thomas

thomas-neuburger avatar Jan 17 '23 10:01 thomas-neuburger