mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #6373] DNS problem with "--net=eth0" #3255
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#3255
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 @daedalus-rwx on GitHub (Jun 7, 2024).
Original GitHub issue: https://github.com/netblue30/firejail/issues/6373
Description
The Jail don't access internet due to DNS problems.
The problems appear to be related to the system's "resolvectl" service.
Steps to Reproduce
$ firejail --noprofile --net=eth0 /bin/bashInside the jail: tests --> results
Out of the jail
on system shell: tests --> results
Additional context 01
$ firejail --profile=firefox --net=eth0 /bin/bashInside the jail with firefox profile: tests --> results
Additional context 02
$ firejail --noprofile /bin/bashInside the jail without
--net=eth0: tests --> resultsEnvironment
Checklist
/usr/bin/vlc) "fixes" it).https://github.com/netblue30/firejail/issues/1139)@ghost commented on GitHub (Jun 7, 2024):
0.9.66is no longer supported nor safe to use. Follow the ubuntu install instructions and upgrade ASAP.@daedalus-rwx commented on GitHub (Jun 7, 2024):
Thanks for the quick response.
Updated to version
0.9.72. The problem persists in the same way as described.@ghost commented on GitHub (Jun 8, 2024):
I don't have ethernet on my laptop, and I don't use systemd-resolved. Firejail's --dns= feature is incompatible with it. Other than that the below works fine using the wi-fi interface:
$ firejail --noprofile --net=wlp2s0 --ip=192.168.0.80 --dns=1.1.1.1 /bin/bashNote: the --dns= feature is not supported on
systemd-resolvedsetups.@rusty-snake commented on GitHub (Jun 8, 2024):
If you use nss-resolve, DNS will work in the most programs if you allow access to the resolved D-Bus API. Alternatively you could also give your system a mork network namespace friendly DNS setup.
@daedalus-rwx commented on GitHub (Jun 20, 2024):
Using Bridge in Firejail
Step-by-step to enable internet within the jail.
This bridge configuration allows a jailed application to access the internet. For this, an exclusive and dedicated network is created for the jail, completely separated from the host network, through the network namespace functionality used by firejail.
The communication of the network namespace created by the jail with the host's standard network is done through a
bridgeinterface. The system will need to be configured to enable IPv4 packet forwarding, so that a NAT (network address translation) can then forward the packets appropriately, making the packets originating from thebridgenetwork exit through the host's main internet interface, in a masked way.Tested on an Ubuntu 22.04 system with a Vanilla installation.
Preparations
Identify the main interface on the host that has internet access.
This can be done using
ip a.In this example, the interface with internet access is:
eth0Define a network address (or subnet) different from the host.
In this example, the
10.10.20.0/24network is different from the network used ineth0.Thus, the free and chosen IP for the bridge is:
10.10.20.1/24Define a name for the
bridge.The name of the bridge will be:
br-jailOn the host
This step activates the firewall permanently.
Then, it sets the default packet forwarding policy to
DENY(DROP) and creates an exclusive exception forbr-jailwith origin in the10.10.20.0/24network. These configurations are lost when the system restarts.eth0Start firejail
At this point, it is necessary to ensure the DNS configuration for the jail.
The
--dns=functionality of firejail overlays the/etc/resolv.conffile inside the jail with up to 4 DNS's. This ensures that the jail does not use the standard DNS resolution of Ubuntu, viasystemd-resolved(internal server), makingresolvectl statussettings ineffective within the jail.Inside the jail - Connectivity test
@daedalus-rwx commented on GitHub (Jun 20, 2024):
This configuration is in accordance with the alternative?
@rusty-snake commented on GitHub (Jun 20, 2024):
The upstream default is yes. However some distros (Debian) change the default in their packages.
Maybe this depends also on nsswitch.conf.
@daedalus-rwx commented on GitHub (Jun 20, 2024):
Thank you very much, everyone.
And thank you for your work on this project.