mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #1845] firejailed editor can't use sudoedit #1253
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#1253
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 @chiraag-nataraj on GitHub (Mar 29, 2018).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1845
So in the interest of security, I decided to start sandboxing my editor (
emacs). For day-to-day stuff, it works really well - I don't have any issues. However, I decided to try to usesudoeditto edit a configuration file, and the configuration file showed up blank. I suspectedfirejailwas to blame, and looking at the output offirejail --ls=<pid> /var/tmpconfirmed it - that directory was empty.As far as I can tell, this is not configurable, which means launching an editor daemon within
firejailwill breaksudoedit. For example, runningfirejail --noprofile --env=TMPDIR=/tmp/user/1000 emacs --daemonhad the same problem -sudoeditwould show me an empty file.Would it be a good idea to allow whitelisting
/var/tmp? Alternatively, is there a way to set the location of thesudoedittemp files?@Vincent43 commented on GitHub (Mar 29, 2018):
You can use absolute path in
SUDO_EDITORvariable, i.e.SUDO_EDITOR=/usr/bin/emacs. Then emacs will run unsandboxed when run withinsudoeditbut it will be sandboxed when you do day-to-day stuff.@chiraag-nataraj commented on GitHub (Mar 29, 2018):
Yeah, that's doable. But I'd definitely like to get this working, since the whole point of
sudoeditis to be able to run the editor as my user, and there's no real reason not to sandbox that as I would with my regular editor. For example, I tried usingwhitelist /var/tmpto indicate tofirejailthat it should use the real/var/tmpdirectory, but the mount of/var/tmphappens beforefirejailchecks the profile options, sowhitelist /var/tmpbasically has no effect. Shouldn't the default mounts be overrideable through thewhitelistdirective when appropriate? Or is this by design?@chiraag-nataraj commented on GitHub (Mar 29, 2018):
So I looked through
fs_var.candfs.ca bit, and it seems that you're cleanly mounting/var/tmpto support multiple sandboxes (at least that's what the// update /var directory in order to support multiple sandboxes running on the same root directoryimplies?). But cleanly mounting/var/tmpseems to be a security measure, since none of the sandboxes have any files in there (I would presume mounting/var/lockis much more relevant to this aim). Can we have a setting that disables this (or just honorwhitelist /var/tmp)?@chiraag-nataraj commented on GitHub (Mar 29, 2018):
Okay, I hacked it in with a simple command-line option (
--keep-var-tmp) and profile option (keep-var-tmp). It is handled in exactly the same way e.g.--writable-var-logis handled. Of course, it only really makes sense when used in conjunction with--writable-var, since the flag just disables the default behavior of overwriting/var/tmp. A patch file (suitable forgit apply) is attached. What do people think?keep-var-tmp.txt