-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DNS problem with "--net=eth0" #6373
Comments
|
Thanks for the quick response. Updated to version |
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:
Note: the --dns= feature is not supported on |
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. |
Using Bridge in FirejailStep-by-step to enable internet within the jail. Note This network configuration requires setting 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 Tested on an Ubuntu 22.04 system with a Vanilla installation. Preparations
On the host
$ sudo ip link add br-jail type bridge
$ sudo ip link set br-jail up
$ sudo ip addr add 10.10.20.1/24 dev br-jail
$ sudo ufw enable
$ sudo iptables -P FORWARD DROP
$ sudo iptables -A FORWARD -i br-jail -s 10.10.20.0/24 -o eth0 -j ACCEPT This step activates the firewall permanently. Note The current step aims to reinforce security before enabling packet forwarding in the system.
$ sudo sysctl -w net.ipv4.ip_forward=1
$ sudo iptables -t nat -A POSTROUTING -o eth0 -s 10.10.20.0/24 -j MASQUERADE Start firejail$ firejail --noprofile --net=br-jail --dns=8.8.8.8 --dns=8.8.4.4 /bin/bash At this point, it is necessary to ensure the DNS configuration for the jail. Inside the jail - Connectivity test$ IF=$(ip -o link show | awk -F': ' '/: eth/{print $2; exit}' | cut -d'@' -f1) # network interface name (e.g.: eth0)
$ resolvectl query bbc.co.uk # --> OK
$ resolvectl query bbc.co.uk -i $IF # --> OK
$ host bbc.co.uk # --> OK
$ ping -I $IF -c 2 -q bbc.co.uk # --> OK
$ dig bbc.co.uk # --> OK
$ dig bbc.co.uk @1.1.1.1 # --> OK
$ dig bbc.co.uk @8.8.8.8 # --> OK
$ nslookup bbc.co.uk # --> OK
$ tracepath -b bbc.co.uk # --> OK Warning Firewall sudo ufw enable
sudo ufw default deny forward
sudo ufw route allow in on br3 from 10.0.5.0/24 out on eth0 Warning Permanence |
This configuration is in accordance with the alternative? |
The upstream default is yes. However some distros (Debian) change the default in their packages.
Maybe this depends also on nsswitch.conf. |
Thank you very much, everyone. |
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/bash
Inside the jail: tests --> results
Out of the jail
on system shell: tests --> results
Additional context 01
$ firejail --profile=firefox --net=eth0 /bin/bash
Inside the jail with firefox profile: tests --> results
Additional context 02
$ firejail --noprofile /bin/bash
Inside the jail without
--net=eth0
: tests --> resultsEnvironment
Checklist
/usr/bin/vlc
) "fixes" it).https://github.com/netblue30/firejail/issues/1139
)The text was updated successfully, but these errors were encountered: