mirror of
https://github.com/pi-hole/pi-hole.git
synced 2025-04-05 23:20:17 +00:00
installs PIHOLE_WEB_DEPS to create LIGHTTPD_USER
Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
This commit is contained in:
parent
8e8e1a4e0a
commit
81e717256e
1 changed files with 24 additions and 16 deletions
|
@ -134,11 +134,14 @@ def test_installPiholeWeb_fresh_install_no_errors(Pihole):
|
||||||
|
|
||||||
def test_installPiholeWeb_fresh_install_readableBlockpage(Pihole):
|
def test_installPiholeWeb_fresh_install_readableBlockpage(Pihole):
|
||||||
'''
|
'''
|
||||||
confirms all web page assets from Core repo are installed and readable by www-data on a fresh build
|
confirms all web page assets from Core repo are readable by $LIGHTTPD_USER on a fresh build
|
||||||
'''
|
'''
|
||||||
installWeb = Pihole.run('''
|
installWeb = Pihole.run('''
|
||||||
umask 0027
|
umask 0027
|
||||||
source /opt/pihole/basic-install.sh
|
source /opt/pihole/basic-install.sh
|
||||||
|
distro_check > /dev/null 2>&1
|
||||||
|
echo "LIGHTTPD_USER=${LIGHTTPD_USER}"
|
||||||
|
install_dependent_packages ${PIHOLE_WEB_DEPS[@]} > /dev/null 2>&1
|
||||||
installPiholeWeb
|
installPiholeWeb
|
||||||
''')
|
''')
|
||||||
expected_stdout = info_box + ' Installing blocking page...'
|
expected_stdout = info_box + ' Installing blocking page...'
|
||||||
|
@ -153,44 +156,49 @@ def test_installPiholeWeb_fresh_install_readableBlockpage(Pihole):
|
||||||
assert expected_stdout in installWeb.stdout
|
assert expected_stdout in installWeb.stdout
|
||||||
expected_stdout = tick_box + ' Installing sudoer file'
|
expected_stdout = tick_box + ' Installing sudoer file'
|
||||||
assert expected_stdout in installWeb.stdout
|
assert expected_stdout in installWeb.stdout
|
||||||
|
webuser = ''
|
||||||
|
user = re.findall("^\s*LIGHTTPD_USER=.*$", installWeb.stdout, re.MULTILINE)
|
||||||
|
for match in user:
|
||||||
|
webuser = match.replace('LIGHTTPD_USER=', '').strip()
|
||||||
exit_status_success = '0'
|
exit_status_success = '0'
|
||||||
# check directories above $webroot for read and execute permission by www-data
|
test_command = 'echo $(su --command "test -{0} {1}" -p {2}) $?'
|
||||||
check_var = 'echo $(su -c "test -r /var" www-data) $?'
|
# check directories above $webroot for read and execute permission
|
||||||
|
check_var = test_command.format('r', '/var', webuser)
|
||||||
expected_stdout = Pihole.run(check_var).stdout
|
expected_stdout = Pihole.run(check_var).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
check_var = 'echo $(su -c "test -x /var" www-data) $?'
|
check_var = test_command.format('x', '/var', webuser)
|
||||||
expected_stdout = Pihole.run(check_var).stdout
|
expected_stdout = Pihole.run(check_var).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
check_www = 'echo $(su -c "test -r /var/www" www-data) $?'
|
check_www = test_command.format('r', '/var/www', webuser)
|
||||||
expected_stdout = Pihole.run(check_www).stdout
|
expected_stdout = Pihole.run(check_www).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
check_www = 'echo $(su -c "test -x /var/www" www-data) $?'
|
check_www = test_command.format('x', '/var/www', webuser)
|
||||||
expected_stdout = Pihole.run(check_www).stdout
|
expected_stdout = Pihole.run(check_www).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
check_html = 'echo $(su -c "test -r /var/www/html" www-data) $?'
|
check_html = test_command.format('r', '/var/www/html', webuser)
|
||||||
expected_stdout = Pihole.run(check_html).stdout
|
expected_stdout = Pihole.run(check_html).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
check_html = 'echo $(su -c "test -x /var/www/html" www-data) $?'
|
check_html = test_command.format('x', '/var/www/html', webuser)
|
||||||
expected_stdout = Pihole.run(check_html).stdout
|
expected_stdout = Pihole.run(check_html).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
# check directories below $webroot for read and execute permission by www-data
|
# check directories below $webroot for read and execute permission
|
||||||
check_admin = 'echo $(su -c "test -r /var/www/html/admin" www-data) $?'
|
check_admin = test_command.format('r', '/var/www/html/admin', webuser)
|
||||||
expected_stdout = Pihole.run(check_admin).stdout
|
expected_stdout = Pihole.run(check_admin).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
check_admin = 'echo $(su -c "test -x /var/www/html/admin" www-data) $?'
|
check_admin = test_command.format('x', '/var/www/html/admin', webuser)
|
||||||
expected_stdout = Pihole.run(check_admin).stdout
|
expected_stdout = Pihole.run(check_admin).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
check_pihole = 'echo $(su -c "test -r /var/www/html/pihole" www-data) $?'
|
check_pihole = test_command.format('r', '/var/www/html/pihole', webuser)
|
||||||
expected_stdout = Pihole.run(check_pihole).stdout
|
expected_stdout = Pihole.run(check_pihole).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
check_pihole = 'echo $(su -c "test -x /var/www/html/pihole" www-data) $?'
|
check_pihole = test_command.format('x', '/var/www/html/pihole', webuser)
|
||||||
expected_stdout = Pihole.run(check_pihole).stdout
|
expected_stdout = Pihole.run(check_pihole).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
# check most important files in $webroot for read permission by www-data
|
# check most important files in $webroot for read permission by
|
||||||
check_index = 'echo $(su -c "test -r /var/www/html/admin/index.php" www-data) $?'
|
check_index = test_command.format('r', '/var/www/html/admin/index.php', webuser)
|
||||||
expected_stdout = Pihole.run(check_index).stdout
|
expected_stdout = Pihole.run(check_index).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
check_blockpage = 'echo $(su -c "test -r /var/www/html/admin/blockingpage.css" www-data) $?'
|
check_blockpage = test_command.format('r', '/var/www/html/admin/blockingpage.css', webuser)
|
||||||
expected_stdout = Pihole.run(check_blockpage).stdout
|
expected_stdout = Pihole.run(check_blockpage).stdout
|
||||||
assert exit_status_success in expected_stdout
|
assert exit_status_success in expected_stdout
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue