mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #1127] --whitelist=~/.bashrc temporarily overwrites .bashrc #777
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#777
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 @Fred-Barclay on GitHub (Mar 5, 2017).
Original GitHub issue: https://github.com/netblue30/firejail/issues/1127
Originally assigned to: @chiraag-nataraj on GitHub.
This was brought to my attention by a chap on the Linux Mint forums. When doing something like the following, .bashrc is overwritten or overlayed inside the jail with a new, different .bashrc.:
Compare the following output for
firejail --noprofile --whitelist=~/.bashrc:Outside jail
Inside jail
This is on Debian Jessie.
For the bloke who originally mentioned this, he has a far more drastic change on Arch Linux, from a very long .bashrc outside of firejail to just these lines inside:
Debug output is at https://gist.github.com/Fred-Barclay/fa603fb1ff6dc3084b907e7f680bf3e2
I've done a bit of digging around but I can't figure out the cause. If it were due to the
read-only ${HOME}/.bashrcline in etc/disable-common.inc then this shouldn't occur when I use--noprofile, right? But it does. 😕Is this expected?
@netblue30 commented on GitHub (Mar 7, 2017):
It is copying by default /etc/skel/.bashrc, I have to disable this when .bashrc is whitelisted. Thanks!
@chiraag-nataraj commented on GitHub (Jul 22, 2018):
Is this still around?
@Fred-Barclay commented on GitHub (Jul 22, 2018):
@chiraag-nataraj it is -- just tested on Arch.
@chiraag-nataraj commented on GitHub (Jul 22, 2018):
Oh man, okay. Yeah, I just confirmed as well. I think the problem is somewhere in
fs_home.c? That code checks for the existence of.bashrcbefore copying, but for some reason it doesn't seem to work...a print statement there never prints.@D-Nice commented on GitHub (Mar 2, 2019):
Still experiencing this!
@chiraag-nataraj commented on GitHub (May 21, 2019):
Thanks for the bump, I'll take a look.
@chiraag-nataraj commented on GitHub (May 21, 2019):
Hmm, if I do
firejail --noprofilewithout any whitelist directives, I get my regular bash prompt. This is with current git master.@chiraag-nataraj commented on GitHub (May 21, 2019):
Here's what I get when I do the following:
So it seems like
.bashrcis being treated differently. They should all be symlinked to relevant files in~/.config/bash, and while the other ones are,.bashrcis not. Time to hunt for where this happens!@chiraag-nataraj commented on GitHub (May 21, 2019):
Gah, I don't get this. I went to
903adeed61/src/firejail/fs_home.c (L97)and added a print statement. When that didn't show, I added an else statement that should have just printed the result of stat. Neither shows anything, even when I run with--debug. @netblue30, where is this happening? When I run agrep, the only places.bashrcshows up aresrc/firejail/fs_home.candsrc/fbuilder/build_home.c, and the latter is just for when we runfirejail --build. But I don't get any output when I force all cases infs_home.c(for.bashrc) to actually print something (usingfs_logger). This makes absolutely no sense.@rusty-snake commented on GitHub (Jul 10, 2019):
Any progress here?
@smitsohu commented on GitHub (Jul 12, 2019):
In the effort to improve support for non-standard home directories, I wanted to
6a0d5aaaa2/src/firejail/fs_whitelist.c (L746-L760)These new homedirs should be suitable for whitelisting, but obviously are not initialized at all.
It's a different issue but quite related, so I think it makes sense to keep track in this place.
@smitsohu commented on GitHub (Jul 12, 2019):
I wonder if we should move this line
de80850e93/src/firejail/fs_whitelist.c (L724-L725)to the end of the tmpfs mounts?
Then whatever turns out to be the fix for overwriting bashrc probably initializes these new homedirs as well, without need for extra code.
@smitsohu commented on GitHub (Jul 20, 2019):
Nevermind. I'll stick to something less ambitious. Creating folders with generous permissions in places such as /etc creates mixed feelings... to get this really right, it would be necessary to always match permissions exactly, which, as far as I can see, requires larger changes to the whitelisting code (and maybe also the data structures). Let's pretend I didn't post anything here 😄