mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #464] firejail detects existing sandbox in lxc #333
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#333
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 @reinerh on GitHub (Apr 20, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/464
Hi netblue30.
You have a really impressive test suite in test/, which is awesome!
But it is not included in the release tarball.
I thought about letting these tests run automatically on Debian's CI infrastructure [1].
Could you please include the tests in your next release?
1: https://ci.debian.net/
@netblue30 commented on GitHub (Apr 21, 2016):
Yes, I'll bring them in one by one, as I clean them up.
I put in test/profiles directory, if you want to play with them. I use expect (apt-get expect) and I use "grep TESTING" as a marker to monitor the results. Start the test as "make test-profiles" in the main directory. Modify whatever you need to integrate it on your side. Thank you for your help.
@reinerh commented on GitHub (Jun 1, 2016):
Thanks! The tests are now running: https://ci.debian.net/packages/f/firejail/
Unfortunately firejail detects an existing sandbox, as it is running inside LXC.
I haven't detected this in my local setup, as I was using qemu as isolation for running the tests.
I'm currently trying to get it also running in LXC to reproduce it.
@netblue30 commented on GitHub (Jun 2, 2016):
I'll have to implement LXC detection and not to disable the sandbox - and the same for Docker.
@netblue30 commented on GitHub (Jun 2, 2016):
I put a fix in to recognize lxc (
28641d918e), and start the sandbox the normal way, without and "--force" flag necessary. I'm testing on jessie like this:This starts as root a very simple lxc sandbox, with the original filesystem and a network namespace with a single interface, lo. LXC sets by default "container=lxc" env variable - I use it to detect the lxc sandbox. Also, most of normal env variables are missing, so I set some of them. Then, I start the test:
I still have some tests failing, probably because of missing evn variables. I am looking into them.
@reinerh commented on GitHub (Jun 4, 2016):
I have now cherry-picked your commit (
28641d9) into 0.9.40-2 in Debian, but unfortunately it still doesn't detect that it is running in LXC.I think the container variable is only available to the first process inside the container (init), and is not set on normal login sessions.
@reinerh commented on GitHub (Jun 4, 2016):
Another possibility seems to be checking
/proc/1/environfor the environment variable, or if systemd is running/run/systemd/container.(https://sources.debian.net/src/systemd/229-5/src/basic/virt.c/#L371)
@netblue30 commented on GitHub (Jun 7, 2016):
I've figured out something: maybe just adding the missing environment variable will be enough to get you started. Instead of "make test" give it a try with "container=lxc make test". Thanks!
@reinerh commented on GitHub (Jun 7, 2016):
This will probably work, yes. But that would only be a workaround.
Normal users in LXC containers will still have this issue and have to use
--force, or export the container variable in their .bashrc or so.@netblue30 commented on GitHub (Jun 8, 2016):
OK, fixed by reading /proc/1/environ. This is the commit:
9fafef8e00@reinerh commented on GitHub (Jun 8, 2016):
Thanks a lot! I just tested it on my system in LXC and it works correctly. :-)
@netblue30 commented on GitHub (Jun 9, 2016):
I didn't get a chance to test it, so it is in your hands for now. I guess some of the profiles will break. Will fix them one by one. Thanks!
@reinerh commented on GitHub (Jun 16, 2016):
LXC detection is working now, confirmed on ci.debian.net, so I'll close this issue.
(Though there are still a few test failures, but that's unrelated to this.)