keeweb / keeweb-connect

Browser extension for KeeWeb
MIT License
93 stars 13 forks source link

Cannot connect to KeeWeb / Firefox #28

Open Jobode opened 3 years ago

Jobode commented 3 years ago

I installed the KeeWeb app and turned on Firefox browser integration under the Browser settings. Then installed the keeweb addon under Firefox. Under connection then the option "using the native app" brings me the error message: Cannot connect to KeeWeb, please check if KeeWeb is open and browser integration is enabled in settings. (it is...) Other addons like floccus or ublock work fine. What could be the error? The "web-only" connection works.

I use Firefox 91.0.2 (64) on Windows 10 / KeeWeb v.1.18.7

zbyna commented 3 years ago

Seems like I have a similar problem, maybe the same: I run KeeWeb, then Firefox, when trying to use KeeWeb: after re-enabling this: everything works well.

Log before re-enabling:

[INFO ] 2021-08-30T16:19:00.981Z [start-profiler] Electron app started in 2641ms: loading app requires=13ms, single instance lock=1ms, portable check=0ms, userdata dir=0ms, defining args=0ms, setting env=1ms, loading settings key=221ms, app on ready=44ms, reading app settings=27ms, creating main window=173ms, configuring main window=59ms, restoring main window position=0ms, setting ipc handlers=55ms, setting global shortcuts=1ms, subscribing to power events=0ms, setting request handlers=0ms, main window ready=448ms, main window shown=1ms
[DEBUG] 2021-08-30T16:19:00.986Z [settings-manager] Theme changed dark
[INFO ] 2021-08-30T16:19:00.990Z [usb-listener] Starting USB listener
[DEBUG] 2021-08-30T16:19:00.990Z [native-module-connector] Starting native module host
[INFO ] 2021-08-30T16:19:01.143Z [start-profiler] App started in 754ms: fetching=309ms, pre-init=438ms, loading modules=111ms, document ready=12ms, creating app model=3ms, loading configs=29ms, initializing modules=2ms, loading remote config=2ms, checking features=3ms, initializing storage=0ms, starting usb=0ms, first view rendering=152ms, app ready event=0ms
[INFO ] 2021-08-30T16:19:01.655Z [browser-extension-connector] Started
[INFO ] 2021-08-30T16:19:04.755Z [open:Database1] File open request
[INFO ] 2021-08-30T16:19:04.756Z [open:Database1] Open file from storage file
[INFO ] 2021-08-30T16:19:04.756Z [open:Database1] Stat file
[DEBUG] 2021-08-30T16:19:04.756Z [storage-file] Stat /media/icko/Zal_hav_SSD/Documents and Settings/decak/Database1.kdbx
[DEBUG] 2021-08-30T16:19:04.763Z [storage-file] Stat done /media/icko/Zal_hav_SSD/Documents and Settings/decak/Database1.kdbx 7ms
[INFO ] 2021-08-30T16:19:04.763Z [open:Database1] Open file from storage (1628186785636, local 1628186785636)
[INFO ] 2021-08-30T16:19:04.763Z [open:Database1] Load from storage
[DEBUG] 2021-08-30T16:19:04.763Z [storage-file] Load /media/icko/Zal_hav_SSD/Documents and Settings/decak/Database1.kdbx
[DEBUG] 2021-08-30T16:19:04.766Z [storage-file] Loaded /media/icko/Zal_hav_SSD/Documents and Settings/decak/Database1.kdbx 1628186785636 3ms
[INFO ] 2021-08-30T16:19:04.766Z [open:Database1] Open file from content loaded from storage
[INFO ] 2021-08-30T16:19:05.190Z [file] Opened file Database1: 422ms, 6000 rounds, 549 kB
[DEBUG] 2021-08-30T16:19:05.190Z [app] Add last open file 47460f64-61d3-fc90-2ea3-30c32d34d7f0 Database1 file /media/icko/Zal_hav_SSD/Documents and Settings/decak/Database1.kdbx 1628186785636
[DEBUG] 2021-08-30T16:19:05.303Z [storage-file] Watch dir /media/icko/Zal_hav_SSD/Documents and Settings/decak

Log continuing after re-enabling:

[INFO ] 2021-08-30T16:47:02.625Z [browser-extension-connector] Stopped
[INFO ] 2021-08-30T16:47:02.625Z [browser-extension-connector] Disable Firefox KWC
[INFO ] 2021-08-30T16:47:07.982Z [browser-extension-connector] Started
[INFO ] 2021-08-30T16:47:07.982Z [browser-extension-connector] Enable Firefox KWC

Continuing of log after successful use of keeweb-connect addon:

INFO ] 2021-08-30T16:49:14.100Z [browser-extension-connector] New connection with socket 1
[DEBUG] 2021-08-30T16:49:14.102Z [browser-extension-connector] Init connection 1 {"pid":4039,"ppid":3029,"origin":"keeweb-connect@keeweb.info"}
[INFO ] 2021-08-30T16:49:14.118Z [browser-extension-connector] Socket 1 activated for app: "Firefox-bin", extension: "KeeWeb Connect", pid: 4039, ppid: 3029
[DEBUG] 2021-08-30T16:49:14.119Z [browser-extension-connector] Extension[1] -> KeeWeb {"action":"change-public-keys","extensionName":"KeeWeb Connect","version":"0.3.6","publicKey":"ojV3YwxBK0plO................xG+Y495Ta/Uc=","nonce":"Ej6Ea6/..........Lvwp3/yO35zeABV+b","clientID":"25Jmv9Kamv/iu7uvAXCNNUCYDxSBqiQZ"}
[INFO ] 2021-08-30T16:49:14.140Z [browser-extension-connector] New client key created 25Jmv9.....................UCYDxSBqiQZ 0.3.6
[DEBUG] 2021-08-30T16:49:14.142Z [browser-extension-connector] KeeWeb -> Extension[1] {"action":"change-public-keys","version":"1.18.7","publicKey":"0KFVa7JvNQ...........jFUysN7XI=","nonce":"Ez6Ea6/351gATs8Lvwp3/yO35zeABV+b","success":"true","appName":"KeeWeb"}
[DEBUG] 2021-08-30T16:49:14.147Z [browser-extension-connector] Extension[1] -> KeeWeb {"action":"ping","data":"Kt3nTz9l+qO8/g=="}
[DEBUG] 2021-08-30T16:49:14.149Z [browser-extension-connector] KeeWeb -> Extension[1] {"data":"Kt3nTz9l+qO8/g=="}
[DEBUG] 2021-08-30T16:49:14.178Z [browser-extension-connector] Extension[1] -> KeeWeb {"action":"get-logins","message":"KBaKZ..............5Q+KWY0e1C............KIqZZX0d8/uG1ivqNYXBoZAGXUJHsD+Qwtek8qDIGaMYE9vscb5IybKkNSqIvol1099dM2LEA.........MK2U75A=","nonce":"7bBXPy45oa..............u1sbWS/DmK","clientID":"25Jmv9Kamv/iu7uv...........xSBqiQZ"}
[DEBUG] 2021-08-30T16:49:20.010Z [browser-extension-connector] KeeWeb -> Extension[1] {"action":"get-logins","message":"JBTHqDntkQ8alCPI0pCKoOKupV9u6VoRhn............7M62FL7KjpuMT1uGAEuFHOOu1n7zc1GACrMAq9SJ84601DZY1MN3aMZG..............RSmLo6oO6fPt+lI6O5F32HLp1J1zBBG3bVPn6J9pb/Dy2hgpgAUrHGtLYajj8Iba...............NgbZEzI3d6/06ypVs+/NtdF6FBRUN0UHuQ6uyrYTPFF/fKp4mSEilXVNtEaHJea0jFRCQTtnwg+fWW/9Qv1xaNhby/Qeb35Ucm2eyHnlTAlEwcCdzFYyt6QRAUpnKbLhpVJu43/ZS/MgYeAONMREZkgwEp1XAw4hlXig4DrR4zj9UrJ.............GyUB+0zanTxzf5HUDOP+E+9t8i1j86Ni0BE0aHrtfwELSUWxivMBrVkaP+KjYIYu7bc7GmTf6LNWey2Q9AS4IC7o0ALd+gYO1McCZ1zP26VF+MBlvbqy0lAQ==","nonce":"7rBXPy45oayZoMAadfAD............/DmK"}
KeeWeb 1.18.7
Firefox 91.0.2
KeeWeb Connect 0.3.6 EDIT: the same behaviour with 0.3.7
Linux zbyna-MS-7681 4.8.17-040817-generic #201701090438 SMP Mon Jan 9 09:40:28 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Jobode commented 3 years ago

ok, very strange actually: I just did exactly the same installation on my notebook at home, and here it runs without problems. I'll do another installation on my desktop PC later. Let's see if it works there too.

Can console data from Firefox be helpful to find out why it works on one computer and not on the other?

Jobode commented 3 years ago

I think I have found the problem. The problem occurs when you want to install KeeWeb and KeeWeb Connect on a multi-user Windows system. On my notebook there is only one user with the typical administrator account. There everything works.

However, when I try to install KeeWeb on Windows 10 as a default user, I get this error message: KeeWeb_setub_standard-user

So then you normally install the program with the right mouse button -> context menu -> run as administrator. That works so far. But if you start KeeWeb and activate the browser integration and install the KeeWeb Connect Plugin under Firefox, the file "native-messaging-kwc.firefox.json" is created under the admin account (->User ->AppData->Roaming->KeeWeb) and NOT as it should be under the default user "Jo" (->User->Jo->AppData->Roaming->KeeWeb).

KeeWeb_setub_standard-user_3 KeeWeb_setub_standard-user_4

So the installation routines from KeeWeb are probably not programmed very well? As a workaround, you can make the Windows default user to a user with administrator rights for a short time and then install KeeWeb and the Firefox plugin. However, after configuration the connection does not work until you restart KeeWeb. Probably a important thing too is to remove all program residues before reinstalling, also the KeeWeb directory under User -> Appdata -> Roaming-> KeeWeb for the standard user and the admin user. When everything is set up and working, you can change the user back to a standard user.

zbyna commented 3 years ago

OK. I will check on my Linux installation. I am out of my computer now.

zbyna commented 3 years ago

My issue seems to be different:

Firefox console log before re-enabling checkbox:

21:12:20.202 File at path "/tmp/.mount_KeeWeb1bsF11/keeweb-native-messaging-host" does not exist, or is not executable 2 Subprocess.jsm:152
    call resource://gre/modules/Subprocess.jsm:152

Firefox console log after re-enabling checkbox:

21:44:04.329 Connecting to KeeWeb background.js:600:17
21:44:04.364 -> KW 
Object { action: "change-public-keys", extensionName: "KeeWeb Connect", version: "0.3.7", publicKey: "aGYuOiE2U....................Fs+PTowsIINk4XYBkcZyCjk=", nonce: "AgyY/vxSw...............bEysSk1ZV6", clientID: "fObNt..............Dh4UQXoY" }
background.js:692:17
21:44:04.480 <- KW 
Object { action: "change-public-keys", version: "1.18.7", publicKey: "5QD7aEWo.................QBVEfVjjATTbEk=", nonce: "AwyY/vxSw8zYH9leIl..................6", success: "true", appName: "KeeWeb" }
background.js:697:17
21:44:04.481 Connected to KeeWeb background.js:616:21
Xenion1987 commented 3 years ago

I had the same issue:

  1. Installed Windows an a new Device
  2. Installed my common stuff (KeeWeb is part of that)
  3. Trying to log into a website and got the same error message @zbyna showed in the first screenshot

After reading your comments, I took a look at the process list in the taskmanager and could not find the application keeweb-native-messaging-host.exe. So i tried to exdecute it manually and got an error message, that VCRUNTIME140.dll was missing.

After installing the related C++ runtime and a reboot, it worked as expected.

Where to download: support.microsoft.com

EDIT: I had the same issue on Chrome and Edge. Installing the C++ runtime fixed it for all browsers. So this issue is not related to Firefox only.


Jobode commented 3 years ago

I can confirm this additional solution. I have tried this on another Windows multi-user system. It is interesting that my first solution of changing user rights works without installing the C++ runtime. But your solution is certainly much simpler. Thank you very much.

antelle commented 3 years ago

Hi! @Jobode did you also run KeeWeb as Administrator (or just installed as Administrator and ran as a regular user)? It you run it as your regular user and then check the Firefox checkbox, does it create the manifest?

MysteriousChallenger commented 1 year ago

My issue seems to be different:

* I am using KeeWeb in `AppImage` format, it means that `every single launch` extract application to `unique path in tmp` directory

* there is a file  `/home/zbyna/.mozilla/native-messaging-hosts/net.antelle.keeweb.keeweb_connect.json` which contains the path to the `keeweb-native-messaging-host`
  ![](https://camo.githubusercontent.com/1807a977bb050f19b6e5963b765bc1a8b762c0d5ee00d1bfffba2109b0619149/68747470733a2f2f692e696d6775722e636f6d2f387668726447792e706e67)

* turning off and on of  the checkbox in Settings / Browser / Firefox will update path to `keeweb-native-messaging-host` in ` net.antelle.keeweb.keeweb_connect.json`, and then it works well

Firefox console log before re-enabling checkbox:

21:12:20.202 File at path "/tmp/.mount_KeeWeb1bsF11/keeweb-native-messaging-host" does not exist, or is not executable 2 Subprocess.jsm:152
    call resource://gre/modules/Subprocess.jsm:152

Firefox console log after re-enabling checkbox:

21:44:04.329 Connecting to KeeWeb background.js:600:17
21:44:04.364 -> KW 
Object { action: "change-public-keys", extensionName: "KeeWeb Connect", version: "0.3.7", publicKey: "aGYuOiE2U....................Fs+PTowsIINk4XYBkcZyCjk=", nonce: "AgyY/vxSw...............bEysSk1ZV6", clientID: "fObNt..............Dh4UQXoY" }
background.js:692:17
21:44:04.480 <- KW 
Object { action: "change-public-keys", version: "1.18.7", publicKey: "5QD7aEWo.................QBVEfVjjATTbEk=", nonce: "AwyY/vxSw8zYH9leIl..................6", success: "true", appName: "KeeWeb" }
background.js:697:17
21:44:04.481 Connected to KeeWeb background.js:616:21

@zbyna, I had this exact same issue while using both AppImage and Linux.x64 releases, needing to recheck the browser integration box every launch. I "fixed" this by just running KWC myself whenever I start Keeweb. You can get it by downloading the linux.x64 release rather than the appimage.

keeweb-native-messaging-host /home/<username>/.mozilla/native-messaging-hosts/net.antelle.keeweb.keeweb_connect.json keeweb-connect@keeweb.info

I added that to my own .Desktop, and it appears to work great. The KWC process even dies when keeweb is closed