mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #1632] private-bin and symlinks to non-standard paths #1096
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#1096
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @aayla-secura on GitHub (Nov 5, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1632
It's kind of common for applications to place their executables in /usr/lib/ and install a symlink in /usr/bin (or another location in PATH). Firejail however refuses to use these when private-bin is in force: firejail/fs_bin.c takes the basename of given and looks for such a file in a set of hardcoded paths, resulting in
Warning: file <abs path> not found. The real executable is present in the sandbox, so it can be called.follow-symlink-private-bin yesdoes not affect this.Is there a way to make such symlinks work, other than writing a dummy wrapper script that calls the true executable and giving that to private-bin, rather than the symlink?
@chiraag-nataraj commented on GitHub (Nov 6, 2017):
Hmm...on my system,
/usr/bin/firefoxis a symlink to/usr/lib/firefox/firefox, andfirejail firefoxwithprivate-binworks just fine.@aayla-secura commented on GitHub (Nov 6, 2017):
Exactly, on my system
/usr/bin/firefoxpoints to/usr/lib/firefox/firefox, but firejail fails to copy the symlink...@chiraag-nataraj commented on GitHub (Nov 6, 2017):
Huh that's weird. You're using the default profile?
@aayla-secura commented on GitHub (Nov 6, 2017):
No, I have a custom profile, which is mostly similar to the default firefox's with the major differences being
@aayla-secura commented on GitHub (Nov 6, 2017):
Ok, I figured out that if I give the absolute path to the link as in
private-bin ...,/usr/bin/firefox, it does not copy it. The function responsible infirejail/fs_bin.cisvalid_full_path_fileand I missed a detail when I was first looking at it. So it usesrealpathto get the canonical path (which would be the link's target in/usr/lib), then searches through the standard path for a file with the same basename as the link (which happens to have the same basename as its target, but this is irrelevant here), and finally compares the full path of the file found in one of the standard locations with the path returned byrealpath... which of course fails.So with symlinks, I have to give only the basename to
private-bin. Probably easy to fix this and allow full paths for symlinks, but I don't have time to write a patch at the moment.@netblue30 commented on GitHub (Nov 7, 2017):
You need to install the latest version here in git - there was a fix earlier regarding symlinks handling in private-bin. For firefox you need the real executable to be under /usr/lib/firefox, otherwise firefox will not work.
A short example for Debian 9:
/usr/bin/firefox is a shell script (/bin/sh). The script calls "which" and /usr/bin/firefox-esr. firefox-esr is the symlink pointing to the real executable. This is how I start the sandbox:
You can check your private-bin setup by adding bash and ls and running it like this:
@aayla-secura commented on GitHub (Nov 7, 2017):
Yes, as I mentioned in my previous comment, passing a relative name to
private-bindoes copy the symlink, but using the full path fails, i.e. (just tested with the latest commit82f373dea7)when
/usr/bin/firefoxdoes exist:@netblue30 commented on GitHub (Nov 9, 2017):
I have a fix in, you can give it a try.
@aayla-secura commented on GitHub (Nov 9, 2017):
Yes, commit
b1b1e774a1seems to fix it.@netblue30 commented on GitHub (Nov 10, 2017):
cool! thanks for the bug.