-
Notifications
You must be signed in to change notification settings - Fork 577
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
keepassxc: please provide more options or more guidance #3329
Comments
Network access is already disabled via |
In the default configuration (nodbus commented out), neither clicking on an URL in KeePassXC nor auto-type using ctrl+shift+U works. I want them to work. So maybe my focus on dbus is wrong, something else needs to be changed or commented to change. |
You're right, in the default configuration, update-checking fails saying update error. So maybe add a comment saying "change this if you want update-checking to work". |
FYI: #3314
The issue here is, how to select the profile. IMHO we have two options
Almost all profiles do not support updates, because updates are usually install via apt, dnf, ….
You will need to allow firefox to
if you use chrome or something else it are the same point. |
I guess updates and update-checking are separate. Maybe add a comment to the profile saying "if you want update-checking to work, un-comment the following:" |
I am not running the browser (Firefox) under Firejail. If I run KeePassXC without Firejail, clicking URLs and auto-typing work. If I run KeePassXC under Firejail, they fail. So I think the issue is with the KeePassXC profile. |
Yes, it is. KPXC will start your default handler for e.g. |
Try this keepassxc.local
|
I added those lines in keepassxc.local, and with KeePasseXC running in Firejail:
So do I have to run Firefox inside Firejail for this to work ? I'm running Firefox without Firejail. |
Is firefox running in at this time? are there any other modification on the keepassxc profile/local? |
Yes, FF is running. No, nothing else but comments in keepassxc.local A year ago I was messing with my keepassxc.profile, but I think by now it's been overwritten by latest standard version. ls says it's 1383 bytes, Dec 30 2019 20:40 keepassxc.profile |
What does "be present in the sandbox: private-bin firefox" in a previous comment mean ? I'm not running FF inside Firejail. |
keepassxc will call firejail's |
Comment about the ssh-agent issue.
For me the first line was not enough, I had to comment in all lines (haven't checked if a subset might be enough, though). |
Trying again. Now I'm in Fedora 34 KDE with X. I did the keepassxc.local changes you gave. I run "firejail --debug keepassxc DBNAME", open database, click on a link, get this on CLI:
Now I'm using KeePassXC 2.6.4 with Firejail 0.9.64.4. KeePassXC and Firefox are natively installed; no appimage, snap, flatpak. KP works fine if Firejail is not used. I also filed keepassxreboot/keepassxc#6637 |
If
Good to know, that xdg-open is used. xdg-open is a shell-script, try
|
FWIW there as been done some more on "open-links-from-firejailed-applications" since 9 Apr 2020. #3919 and #3471 and #3881.
|
KP works fine with --noprofile. I changed keepassxc.local to be:
And KP fails differently now. When I click on a link, instead of an error on the CLI, I get an error dialog from "KIO Client" saying "unknown host: THEURL host name not found" or words to that effect. |
Looks like KIO is involved in some way (inside the sandbox) and wants internet access:
|
Okay, now keepassxc.local is:
and when I click on a link, I get a dialog saying "Your Firefox profile could not be loaded, it may be missing or inaccessible". But I have an instance of FF running in the background. Without Firejail on KeePassXC, links will open in FF just fine. |
If |
works, it lists the dir. I guess I'll try commenting out all dbus stuff in keepassxc.profile ? |
It's something in disable-programs.inc that's doing it. If I comment out the include for that, KP works. Have to get back to a clean state and make just that change, re-verify. |
Okay, so it's working with stock keepassxc.profile BUT with disable-programs.inc commented out, AND with keepassxc.local containing:
|
Then you can fiddle around with |
Running with --trace shows a suspicious message "20:keepassxc:mkdir /run/user/1000:-1". 1000 is my userid. How can I allow access to that dir ? Or maybe that's the wrong idea. The lines from --trace when I click a link are:
|
It's very very very likely accessible from inside the sandbox. This line just says that |
There is a sizable (5-second ?) pause between the trace line "xdg-open" and the line "Cannot open trace log file". I wonder if some kind of mime-type or protocol-handler lookup is failing. But I don't see anything named "xdg*" or "kio*" or other relevant names in disable-programs.inc |
If a program crashes, the last (to all) lines of |
Okay, I'm confused about something. disable-programs.inc is full of "blacklist" statements. I copied it to disable-programs.local and changed every "blacklist" to "noblacklist". I thought that would negate every line in disable-programs.inc, but it didn't (KP still doesn't work). How do I negate a "blacklist" line ? |
Assuming disable-programs.local is included (no typo or so, check top of |
Okay, here's a good one: |
Okay, looks like Firefox is being launched inside the KP firejail, so adding this to keepassxc.local made it work:
|
That's true, but if firefox is already running (in it's own sandbox) it usually communicates to this instance to open a new tab/window. At least until now this worked without access to it's cache. ... anyway |
Didn't mean to close the issue; can it be re-opened, please ? |
Confirmed that noblacklist of .cache is needed if an instance of FF is running already. Will check case where FF is not already running. |
Then FF will start in the KPXC sandbox and totally fail becaus of seccomp, tracelog, blacklist /usr/libexec, ... |
Yes, checked case where FF is not already running, and it dies horribly. Browser window opens but never loads the page, underneath it seems to be copying my FF profile, and then FF crashes. Is this a known limitation of Firejail or something ? |
So, I have it working if FF is default browser and an instance is running and click on a link in KP. But can't do same with either Brave browser or ungoogled-chromium. I tried noblacklist of all their config stuff, but still they're failing silently if they're default browser and a browser instance is running and then I click on a link in KP. |
For chrom* you need to
|
Without workarounds (#3329 (comment)), firefox is started in the keepassxc sandbox. If there is a running firefox instance, firefox just does early startup tasks (parse commandline, find profile, ...) and communicates to the running instance. If not, it does a full startup inside the kpxc sandbox. Starting program A in the sandbox made for program B will fail if A requires a permission that is blocked (because B does need it). |
Okay, the chrom* statements you gave me sort-of worked. If Brave or ungoogled-chromium is default browser and an instance is running, clicking on a link in KP opens another instance of the browser (should use existing instance) and shows some error messages about unable to read profile and want to restore session, but does open the right page. I think if no instance is running and click on a link, instance is launched and page loaded with no error dialogs. |
Yes, this seems to be a key lack in Firejail. There should be some directive to say "launch-outside-sandbox xdg-open" or something. So whenever KeePassXC or anything launches xdg-open, xdg-open is run outside sandbox, and browser ends up getting launched outside. |
You can use Related: #3785
See xdg-open.c or firejail-handler-http workarounds above. |
Would that mean changing the source code of KeePassXC to do that ? I'm a user, not the dev.
The "escape" would be limited to "send this URL out to be opened in whatever app is supposed to be able to open it". |
One option, however we can not add such firejail support in every app. Therefore it needs to be somewhere else. And
👍 That already possible with xdg-open.c or firejail-handler-http. |
Support is being worked on upstream. KeePassXC already has the changes is You also need a proxy with these changes: varjolintu/keepassxc-proxy-rust#10
This seems really out-of-scope for a password manager, and requires giving it Regarding opening URLs in the browser, we have a few options:
Perhaps an alternative implementation of the xdg-desktop-portal would help us |
Expected behavior
There are several ways or desired ways of using KeePassXC:
Please provide comments in the KeePassXC profile, or additional profiles, to support each of these choices. For example, I would like to run the app without browser extension, without update-checking, with secret service, with SSH agent, with auto-type. I think that means I could run with all network access disabled, but dbus has to be enabled ? Not sure. I want to lock down KeePassXC as tightly as possible given these choices. Please provide more commented sections in the profile, or more profiles, or something, to aid in this. Thanks.
Desktop:
Additional context
KeePassXC 2.5.3
The text was updated successfully, but these errors were encountered: