mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[PR #3102] [MERGED] DHCP client support #4644
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#4644
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?
📋 Pull Request Information
Original PR: https://github.com/netblue30/firejail/pull/3102
Author: @kris7t
Created: 12/30/2019
Status: ✅ Merged
Merged: 1/7/2020
Merged by: @netblue30
Base:
master← Head:dhcp-client📝 Commits (7)
a50e868Add --ip=dhcp and --ip6=dhcp options40d6081Do not try to set up default gateway without an IP addressd3d806dAllow resolv.conf be written by dhclient8dd73b2Add sbox_run_v to run programs with explicit argument lists02d09e8Add capability filter for network services, additive filterce3c198Run dhclient inside the sandboxc082d90Wait for link-local address for DHCPv6📊 Changes
12 files changed (+410 additions, -43 deletions)
View changed files
➕
src/firejail/dhcp.c(+158 -0)📝
src/firejail/firejail.h(+27 -0)📝
src/firejail/fs_hostname.c(+7 -3)📝
src/firejail/main.c(+17 -10)📝
src/firejail/network_main.c(+4 -0)📝
src/firejail/profile.c(+18 -12)📝
src/firejail/sandbox.c(+7 -0)📝
src/firejail/sbox.c(+40 -18)📝
src/fnet/fnet.h(+1 -0)📝
src/fnet/interface.c(+122 -0)📝
src/fnet/main.c(+4 -0)📝
src/include/rundefs.h(+5 -0)📄 Description
As per my issue in #3026, I was trying to use DHCP to configure network interfaces in firejail. This patch implements integration with the ISC dhclient for both IPv4 and IPv6.
I left the commits as-is so that they can be reviewed individually, but I can squash them if that is preferred.
--ip=dhcpand--ip6=dhcpfor IPv4 and IPv6 configuration by DHCP.--ip=dhcpis handled similarly to--ip=none. In particular, firejail does not do any network configuration on its own, not even setting up routing.CAP_NET_BIND_SERVICEso that dhclient can bind to low ports./run/firejail/mnt/dhclient. The PID file is read (hopefully without race conditions) to find the PID of the dhclient daemon process. The sandbox may terminate if only the dhlient daemons are running.-x) dhlient or release the DHCP lease (-r), as neither is required by the DHCP protocol. The dclient processes just die when the sandbox terminates. It would be possible to release the lease properly (this is allegedly required by some ISPs, but not in the more common situation when the sandboxes are connected to a local virtual bridged network, such as libvirt), but would require keeping some privileges until container termination (either in the firejail main process, or an auxiliary process just for communicating with dhclient).fnetto wait for IPv6 LL addresses. Unfortunately, I had to use the rather complex rtnetlink interface, because this is the only way to access the tenative flag of an address.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.