keepassxreboot / keepassxc-browser

KeePassXC Browser Extension
GNU General Public License v3.0
1.75k stars 183 forks source link

Extension won't connect after Firefox update #1784

Open simeonschaub opened 1 year ago

simeonschaub commented 1 year ago

After updating Firefox, the extension stopped working. I tried disconnecting the database in the extension settings, but if I then press "Connect" to reconnect again nothing happens. I also tried refreshing Firefox to clear the extension settings, but this also did not change things.

Debug info

KeePassXC - 2.7.4 KeePassXC-Browser - 1.8.3.1 Operating system: Linux x86_64 (Manjaro Linux 22.0.0) Browser: Mozilla Firefox 106.0

varjolintu commented 1 year ago

Does Manjaro use Snap/Flatpak etc. for Firefox? Did the Troubleshooting Guide help? There's a few new sections concerning Linux (Firejail, socket location etc.).

simeonschaub commented 1 year ago

Looks like maybe Firefox changed their CSP? If I open the console when in the extension settings I see:

Content Security Policy: The page’s settings blocked the loading of a resource at inline (“script-src”).

Setting security.csp.enable to true temporarily as mentioned in https://stackoverflow.com/questions/37298608/content-security-policy-the-pages-settings-blocked-the-loading-of-a-resource seems to fix the issue.

I checked, the version of Firefox I am using is not based on Snap or Flatpak.

varjolintu commented 1 year ago

Ah, maybe the next version fixes that then. There was some issue with an inline script.

alexisstgc commented 1 year ago

Hi, I'm also having the same behavior.

My config: KeePassXC - unknown (doesn't get detected probably because of the connection issue, but I have 2.7.4 installed) KeePassXC-Browser - 1.8.3.1 Operating system: Linux x86_64 (Ubuntu 22.04.1 LTS) Browser: Mozilla Firefox 107.0

I tried to reconnect the database from scratch by executing the KeePassXC-Browser Helper Script but it doesn't seem to change anything. Moreover, when I try to delete the existing database connection to reconfigure it, the delete button does not have any effect. When checking the console, I have the warning about CSP @simeonschaub mentioned, I also have this :

Uncaught TypeError: $(...) is null
    removeButtonClicked moz-extension://c01e1b50-74cf-4737-88fc-92a53e9aa84b/options/options.js:387
    removeButtonClicked moz-extension://c01e1b50-74cf-4737-88fc-92a53e9aa84b/options/options.js:387

I don't know if it this related to this issue, but it might...

undeference commented 1 year ago

With Firefox 107

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

[Error keepass.js:270] KeePassXC-Browser - 5: Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings.

If I click "🗘 Reload", it looks like it connects

KeePassXC-Browser: Connecting to native messaging host org.keepassxc.keepassxc_browser KeePassXC-Browser: Server public key: …

But it doesn't do anything and reopening the menu again shows the "Cannot connect" messages.

security.csp.enable makes no difference

Trying to do anything when it thinks it's connected results in

[Error client.js:175] KeePassXC-Browser - 8: KeePassXC association failed, try again

and maybe

[Error httpauth.js:42] KeePassXC-Browser - No logins found for HTTP Basic Auth.

varjolintu commented 1 year ago

@undeference Details are missing e.g. about your OS and your findings from the Troubleshooting Guide.

undeference commented 1 year ago

@undeference Details are missing e.g. about your OS and your findings from the Troubleshooting Guide.

Fedora release 37 (Thirty Seven) 6.0.9-300.fc37.x86_64 firefox-107.0-4.fc37.x86_64 keepassxc-2.7.4-2.fc37.x86_64

My findings are that parts of the troubleshooting guide are outdated (e.g., how to Inspect the extension and related menu items) and doesn't help with this issue.

varjolintu commented 1 year ago

@undeference Is your Firefox and KeePassXC installed as Snap, Flatpak, or just as a normal binary via repositories?

undeference commented 1 year ago

@undeference Is your Firefox and KeePassXC installed as Snap, Flatpak, or just as a normal binary via repositories?

These are normal binary packages from the official Fedora repositories. I did test with the official Firefox 107 release from mozilla.org and there was no difference.

varjolintu commented 1 year ago

@undeference Is your Firefox and KeePassXC installed as Snap, Flatpak, or just as a normal binary via repositories?

These are normal binary packages from the official Fedora repositories. I did test with the official Firefox 107 release from mozilla.org and there was no difference.

And what did you find about the Native Messaging script locations, strace etc?

undeference commented 1 year ago

And what did you find about the Native Messaging script locations, strace etc?

Paths are correct, as is extension ID. keepassxc-proxy is started. I'm not using firejail. I quoted from the developer console (after inspecting the content script from about:debugging).

Clicking the icon causes

write(4, "\1\0\0\0\0\0\0\0", 8)         = 8
write(6, "{\"action\":\"get-databasehash\",\"me"..., 307) = 307
write(4, "\1\0\0\0\0\0\0\0", 8)         = 8
poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}], 2, -1) = 2 ([{fd=4, revents=POLLIN}, {fd=6, revents=POLLIN}])
read(4, "\2\0\0\0\0\0\0\0", 16)         = 8
ioctl(6, FIONREAD, [345])               = 0
read(6, "{\"action\":\"get-databasehash\",\"me"..., 345) = 345
write(1, "Y\1\0\0{\"action\":\"get-databasehash\""..., 349) = 349

"🗘 Reload" results in

write(4, "\1\0\0\0\0\0\0\0", 8)         = 8
close(6)                                = 0
futex(0x5615f6bdb400, FUTEX_WAKE_PRIVATE, 2147483647) = 1
futex(0x5615f6bdb3b0, FUTEX_WAKE_PRIVATE, 1) = 1
exit_group(0)                           = ?
+++ exited with 0 +++

and keepassxc-proxy restarts.

varjolintu commented 1 year ago

@undeference What about the socket path? Have you enabled Firefox in the KeePassXC settings? This is the vital information I'm talking about :)

undeference commented 1 year ago

@undeference What about the socket path? Have you enabled Firefox in the KeePassXC settings? This is the vital information I'm talking about :)

"Paths are correct" includes socket paths (including the symlink). Browser integration is enabled for Firefox.

varjolintu commented 1 year ago

@undeference Does the keepassxc-proxy process stay up when you do the reload and it connects? Is the process up when you get the error again?

undeference commented 1 year ago

@undeference Does the keepassxc-proxy process stay up when you do the reload and it connects? Is the process up when you get the error again?

No. When I press "🗘 Reload", keepassxc-proxy exits (with status 0). It is then restarted and it claims it's connected but it does not work. Opening the thing again shows the error again.

varjolintu commented 1 year ago

@undeference Well that should definitely not exit. Have you tried another browser? I'd also suggest that you remove all connection from both KeePassXC and your browser and try to re-connect them.

undeference commented 1 year ago

It works with Chrome 107.0.5304.121. I already tried removing all connections and reconnecting but it did not help.

varjolintu commented 1 year ago

@undeference Then it must be something wrong with the Firefox version. That's all I can think of if everything should be just fine. Maybe downgrade to Firefox 106?

undeference commented 1 year ago

It works with Firefox 105, 106, … and 107! If I create a new profile, it works fine. Reinstalling KeePassXC-Browser (which seems to clear its settings) does not fix it.

Any ideas for what to try?

varjolintu commented 1 year ago

@undeference Maybe your profile is just corrupted? I've heard it happens.

undeference commented 1 year ago

I just got done bisecting my prefs.js file and found the culprit: I had gfx.x11-egl.force-disabled set to true because of stability issues. Setting it to false fixes this. That seems like a definite Firefox bug.

mixmix commented 1 year ago

I saw something weird when I got to this step : https://github.com/keepassxreboot/keepassxc-browser/wiki/Troubleshooting-guide#3-check-if-keepassxc-proxy-is-launched-and-running

[pid 161801] openat(AT_FDCWD, "/home/username/snap/firefox/common/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json", O_RDONLY) = -1 ENOENT (No such file or directory)
[pid 160464] openat(AT_FDCWD, "/usr/lib/mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json", O_RDONLY <unfinished ...>

which is the wrong location.... i think the file it's looking for is:

/home/username/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json

Linux (Ubuntu 22.04 LTS) KeePassXC - Version 2.6.6 (Revision: 9c108b9) Firefox 103.0.1 (64-bit) (Mozilla Firefox Snap for Ubuntu)

varjolintu commented 1 year ago

@mixmix That's a totally different issue. Run https://raw.githubusercontent.com/keepassxreboot/keepassxc/master/utils/keepassxc-snap-helper.sh

mixmix commented 1 year ago

Thanks for the pointer. I was using the Ubuntu package which I notice is behind a minor version. Shifted to snap

EDIT: Lol spoke too soon, browsers installed by snap are not supported.

lucknaumann commented 1 year ago

I've been having the same issue. I also use Free Download Manager, which uses NativeMessagingHosts as well, and it's not working, either.

What the add-on reports: KeePassXC-Browser has encountered an error: Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings. (After clicking "Reload") Key exchange was not successful.

KeePassXC - unknown (it's 2.7.4) KeePassXC-Browser - 1.8.4 Operating system: Linux x86_64 (KDE Neon, User Ed., 5.26.5) Browser: Mozilla Firefox 109.0 (binary: org.kde.neon.net.launchpad.ppa.mozillateam -- no snap or flatpak)

org.keepassxc.keepassxc_browser.json:

{
    "allowed_extensions": [
        "keepassxc-browser@keepassxc.org"
    ],
    "description": "KeePassXC integration with native messaging support",
    "name": "org.keepassxc.keepassxc_browser",
    "path": "/usr/bin/keepassxc-proxy",
    "type": "stdio"
}
$ sudo strace -f -p $(pgrep firefox) 2>&1 | grep keepass

[pid 93853] openat(AT_FDCWD, "/home/username/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json", O_RDONLY <unfinished ...>
[pid 83401] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid 83401] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid 83401] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid 83401] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid 83401] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid 94020] execve("/usr/bin/keepassxc-proxy", ["/usr/bin/keepassxc-proxy", "/home/username/.mozilla/native-messag"..., "keepassxc-browser@keepassxc.org"], 0x7f13ec0a9a00 /* 78 vars */ <unfinished ...>
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\6\0\0\200\4\0\377\377sender\0\0,\0\0\200\4\0\377\377keepassx"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 4096
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\6\0\0\200\4\0\377\377sender\0\0,\0\0\200\4\0\377\377keepassx"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 4096
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="c-browser@keepassxc.org.13743895"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 784
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] recvmsg(156, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] recvmsg(156, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] <... recvmsg resumed>{msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
[pid 12777] recvmsg(156, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="https://github.com/keepassxreboo"..., iov_len=4096}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT) = 236
$ ls -la /run/user/1000/org.keepassxc.KeePassXC.BrowserServer
lrwxrwxrwx 1 username username 80 Jan 11 09:11 /run/user/1000/org.keepassxc.KeePassXC.BrowserServer -> /run/user/1000/app/org.keepassxc.KeePassXC/org.keepassxc.KeePassXC.BrowserServer
varjolintu commented 1 year ago

@lucknaumann Normally you'll have to restart your browser and the proxies after Firefox update. Make sure all of those are shutdown, including KeePassXC and restart them all.

lucknaumann commented 1 year ago

@varjolintu Yeah, I didn't want to open another issue as it happened weeks ago. FF and my computer have been restarted many times since. It just isn't working.

varjolintu commented 1 year ago

@lucknaumann There's clearly something wrong with your browser installation if there's another extension using Native Messaging and it's not working either. You could always try to downgrade your browser, or try if the same happens with a different browser.

lucknaumann commented 1 year ago

@varjolintu Yeah, it works in Vivaldi, so it must be something relating to FF and Native Messaging. I'll look into reporting it to the FF people. Thanks for the quick replies! :smiley:

varjolintu commented 1 year ago

FYI: I have got multiple reports from various people that that PPA version of Firefox just fails with Native Messaging. A manually installed version from a package works for some: https://support.mozilla.org/en-US/kb/install-firefox-linux#w_install-firefox-from-mozilla-builds-for-advanced-users

JohnQMetro commented 1 year ago

I have a similar issue, except I'm using Windows 11. What I've noticed is a pattern involving the KeepassXC window. The connection fails when you navigate to a login page and the window is minimized to the tray. If the window is open, things work properly.

bcm0 commented 1 year ago

On a Windows 10 PC I have the same problem with Firefox and already tried many things, new database, different software versions, new Firefox profile. Still, it only works with Microsoft Edge browser.

I followed the troubleshooting guide but Windows Process Monitor is difficult to use. The uninstall and reinstall of Firefox and KeepassXC didn't help. How to remove them completely including registry entries?

varjolintu commented 1 year ago

In some cases Firefox's automatic update makes something strange to the native messaging connection when the browser restarts. If you encounter something like this, try the following:

  1. Shut down Firefox and KeePassXC. Kill keepassxc-proxy process if active.
  2. Restart KeePassXC and then Firefox.
  3. If the connection still does not work, remove all connections from the extension and your database, and reconnect the extension.
bcm0 commented 1 year ago

Thanks, that doesn't help. I set the Windows Task Manager refresh rate to high and found that keepassxc-proxy.exe crashes immediately when I press refresh, so I started Windows Process Monitor and filtered by keepassxc parent process id. I have to say that this tool works quite well for debugging, but so far I haven't found any errors in the logs.

droidmonkey commented 1 year ago

Keepassxc would not be the parent process of the proxy. That would be Firefox (or Chrome or edge).

bcm0 commented 1 year ago

Yes I mixed it up. I chose Firefox as parent process.

bcm0 commented 1 year ago

In my case, the keepass-proxy.exe crash on Windows 10 is not related to keepassxc, keepassxc-browser or firefox. It must be a system file, a registry entry or a Windows security feature.

The order of registry calls and file accesses is different in every event log of Windows Process Monitor and it's difficult to find the issue. Do you know a tool like Windows Process Monitor that provides even more detail for Windows processes? Or is there a debug option in KeepassXC that logs everything keepassxc-proxy.exe is doing, so I can see exactly what happens when it crashes?

varjolintu commented 1 year ago

@bcm0 The only thing I've used in these situations is compiling a debug version of the proxy from source and attaching a debugger to the running process from Qt Creator. Process Monitor can filter the log by process if it helps.

varjolintu commented 1 year ago

Thanks, that doesn't help. I set the Windows Task Manager refresh rate to high and found that keepassxc-proxy.exe crashes immediately when I press refresh, so I started Windows Process Monitor and filtered by keepassxc parent process id. I have to say that this tool works quite well for debugging, but so far I haven't found any errors in the logs.

Only saw this now. I don't think the keepassxc-proxy.exe actually crashes. If you refresh the connection from the extension, native messaging launches a new proxy, and the old one is terminated. So this is normal behavior.

bcm0 commented 1 year ago

Only saw this now. I don't think the keepassxc-proxy.exe actually crashes. If you refresh the connection from the extension, native messaging launches a new proxy, and the old one is terminated. So this is normal behavior.

I know because I saw this behavior with Chrome and Edge. What I meant by 'keepassxc-proxy.exe crashes immediately when I press refresh' is that it tries to start and crashes. Of course no keepass-proxy.exe is running before because there is no way to keep it running longer than a split second.

When I start keepassxc-proxy.exe manually in cmd.exe using the command displayed in Windows Process Monitor it does not crash, but unfortunately Firefox doesn't recognize it and tries to start another instance as a child process which crashes.

attaching a debugger to the running process from Qt Creator

I'm not sure how this works because it seems impossible to attach to keepassxc-proxy.exe

varjolintu commented 1 year ago

@bcm0 Ah ok. In that case it would be difficult to attach to the process, unless there's a script or application that can wait for it to start and then attach to it immediately.

Have you tried if Firefox ESR, Developer Edition or just an older version of Firefox works?

bcm0 commented 1 year ago

I tried Firefox 107 and 117 and Firefox Developer Edition. Not sure if a DEBUG build helps because keepassxc-proxy source is very small https://github.com/keepassxreboot/keepassxc/tree/develop/src/proxy

varjolintu commented 1 year ago

@bcm0 If you want to compile a standalone proxy without KeePassXC, you can use this: re https://github.com/varjolintu/keepassxc-proxy

AryehGielchinsky commented 1 year ago

I'm using Ubuntu 22.04 Firefox 117.0.1 from the PPA (not snap) KeePassXC 2.7.6.

I have several computers that I setup with earlier versions of all 3 programs, and have upgraded to this current state, and they continue to work. I recently got a new computer, tried to do the same setup, and got the Key exchange was not successful. error.

The new computer works with Brave. I went through the troubleshooting guide, but couldn't figure out the problem.

I installed Firefox-esr from PPA (115.2.1esr) alongside 117, and it works on my new computer. For a few minutes Firefox 117 also worked after installing the ESR version, but after restarting it stopped working.

Both the Firefox 115 and 117 are synced to my Firefox account.

This seems to indicate a problem with Firefox 117, is there a way I can confirm? Has anyone opened a bug with them?

varjolintu commented 1 year ago

@AryehGielchinsky https://github.com/keepassxreboot/keepassxc-browser/issues/1784#issuecomment-1677998364

AryehGielchinsky commented 1 year ago

@AryehGielchinsky #1784 (comment)

Tried it. same behavior.

varjolintu commented 1 year ago

@AryehGielchinsky #1784 (comment)

Tried it. same behavior.

What did the strace output give you? Did you confirm the Identification Keys match without extension and database? If everything just stops working, it really doesn't make sense, unless the proxy process is somehow killed, AppArmor does something strange etc.. Sometimes the Firefox PPA just doesn't work but a version installed from here does. At this point it's hard to tell if this happens because of the Firefox PPA package itself, or is there some specific reason and this can be reproduced with multiple computers.

AryehGielchinsky commented 1 year ago
aryeh@beelink:~$ sudo strace -f -p $(pgrep firefox) 2>&1 | grep keepass
[sudo] password for aryeh: 
[pid  3050] <... sendmmsg resumed>[{msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="r.\1 \0\1\0\0\0\0\0\1\tkeepassxc\3org\0\0\1\0\1\0"..., iov_len=42}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=42}, {msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\306-\1 \0\1\0\0\0\0\0\1\tkeepassxc\3org\0\0\34\0\1\0"..., iov_len=42}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=42}], 2, MSG_NOSIGNAL) = 2
[pid  3050] recvfrom(111, "r.\201\200\0\1\0\2\0\0\0\1\tkeepassxc\3org\0\0\1\0\1\300"..., 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.53")}, [28 => 16]) = 74
[pid  3050] recvfrom(111, "\306-\201\200\0\1\0\2\0\0\0\1\tkeepassxc\3org\0\0\34\0\1\300"..., 65536, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.53")}, [28 => 16]) = 98
[pid  2841] openat(AT_FDCWD, "/home/aryeh/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json", O_RDONLY <unfinished ...>
[pid  2841] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid  2841] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid  2841] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid  2841] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy", {st_mode=S_IFREG|0755, st_size=35208, ...}, 0) = 0
[pid  2841] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid  3315] execve("/usr/bin/keepassxc-proxy", ["/usr/bin/keepassxc-proxy", "/home/aryeh/.mozilla/native-mess"..., "keepassxc-browser@keepassxc.org"], 0x7fb86979c400 /* 63 vars */ <unfinished ...>
aryeh@beelink:~$ which keepassxc
/usr/bin/keepassxc
aryeh@beelink:~$ which keepassxc-proxy
/usr/bin/keepassxc-proxy
aryeh@beelink:~$ firefox -v
Mozilla Firefox 117.0.1
aryeh@beelink:~$ which firefox
/usr/bin/firefox
aryeh@beelink:~$ cat /home/aryeh/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json 
{
    "allowed_extensions": [
        "keepassxc-browser@keepassxc.org"
    ],
    "description": "KeePassXC integration with native messaging support",
    "name": "org.keepassxc.keepassxc_browser",
    "path": "/usr/bin/keepassxc-proxy",
    "type": "stdio"
}

Filtering htop shows 12 instances of keepassxc, but not keepassxc-proxy. running keepassxc-proxy manually, htop shows 2 instances of keepassxc-proxy. the following is the strace when running keepassxc-proxy manually.

aryeh@beelink:~$ sudo strace -f -p $(pgrep firefox) 2>&1 | grep keepass
[pid  3926] <... sendmmsg resumed>[{msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\214\20\1 \0\1\0\0\0\0\0\1\tkeepassxc\3org\0\0\1\0\1\0"..., iov_len=42}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=42}, {msg_hdr={msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\257\22\1 \0\1\0\0\0\0\0\1\tkeepassxc\3org\0\0\34\0\1\0"..., iov_len=42}], msg_iovlen=1, msg_controllen=0, msg_flags=0}, msg_len=42}], 2, MSG_NOSIGNAL) = 2
[pid  3926] <... recvfrom resumed>"\257\22\201\200\0\1\0\2\0\0\0\1\tkeepassxc\3org\0\0\34\0\1\300"..., 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.53")}, [28 => 16]) = 98
[pid  3926] <... recvfrom resumed>"\214\20\201\200\0\1\0\2\0\0\0\1\tkeepassxc\3org\0\0\1\0\1\300"..., 65536, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("127.0.0.53")}, [28 => 16]) = 74
[pid  3755] openat(AT_FDCWD, "/home/aryeh/.mozilla/native-messaging-hosts/org.keepassxc.keepassxc_browser.json", O_RDONLY <unfinished ...>
[pid  3755] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid  3755] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid  3755] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid  3755] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy", {st_mode=S_IFREG|0755, st_size=35208, ...}, 0) = 0
[pid  3755] newfstatat(AT_FDCWD, "/usr/bin/keepassxc-proxy",  <unfinished ...>
[pid  4007] execve("/usr/bin/keepassxc-proxy", ["/usr/bin/keepassxc-proxy", "/home/aryeh/.mozilla/native-mess"..., "keepassxc-browser@keepassxc.org"], 0x7fe3c2ee7e00 /* 63 vars */ <unfinished ...>
[pid  4034] openat(AT_FDCWD, "/home/aryeh/.mozilla/firefox/z7fr4dg9.default-release/extensions/keepassxc-browser@keepassxc.org.xpi", O_RDONLY <unfinished ...>
aryeh@beelink:~$ ls -lt /run/user/1000/app/org.keepassxc.KeePassXC/
total 0
srwx------ 1 aryeh aryeh 0 Sep 19 10:17 org.keepassxc.KeePassXC.BrowserServer
aryeh@beelink:~$ ls -lt /run/user/1000/
total 4
lrwxrwxrwx 1 aryeh aryeh  80 Sep 19 10:30 org.keepassxc.KeePassXC.BrowserServer -> /run/user/1000/app/org.keepassxc.KeePassXC/org.keepassxc.KeePassXC.BrowserServer
...

about:debugging -> this Firefox -> inspect keepassxc-browser -> console (troubleshooting guide directions seems a bit off)

KeePassXC-Browser: Connecting to native messaging host org.keepassxc.keepassxc_browser [client.js:317:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/background/client.js)
[Error ] KeePassXC-Browser - Failed to connect: Unknown error [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error ] KeePassXC-Browser - No content script available for this tab. [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error keepass.js:262] KeePassXC-Browser - 5: Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings. [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
KeePassXC-Browser: Connecting to native messaging host org.keepassxc.keepassxc_browser [client.js:317:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/background/client.js)
[Error ] KeePassXC-Browser - Failed to connect: Unknown error [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error ] KeePassXC-Browser - No content script available for this tab. [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error ] KeePassXC-Browser - 9: Key exchange was not successful. [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error ] KeePassXC-Browser - No content script available for this tab. [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error keepass.js:262] KeePassXC-Browser - 5: Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings. [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error ] KeePassXC-Browser - No content script available for this tab. 2 [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error keepass.js:262] KeePassXC-Browser - 5: Cannot connect to KeePassXC. Check that browser integration is enabled in KeePassXC settings. 2 [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
KeePassXC-Browser: Connecting to native messaging host org.keepassxc.keepassxc_browser [client.js:317:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/background/client.js)
[Error ] KeePassXC-Browser - Failed to connect: Unknown error [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error ] KeePassXC-Browser - No content script available for this tab. [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error ] KeePassXC-Browser - 9: Key exchange was not successful. [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error ] KeePassXC-Browser - No content script available for this tab. [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
[Error ] KeePassXC-Browser - Cannot send activated_tab message: Could not establish connection. Receiving end does not exist. 5 [global.js:145:13](moz-extension://24370697-1221-4016-9dd4-b0368afb5e88/common/global.js)
AryehGielchinsky commented 1 year ago

Did you confirm the Identification Keys match without extension and database? How do I do that?

Here I get different results than the troubleshooting guide.

aryeh@beelink:~$ ps aux | grep keepassxc-proxy
aryeh       5936  0.0  0.0   9212  2432 pts/0    S+   10:50   0:00 grep --color=auto keepassxc-proxy
aryeh@beelink:~$ sudo strace -f -yy -e read,write -s 1000000 -p 6560
strace: attach: ptrace(PTRACE_SEIZE, 6560): No such process
aryeh@beelink:~$ keepassxc-proxy &
[1] 5943
aryeh@beelink:~$ ps aux | grep keepassxc-proxy
aryeh       5943  0.0  0.1 142700 14848 pts/0    Tl   10:50   0:00 keepassxc-proxy
aryeh       5946  0.0  0.0   9212  2432 pts/0    S+   10:51   0:00 grep --color=auto keepassxc-proxy

[1]+  Stopped                 keepassxc-proxy
aryeh@beelink:~$ sudo strace -f -yy -e read,write -s 1000000 -p 6560
strace: attach: ptrace(PTRACE_SEIZE, 6560): No such process
varjolintu commented 1 year ago

Did you confirm the Identification Keys match without extension and database? How do I do that?

In KeePassXC, go to Database Settings and select the Browser Integration page. Check if the Identification ID and name matches the one in your browser.

Did you check the AppArmor section of the Troubleshooting Guide?