mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #842] profile for building software and running test suites ? #572
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#572
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 @kapouer on GitHub (Oct 7, 2016).
Original GitHub issue: https://github.com/netblue30/firejail/issues/842
Typical usage:
firejail debuild,firejail sbuild,firejail git-buildpackage...it should only allow networking on loopback interface, and shout loudly if there's anything trying to access internet.
@reinerh commented on GitHub (Oct 7, 2016):
This came up on the debian-devel list btw:
https://lists.debian.org/debian-devel/2016/10/msg00116.html
@kapouer commented on GitHub (Oct 7, 2016):
I tried
firejail --noprofile --net=none debuildwith some kind of success - i was able to spot two failing tests during build, but wasn't able to tell
if some other tests were not failing but were trying to access internet anyway.
@reinerh commented on GitHub (Oct 7, 2016):
@netblue30 The feature request here is something like --tracelog, but for network access.
@reinerh commented on GitHub (Oct 7, 2016):
I guess something like that could be achieved with iptables and the LOG target.
@reinerh commented on GitHub (Oct 7, 2016):
Something like this should work, though it doesn't reach the kernel log (outside of firejail the rules are working).
I can also see with
firejail --join-network=$pid /sbin/iptables -vLthat the rules are applied and the counters are increasing.Edit: Oww, LOG has been disabled in containers inside the kernel: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=69b34fb996b2eee3970548cf6eb516d3ecb5eeed
Edit2: Might be possible with NFLOG
@netblue30 commented on GitHub (Oct 8, 2016):
You can set up a bridge:
Disable routing, so traffic on 10.10.20.1/24 network doesn't escape outside:
Start Wireshark and monitor br0 interface, and start the sandbox:
The first ARP in the trace is the sandbox grabbing an IP address, you'll get also some ipv6 traffic as the sandbox is starting up. If you find a way to log the traffic automatically, I'll add it in.
@ruany commented on GitHub (Sep 8, 2019):
I've just discovered that Linux 4.11 allows network namespace iptables logging. I've been looking for this type of functionality for quite a long time now, but I've finally figured it out.
First, enable it:
$ sudo sysctl -w net.netfilter.nf_log_all_netns=1/etc/iptables/logdeny.rules:
Launch the namespace:
$ firejail --noprofile --netfilter=/etc/iptables/logdeny.rules --net=eth0 --ip=192.168.1.84 --defaultgw=192.168.1.1Run a test:
$ nc 192.168.1.1 80Kill the command, then check your kernel logs (dmesg or journalctl):
With this setup you can deny all traffic and log all outbound attempts.
Another great use case is whitelisting specific IP addresses (and/or ports) for specific programs, and logging all packets dropped by the whitelist.
I also wrote a script which pipes blocked packets into desktop notifications.
~/.local/bin/iptables-snitch
My dream of logging dropped packets using Firejail's netfilter is complete :)