private-etc=resolv.conf will not update for changed DNS server
Hello,
I have witnessed this problem with Discord, but I believe it to be a generic issue.
With private-etc=resolv.conf, the jail will receive a copy of the system's resolv.conf. If the system is now moved to a different location/network with a different DNS server, the system's resolv.conf will be updated to use the new server, but the jail's resolv.conf will not. DNS requests will henceforth fail in the jail as they try to use an unreachable server.
Ideally the jail's resolv.conf should be kept in sync with the system's, but this might require special handling of this file.
Alternatively, the DNS server in the jail's resolv.conf could be set to a globally reachable one instead of the local network's one, such as 1.1.1.1, with dns=1.1.1.1. But this unlikely to be in everyone's interest.
Reproduce
firejail --noprofile --private-etc=resolv.conf bash -c 'while true; do cat /etc/resolv.conf; getent hosts google.com; sleep 5; done'- While this runs, move the machine to a different network with different DNS resolver
- -> resolv.conf won't be updated, getent fails.
Environment Gentoo Linux, firejail-0.9.62-r1
Thanks!
Source: netblue30/firejail