remove resolv conf checks

Signed-off-by: Adam Hill <adam@diginc.us>
This commit is contained in:
Adam Hill 2020-05-26 10:45:48 -05:00
parent 34ef3d4d86
commit d7fdb188ed
9 changed files with 5 additions and 66 deletions

View File

@ -30,9 +30,6 @@ services:
volumes:
- './etc-pihole/:/etc/pihole/'
- './etc-dnsmasq.d/:/etc/dnsmasq.d/'
dns:
- 127.0.0.1
- 1.1.1.1
# Recommended but not required (DHCP needs NET_ADMIN)
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
cap_add:

View File

@ -2,31 +2,6 @@
# Some of the bash_functions use variables these core pi-hole/web scripts
. /opt/pihole/webpage.sh
docker_checks() {
warn_msg='WARNING Misconfigured DNS in /etc/resolv.conf'
ns_count="$(grep -c nameserver /etc/resolv.conf)"
ns_primary="$(grep nameserver /etc/resolv.conf | head -1)"
ns_primary="${ns_primary/nameserver /}"
warned=false
if [ "$ns_count" -lt 2 ] ; then
echo "$warn_msg: Two DNS servers are recommended, 127.0.0.1 and any backup server"
warned=true
fi
if [ "$ns_primary" != "127.0.0.1" ] ; then
echo "$warn_msg: Primary DNS should be 127.0.0.1 (found ${ns_primary})"
warned=true
fi
if ! $warned ; then
echo "OK: Checks passed for /etc/resolv.conf DNS servers"
fi
echo
cat /etc/resolv.conf
}
fix_capabilities() {
setcap CAP_NET_BIND_SERVICE,CAP_NET_RAW,CAP_NET_ADMIN+ei $(which pihole-FTL) || ret=$?

View File

@ -15,9 +15,6 @@ services:
pihole:
image: pihole/pihole:latest
dns:
- 127.0.0.1
- 1.1.1.1
ports:
- '53:53/tcp'
- '53:53/udp'
@ -60,4 +57,4 @@ services:
# PROXY_LOCATION: ghost
# VIRTUAL_HOST: ghost.yourDomain.lan
# VIRTUAL_PORT: 2368
# restart: always
# restart: always

View File

@ -44,9 +44,6 @@ services:
domainname: homedomain.lan
image: pihole/pihole:latest
dns:
- 127.0.0.1
- 1.1.1.1
ports:
- '0.0.0.0:53:53/tcp'
- '0.0.0.0:53:53/udp'

View File

@ -22,9 +22,6 @@ services:
- './etc-dnsmasq.d/:/etc/dnsmasq.d/'
# run `touch ./var-log/pihole.log` first unless you like errors
# - './var-log/pihole.log:/var/log/pihole.log'
dns:
- 127.0.0.1
- 1.1.1.1
# Recommended but not required (DHCP needs NET_ADMIN)
# https://github.com/pi-hole/docker-pi-hole#note-on-capabilities
cap_add:

View File

@ -10,7 +10,6 @@ docker run -d \
-e TZ="America/Chicago" \
-v "$(pwd)/etc-pihole/:/etc/pihole/" \
-v "$(pwd)/etc-dnsmasq.d/:/etc/dnsmasq.d/" \
--dns=127.0.0.1 --dns=1.1.1.1 \
--restart=unless-stopped \
--hostname pi.hole \
-e VIRTUAL_HOST="pi.hole" \

View File

@ -32,8 +32,6 @@ PH_TEST=true . $PIHOLE_INSTALL
echo " ::: Starting docker specific checks & setup for docker pihole/pihole"
docker_checks
# TODO:
#if [ ! -f /.piholeFirstBoot ] ; then
# echo " ::: Not first container startup so not running docker's setup, re-create container to run setup again"

View File

@ -14,10 +14,6 @@ with open('{}/VERSION'.format(dotdot), 'r') as v:
raw_version = v.read().strip()
__version__ = raw_version.replace('release/', 'release-')
@pytest.fixture()
def args_dns():
return '--dns 127.0.0.1 --dns 1.1.1.1'
@pytest.fixture()
def args_volumes():
return '-v /dev/null:/etc/pihole/adlists.list'
@ -27,8 +23,8 @@ def args_env():
return '-e ServerIP="127.0.0.1"'
@pytest.fixture()
def args(args_dns, args_volumes, args_env):
return "{} {} {}".format(args_dns, args_volumes, args_env)
def args(args_volumes, args_env):
return "{} {}".format(args_volumes, args_env)
@pytest.fixture()
def test_args():
@ -123,8 +119,8 @@ def persist_args_env():
return '-e ServerIP="127.0.0.1"'
@pytest.fixture(scope='module')
def persist_args(persist_args_dns, persist_args_volumes, persist_args_env):
return "{} {} {}".format(args_dns, args_volumes, args_env)
def persist_args(persist_args_volumes, persist_args_env):
return "{} {}".format(persist_args_volumes, persist_args_env)
@pytest.fixture(scope='module')
def persist_test_args():

View File

@ -179,20 +179,3 @@ def test_webPassword_pre_existing_trumps_all_envs(Docker, args_env, test_args):
assert '::: Pre existing WEBPASSWORD found' in function.stdout
assert Docker.run('grep -q \'{}\' {}'.format('WEBPASSWORD=volumepass', '/etc/pihole/setupVars.conf')).rc == 0
@pytest.mark.skip('broke, needs investigation in v5.0 beta')
@pytest.mark.parametrize('args_dns, expected_stdout', [
# No DNS passed will vary by the host this is ran on, bad idea for a test
#('', 'WARNING Misconfigured DNS in /etc/resolv.conf: Primary DNS should be 127.0.0.1'),
('--dns 1.1.1.1', 'WARNING Misconfigured DNS in /etc/resolv.conf: Two DNS servers are recommended, 127.0.0.1 and any backup server\n'
'WARNING Misconfigured DNS in /etc/resolv.conf: Primary DNS should be 127.0.0.1 (found 1.1.1.1)'),
('--dns 127.0.0.1', 'WARNING Misconfigured DNS in /etc/resolv.conf: Two DNS servers are recommended, 127.0.0.1 and any backup server'),
('--dns 1.1.1.1 --dns 127.0.0.1', 'WARNING Misconfigured DNS in /etc/resolv.conf: Primary DNS should be 127.0.0.1 (found 1.1.1.1)'),
('--dns 127.0.0.1 --dns 1.1.1.1', 'OK: Checks passed for /etc/resolv.conf DNS servers'),
])
def test_docker_checks_for_resolvconf_misconfiguration(Docker, args_dns, expected_stdout):
''' The container checks for misconfigured resolv.conf '''
function = Docker.run('. /bash_functions.sh ; eval `grep docker_checks /start.sh`')
print(function.stdout)
assert expected_stdout in function.stdout