1
0
mirror of https://github.com/pi-hole/docker-pi-hole.git synced 2024-06-29 20:50:53 +02:00
docker-pi-hole/start.sh
Mathieu Hofman 138e061c17 Allow running pihole-FTL as non-root
- Add a new container environment variable allowing to specify the user to run the pihole-FTL process as. Defaults to root.
- Set inherited capabilities attributes on the pihole-FTL file to automatically grant runtime permitted capabilities when available in the bounding set. This allows dropping root before starting pihole-FTL without failing with a permission error if the capabilities are not available to the container (the process may still error out if performing an operation requiring the capability).
- Add some information on capabilities to the Readme file.

Signed-off-by: Mathieu Hofman <86499+mhofman@users.noreply.github.com>
Signed-off-by: Martin Buchleitner <mabunixda@gmail.com>
2019-05-09 16:50:18 +02:00

49 lines
1.2 KiB
Bash
Executable File

#!/bin/bash -e
# Dockerfile variables
export TAG
export ServerIP
export ServerIPv6
export PYTEST
export PHP_ENV_CONFIG
export PHP_ERROR_LOG
export HOSTNAME
export WEBLOGDIR
export DNS1
export DNS2
export INTERFACE
export DNSMASQ_LISTENING_BEHAVIOUR="$DNSMASQ_LISTENING"
export IPv6
export WEB_PORT
export adlistFile='/etc/pihole/adlists.list'
# The below functions are all contained in bash_functions.sh
. /bash_functions.sh
# Some of the bash_functions use variables these core pi-hole/web scripts
. /opt/pihole/webpage.sh
# PH_TEST prevents the install from actually running (someone should rename that)
PH_TEST=true . $PIHOLE_INSTALL
echo " ::: Starting docker specific setup for docker pihole/pihole"
docker_checks
fix_capabilities
generate_password
validate_env || exit 1
prepare_configs
change_setting "IPV4_ADDRESS" "$ServerIP"
change_setting "IPV6_ADDRESS" "$ServerIPv6"
setup_web_port "$WEB_PORT"
setup_web_password "$WEBPASSWORD"
setup_dnsmasq "$DNS1" "$DNS2" "$INTERFACE" "$DNSMASQ_LISTENING_BEHAVIOUR"
setup_php_env
setup_dnsmasq_hostnames "$ServerIP" "$ServerIPv6" "$HOSTNAME"
setup_ipv4_ipv6
setup_lighttpd_bind "$ServerIP"
setup_blocklists
test_configs
[ -f /.piholeFirstBoot ] && rm /.piholeFirstBoot
echo " ::: Docker start setup complete"