Repository navigation
[PM-990] Unix biometrics unlock via Polkit - #4586
Conversation
|
Thank you for your contribution! We've added this to our internal Community PR board for review. |
|
Ok there seems to be an issue still with accounts that do not have biometrics enabled. On my first test account it works great, on my other 2 test accounts it does not work. Need to triage this. |
Actually nevermind, it works just fine. The problem was that due to the lack of UI feedback with just fprintd, I didn't realize I had to authenticate my fingerprint to enable the setting. |
|
Hmm, we could also use polkit instead of PAM directly. This would then be system level authentication, instead of biometrics directly. If the user has biometrics configured, that will be used, if not it will prompt for system password. Also this has native GUIs on most desktop environments so it would be a more integrated experience. |
Yeah I tested with kde polkit agent and gnome polkit agent and they provide a better experience. I will have to update this PR to use polkit. |
This is the polkit policy that needs to be installed for it to work. I'm not entirely sure how to best do this with electron builder, didn't find a build-in function for this. Maybe someone from the team can share some insight? On some platforms we could use the afterInstall options / afterRemove options, and on the others just disable it and document for the user to set up this polkit policy themselves if they want this feature to work? |
|
One note: Biometrics for browser extensions will not work if:
This is unrelated to this pull request, but due to how native messaging works, and how flatpak/snap sandbox applications. There is an open pull request for xdg-desktop-portal support which might fix this: Aside from that, I tested AppImage to correctly work with the desktop application, and I expect the same to be the case for the other formats which don't have special sandboxing. |
|
Thank you so much for doing this! |
|
Any plans on getting this merged? |
|
+1 |
|
Well, from my side this is mostly good to go. The only thing missing is a way to get the Polkit policy installed. I looked at electron builder's options for this but this will only work on some package formats. The electron builder documentation isn't entirely clear on this (it lists some, but not .deb for example, but then fpm supports .deb again). AppImage won't work at all using this method (and seems to be the default recommended installation option on the Bitwarden website). Another option is to install this policy during runtime (when the user first activates biometrics). This would require elevating privileges with polkit, but should not be an issue. I need input on which approach the Bitwarden team would prefer here. On another note, since I didn't want to have the desktop app and IPC proxy constantly running in the background, I've re-implemented (a subset of) the protocol in a single go application. Other than that it works in the same way (biometrics with polkit, secret stored in the system's secret service). In case this is also useful to someone following this thread here is the link: |
|
Let's hope this gets merged as soon as possible |
|
Thank you for this, @quexten. Please know that I've had literally daily reminders to get information to you as soon as possible once the security work related to overhauling biometrics was done and merged. That work changes the API around biometrics pretty significantly. Linux will have similar security model issues that Windows does in that security is entirely user-based. DBus in particular offers difficulties. Any application running as a user has unfettered access to messages -- that's kind of the point. Therefore, we need messages to be encrypted secrets rather than plaintext like there are here. We can do that in at least one of two ways
I also don't know of any way to use polkit or libsecret to do an analogous user key signing we're doing for Windows -- do you? If we can't find a way to do the same kind of challenge signing, we'll have to require an alternate unlock on app start and use the established client-key-half method as a non-optional requirement. |
|
Thank you for the update on this @MGibson1!
Yeah I was also concerned about this when writing the PR but did not want to introduce changes in how the secrets are stored/derived in this PR. I had a brief look and very much agree with the changes in your linked merged PR though.
No, polkit only checks whether a user is allowed to do something, libsecret does not protect against attacks from the user's session. So using them directly in the rust desktop library to do this is not possible as far as I can tell. That being said, I do have a suggestion of how to still implement this behaviour below. Assuming I understand the requirements correctly, getting a symmetric encryption secret, not accessible by the user session, locked behind biometrics, there are two additional approaches I could think of:
Of course the approach you listed of requiring an alternative unlock method (the master password/pin) at least once on startup would also work and be the simpler one implementation wise. |
|
Hi all, Since we're already messing with system config (PAM initially, now polkit), another option could be to do something similar to pam_gnome_keyring.so (it tries to unlock the gnome keyring on login using the user input password) We could implement something in the same vein to derive an encryption key from the user password and pass it to a daemonized bitwarden service. This requires that the users opens its Desktop session with password (not biometrics), but this is already an issue with gnome keyring (if you log in with biometrics, you have to manually unlock your keyring with your password afterwards). I personally use pam_fprintd for everything but graphical login (session unlock, console login, sudo,...) Another solution I would be fine with is to just warn the user that enabling bio unlock will lower the security. Regards, |
|
Those are all interesting options.
I like this approach, but, as you point out, it's not sufficient for the same reasons Windows UWP isn't a solution. The threat model is from non-sandboxed applications and since it provides no sandboxing from those applications, it really only provides security for systems which exclusively run Flatpak. I don't know of any that have invested that far.
This is an interesting approach, but I'm unsure about delivery. I'm not familiar enough with our distribution channels to know if we could have this separate executable bundled across all of them. We could rework the download experience to be an installer-type thing... Is it possible to enable this kind of functionality by executing sub-processes from the electron main thread as a part of the native messaging library? I'm thinking the effect would be something like running. sudo -u bitwarden cat ./biometric-signing.crtPlease forgive my ignorance here, this is all pretty exploratory for me.
I'd like to avoid a daemonized process if we can. We could enable other great features (like getting rid of session tokens in CLI) that I've thought though in the past, but requiring one is also a barrier to entry that would be good to avoid. I think the guaranteed way forward will be to wire up a non-optional If you're more interested in fleshing out the above ideas, totally cool. My point is that I'd also entertain a PR dedicated to just enabling biometric after first unlock on Linux. |
This would be simple enough for native packages like DEB and RPM, but I don't think it's feasible for bundled and sandboxed versions like AppImage and Snap. Aside: Is there an official Flatpak version of Bitwarden? I see com.bitwarden.desktop on Flathub, but I don't see it mentioned on the website at https://bitwarden.com/download/. |
Yeah, agreed.
I'm OK with just making this PR only enable biometrics after first unlock. Improvements can come in a separate PR. Some more points on how biometric unlock could work without the additional unlock on boot requirement (for a separate PR):
Yeah, that's the idea. Sudo works by being owned by root, and having the suid flag set. Thus the effective user id gets switched to root. In case of "-u bitwarden" sudo would then switch from root to the bitwarden user and execute cat. In this case it could then read the signing cert. I don't believe we can just use sudo though, since this is missing the biometrics check (unless the user specifically configures pam modules), so we would have to enter the user's password in the app and pass that to sudo. If we wanted to just use existing executables, then An issue here would be that the polkit message is unintuitive. Instead of something like "authenticate to unlock bitwarden", it is: Compared to using a custom polkit policy (which is used in the current PR): Given this, a small binary that is owned by the bitwarden user, and has the suid bit set would be a nicer solution as it doesn't require sudo permissions, and have a nice authentication message. In that case, the native messaging library would call something like: I have not looked at all of the packaging formats, but given that the node ipc proxy is also a separate process (in appimage this runs under a directory under /tmp f.e), I don't think this should be an issue?
I believe you meant Flatpak and Snap, since AppImage isn't really sandboxed. Regardless, even if it doesn't work with them (which I have not verified/tested), we could fall back to unlock with another non-biometric factor on startup in that case. Also, I'm not sure if Flatpak and Snap will work with biometric authentication at all, since I would expect polkit to be sandboxed away, and I do not see an xdg portal or similar for it. 1Password does no offer biometrics (system authentication) on snap/flatpak f.e. On these systems I would just set biometrics available to false for now, and a separate PR could update that in the future.
This is a community provided wrapper. The very bottom of the FlatHub page says:
|
dc5f414 to
3a7aaa2
Compare
|
When I force-pushed the re-base of this PR for the reworked desktop biometrics, some automation in GitHub requested a review, but this is not ready for a review so I have converted the PR to a draft for now. |
|
@pedrocleis The Arch package. See https://gitlab.archlinux.org/archlinux/packaging/packages/bitwarden/-/issues/2. I can't remember if 2024.8.0-2 actually fixed it, but 2024.9.0-1 certainly did. |
|
Thank you, @yochananmarqos |
doesnt seem to be fixed for me |
|
I wanted to give this a shot on mint 22 with Brave browser. clients/apps/desktop/src/main/native-messaging.main.ts Lines 193 to 213 in f2be150 So with a little workaround it's now working as it should (google-chrome not installed): Would be nice if more chromium based browsers will get supported by the client. I have created an issue on github here: #11750 |
|
❓ Where do I find the information on how to do the setup manually, on the website linked the information doesn't seem available. |
|
anyways, firefox seem to work? |
|
My problem is that I can't enable biometrics support in the desktop app. I get the "Automatic Setup not available" error as seen in the screenshot in the merge request description. |
|
@Vcele What distro/packaging format are you on? |
I was using Nix package manager on Nixos |
|
The package version there is 2024.9.0 if that helps. |
|
Ok I was able to fix it with this |
|
I'm not sure what nix does, but manual setup will soon be unnecessary entirely. It was meant for just flatpak, but that is not needed anymore with #12007 which adds both autosetup for flatpak, and also makes setup optional entirely by using a fallback policy. So it should work out of the box (soon). |
|
Is there a way (besides manual setup) to change the policyPath? |
|
Hi, I've got the biometrics to work with the BitWarden AppImage desktop version but I'm unable to use with Firefox, I'm using AppImageLauncher (saw it on the BitWarden's downloads page). I'm currently on:
This is the error I'm getting: I've got this to work on another version of Ubuntu, but I don't remember how I did. I saw that on the BitWarden's Help Center it says:
Do I have to use Chromium-based browser for it to work? @jankatins links says he's using Firefox and I got it to work with Firefox some months ago too. EDIT: searching for logs, in ~/.config/app.log it has:
This could be the issue, I ran which firefox and got this:
|
|
Same here, doesn't appear to be working anymore, as discussed in #12697 |
|
Replying to my previous post, I finally got it to work. |
|
I’m using Bitwarden on Ubuntu 24.04.3 LTS (Kernel 6.14.0-33-generic, x86-64) with Microsoft Edge 141.0.3537.85. After installing the Bitwarden desktop app from Snap, I received the message: “Browser integration not supported — unfortunately browser integration is currently not supported in the Linux version.” This means I can’t use biometric unlock in the browser, which makes everyday use much harder. It works fine on Windows and macOS, so it’s disappointing that Linux users are missing out on this core feature. Please consider adding browser ↔ desktop integration support for Linux — many of us rely on Edge or Chromium-based browsers for work, and this would make Bitwarden far more seamless to use. Thank you for your great work maintaining Bitwarden, and I hope this feature can be prioritized soon. |
|
Hi @Zujaj have you tried the .deb for the Ubuntu version? |
|
I did some prototyping before, and it's possible but rather complex to add support for snap and flatpak, both when considering the desktop app running sandboxed, and when considering the browser running sandboxed. Hopefully I'll find some time to split these out into individual PR's to get them merged: #14836 |
|
ty so much @quexten i know that you are quite busy nowadays |
Sorry couldn't get back, can you share link to the .deb file? I couldn't find it in Release |
No problem, mate |
Screencast.from.2025-10-22.17-30-53.webmNope that didn't work as expected.
|
|
Sorry I was quickly checking this, but it seems the wrong approach: the biometric unlock should happen via fprintd API directly, not via polkit (and potentially PAM)! |
|
@3v1n0 System Unlock (That's what "biometrics" is called on Linux) supports polkit, since polkit also supports (That said, it may be worth it to add an alternate fprintd backend, since it doesn't require installation of a policy, which would make at least flatpak support easier.) Is there any specific problem you see with polkit? (Specifically security would be a point of interest here?) |
|
Speaking with the fprintd maintainer hat here, FWIW:
Well, if we want to support biometrics of any sort, we should use specific protocols (so howdy and fprintd) one, not the generic PAM one that is just "whatever the user has configured on system". Not to mention that by default the greatest majority of distros do not enable pam_fprintd.so (and for a good reason) by default.
It's very hacky, but this can fill the gap.
And not only, which is making the "biometrics unlock" just a system-authentication system unlock.
I was always interested in defininig a more generic biometrics API in freedesktop space, but so far I've been blocked by technical limitations of all the methods we have at the moment.
So, my main concerns are:
Then, there's a more generic one that is an architectural problem that we have with fingerprint or face recognition or any other similar kind of authentication system in linux: these are all "Yes/No" authentication systems and do not provide a secret to unlock a vault. While ideally we should have a system security enclave that generates a secret that we can safely release with a biometric device and eventually use this secret to unlock the password vault (something is in the works for this though). |
|
Thank you @3v1n0 for your input on this. That certainly makes sense. I wish Linux had a good biometrics API we could switch to -- I had started a discussion on a local authentication portal here: flatpak/xdg-desktop-portal#1275 - but at some point did not continue the discussion. As to this part:
That's why currently on linux, biometric unlock is only available after first unlock, whereas on mac / (windows with ugly hacks) it is available before first unlock. The secret - after first unlock - is held in Could you expand on this / provide a pointer to where this is happening?:
If we had something similar to MacOS, where we have a keyring like service that biometrically locks items, that would be the ideal solution from my point of view. |




🎟️ Tracking
https://bitwarden.atlassian.net/browse/PM-990
📔 Objective
Implements biometrics / "system authentication" via polkit over dbus. Since there is no local authentication portal (flatpak/xdg-desktop-portal#1275) yet, this requires manual (or automatic) setup of polkit policies with admin privileges. Setup is done automatically where possible, and users are directed to a guide when needed with warning messages. Since we do not have secure persistent storage available on linux, we only enable this after first unlock.
NOTE: This does not yet fix browser integration for snap/flatpak installations. This can also be done, but requires re-thinking the setup a bit. A manual setup step placing a script called by the browser extension, which dynamically looks up the installation type and calls it, would fix this. But that is out of scope.
May 2024 update since the PR was stale fore quite a while, brought it up to date, with automatic setup, installation detection, and manual setup instructions for sandboxed installations.
Code
In the rust code, zbus is added as a dependency to interact with dbus/polkit. We eventually need this either way if we want to interact with other dbus interfaces (idle/lock screen on gnome). Further, since zbus calls need to be async, the biometric trait needs to be be converted to use async traits using the
async_traitcrate.Screenshots
Screencast from 2024-07-11 13-41-08.webm
Screencast from 2024-07-11 14-19-08.webm
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:) or similar for great changes:memo:) or ℹ️ (:information_source:) for notes or general info:question:) for questions:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:) for suggestions / improvements:x:) or:warning:) for more significant problems or concerns needing attention:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt:pick:) for minor or nitpick changes