mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3598] Adding binaries outside standard "bin dirs" ala private-bin? #2255
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#2255
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 @curiositycasualty on GitHub (Aug 20, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3598
I've been tasked with sandboxing R (on Ubuntu 20.04). I've already got a trustworthy AppArmor profile that seems to fit over-top of firejail correctly; except AppArmor doesn't offer much in the way of network-sandboxing and my sandboxed R ultimately needs to be able to talk to a webserver on localhost over ports
80and443. So firejail's networking capability and/etc/firejail/webserver.netpiqued my interest. The webserver's R integration is either through an R package/client (needing to talk to localhost on ports80and443), And/or writing an R script and input files to disk, executing the R script, and then reading the output file generated by executing the R script. The firejail sandboxing needs to support both methods.However, I think I'm running into a devilishly devised snare caused by a combination of R's overlapping binary names and firejail's generous
private-*search behaviour.R essentially has a single, binary interpreter:
/usr/lib/R/bin/exec/Rbut wraps it in a handful of shell scripts, some of which are also namedR(like:/usr/bin/Rand/usr/lib/R/bin/R):For the moment, I'm willfully ignoring the libraries potentially compiled/installed by installed R packages, which generally wind up in a
libdir under the package's own dir within/usr/local/lib/R/site-library:Where I'm stuck is trying to construct a profile with a
private-binand aprivate-libthat accommodates/usr/lib/R/bin/exec/R's runtime libraries:It seems to me that binaries along
private-binand libs alongprivate-libpaths are scanned withlddto collect runtime library requirements, but since the R interpreter sits under/usr/lib/..., I'm unable to add it to aprivate-binline in my profile.I'm also concerned that upon finding multiple "
R"s, firejail is overwriting them when placing them into the jail-- as there seems to be an implicit assumption that there will only ever be 1 binary of a given name (or there only the first binary of a given name will be added to the jail) found along PATH.I'm in a special kind of hell. Please help me.
@bbhtt commented on GitHub (Aug 21, 2020):
You can choose that location, for example when I was making a profile, R choose the my shell dir working directory,
private-libis unwritable so it installed packages to~/R/x86_64-pc-linux-gnu-library/4.0/. This will need to setnoexechome and tmp (the packages are downloaded to /tmp/RTmpXXXX).You can express directories relative to
/libtoprivate-lib: Here's mine that I used to download:install.packages("Rcmdr", dependencies=TRUE)and my:
The three above probably need some refining...
I think, making a profile for it doesn't seem practical,since it acts as a package manager too, it'll need exeutables/libs to be listed depending on the package you install and this profile won't be portable to another system/distro. And
private-libonly works on amd64 I think.@curiositycasualty commented on GitHub (Sep 28, 2020):
I guess I should close the loop. Thank you @kortewegdevries for your suggestions.
What I ended up doing was using
lddon/usr/lib/R/bin/exec/Rto generate a list of libs for a firejail profile. In my case:This is for my very narrow use-case of an
<app>that is a tomcat application w/ R script and execution integration.Not pictured here:
br0interface/usr/local/bin/shims/unamereplacement (because R can be dumb)restricted-network noin/etc/firejail/firejail.configto allow fornet br0echo 0 > /proc/sys/net/ipv4/ip_forwardso that localhost is the only reachable thing viabr0/etc/firejail/R.hostsfile so that the sandbox can do some DNS resolution "transparently"/etc/apparmor.d/use.bin.Rapparmor profile coveringRandRscriptIn so far as I can tell, it supports
xvfbuse and pandoc'spdfgeneration.