mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-22 23:30:13 +00:00
resolve with dig instead of relying on /etc/resolv.conf
Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
This commit is contained in:
parent
8ad746c1d4
commit
47658cec51
1 changed files with 17 additions and 7 deletions
|
@ -636,8 +636,10 @@ def test_installPihole_fresh_install_readableBlockpage(Pihole, test_webpage):
|
|||
# TODO: which other files have to be checked?
|
||||
# check web interface files
|
||||
# change nameserver to pi-hole
|
||||
ns = Pihole.run('sed -i "s/nameserver.*/nameserver 127.0.0.1/" /etc/resolv.conf')
|
||||
print(ns.stdout)
|
||||
# setting nameserver in /etc/resolv.conf to pi-hole does
|
||||
# not work here because of the way docker uses this file
|
||||
ns = Pihole.run("sed -i 's/nameserver.*/nameserver 127.0.0.1/' /etc/resolv.conf")
|
||||
pihole_is_ns = ns.rc == 0
|
||||
if installWebInterface is True:
|
||||
# TODO: login into admin interface?
|
||||
passwordcommand = 'grep "WEBPASSWORD" -c "/etc/pihole/setupVars.conf"'
|
||||
|
@ -665,12 +667,20 @@ def test_installPihole_fresh_install_readableBlockpage(Pihole, test_webpage):
|
|||
r"failed to open stream: " +
|
||||
r"Permission denied in"),
|
||||
re.I)
|
||||
# using cURL option --dns-servers is not possible
|
||||
status = (
|
||||
'curl -s --head "{}" | ' +
|
||||
'head -n 1 | ' +
|
||||
'grep "HTTP/1.[01] [23].." > /dev/null')
|
||||
pagecontent = 'curl --verbose -L "{}"'
|
||||
for page in piholeWebpage:
|
||||
d = Pihole.run("echo {} | sed -e 's|http://||' -e 's|/.*||'".format(page))
|
||||
print(d.stdout)
|
||||
dig = Pihole.run("dig @127.0.0.1 $(echo {} | sed -e 's|http://||' -e 's|/.*||')".format(page))
|
||||
print(dig.stdout)
|
||||
dig = Pihole.run("nslookup $(echo {} | sed -e 's|http://||' -e 's|/.*||') 127.0.0.1".format(page))
|
||||
print(dig.stdout)
|
||||
if dig.rc == 0 or pihole_is_ns:
|
||||
# check HTTP status of blockpage
|
||||
actual_rc = Pihole.run(status.format(page))
|
||||
assert exit_status_success == actual_rc.rc
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue