I just created a chroot jail with inetutils, coreutils and bash. Most of the things seem to work. I can ping ip addresses and hosts that are inside /etc/hosts
, however, I can't ping hosts that are not in /etc/hosts
. I copied both resolv.conf
and protocols
to the chroot jail, but I still cannot ping hostnames. Which file am I supposed to put inside the jail so I can resolve hostnames? I have also read some stuff about scutil
, but I want to avoid copying more binaries as much as possible.
$ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=120 time=22.322 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=120 time=26.672 ms
$ ping google.com # Host not in /etc/hosts
ping: unknown host
$ ping example.com # Host in /etc/hosts
PING example.com (93.184.216.34): 56 data bytes
64 bytes from 93.184.216.34: icmp_seq=0 ttl=50 time=160.226 ms
64 bytes from 93.184.216.34: icmp_seq=1 ttl=50 time=147.602 ms
Best Answer
I was able to get it to work by making sure the
/etc/resolver.conf
existed in thechroot
and then symlinking/var/run/mDNSResponder
into thechroot
.