diff --git a/README.md b/README.md index becfc27..6a622c0 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,6 @@ from the system. See [Variable Notes](https://github.com/Cielquan/docker-pihole- * `HOST_NAME` * `TIMEZONE` * `DOMAIN` -* `PIHOLE_WEBPASSWORD` _(`WEBPASSWORD` is not allowed)_ ##### 1.4 server.conf file You can add a 'server.conf' file in 'pihole-docker/configs/' directory with parameters listed @@ -78,8 +77,8 @@ However this is not recommended because the `setup.sh` script will create it for ##### 1.5 .env file You can add a '.env' file to '/' with variables (listed below) used by 'docker-compose.yaml' file. However this is not recommended because the `setup.sh` script will create it for you (rather set given variables in 'setup.conf'). -* `HOSTNAME` -* `TZ` +* `HOSTNAME` +* `TZ` #### 2 Send files to server Now your setup is done and you can move the files to your server. @@ -89,14 +88,10 @@ Now your setup is done and you can move the files to your server. Copies the repo from your home directory to the directory of the server. You need to alter the user, IP and paths to your parameters. #### 3 run the scripts -Now cd into the repo on the server via SSH and first start the setup script. `source` is mandatory if you have not set the -`WEBPASSWORD` environment variable yourself. You can also start the script without sudo, but for the compiling part (when compiling) +Now cd into the repo on the server via SSH and first start the setup script. You can also start the script without sudo, but for the compiling part (when compiling) root privileges are needed. - $ source setup.sh - -If you have not set the `WEBPASSWORD` environment variable or the `PIHOLE_WEBPASSWORD` variable the script will prompt you to set a password. -You can either set none or give a password. The random password generator from pihole is not usable. + $ sudo ./setup.sh After the script finished successfully you can start the `run.sh` script to actually start the docker containers. You need to start the script with sudo, because the docker daemon needs root privileges. @@ -105,8 +100,14 @@ You need to start the script with sudo, because the docker daemon needs root pri Instead of the `run.sh` script you can also run `sudo docker-compose up -d`. The script does the same, but it also outputs information about the status of the single containers till they are done booting and setting up. -#### 4 use the new DNS server +#### 4 Secure your pihole dashboard +If you have not set the '`WEBPASSWORD` variable in `server.conf` file (not recommended) you should now set a secure password for your pihole dashboard or deactivate it. + + $ sudo docker exec pihole -a -p + +#### 5 use the new DNS server Now you can setup your other devices to use the server. +You may also install your CA certificate on your other devices. ### Variable Notes Here are some explanations for above mentioned variables. @@ -141,12 +142,6 @@ Format is like 'Europe/London'. `DOMAIN` If not set created by `setup.sh` script: '`HOST_NAME`.dns'. -`PIHOLE_WEBPASSWORD`: -Sets the pihole dashboard password but this is not recommended. -The recommended way is either let the `setup.sh` script prompt you and set it for you or to export it yourself: - - $ export WEBPASSWORD= - ### Update If you want to update container with a newer image run following commands on your server while inside the repository directory _(via SSH)_. @@ -201,7 +196,7 @@ Christian Riedel ## Version and State -Version: 2.0.2 +Version: 2.1.0 State: 05.08.2019 diff --git a/docker-compose.yaml b/docker-compose.yaml index be61f29..1dcd468 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -48,7 +48,6 @@ services: - ./pihole-docker/configs/server.conf environment: - TZ=${TZ:-Europe/London} - - WEBPASSWORD=${WEBPASSWORD} volumes: - ./pihole-docker/resolv.conf:/etc/resolv.conf - ./pihole-docker/configs/pihole/:/etc/pihole/ diff --git a/setup.sh b/setup.sh index 0e907ab..07b62d0 100755 --- a/setup.sh +++ b/setup.sh @@ -5,12 +5,6 @@ echo -e "\n####################\n" echo -e "INFO! Starting setup for docker-pihole-unbound-encrypted.\n" -# Check for WEBPASSWORD in setup.conf -if [ "$(. setup.conf && [[ -n "${WEBPASSWORD}" ]] && echo "OK")" = "OK" ]; then - echo "ERROR! WEBPASSWORD is not allowed in 'setup.conf' file." - exit 1 -fi - # Import setup.conf file if existing [ -f setup.conf ] && . setup.conf && echo "INFO! setup.conf loaded" @@ -142,9 +136,9 @@ fi # Auto create lan.list file or complement it echo "INFO! Checking for 'lan.list' file" if [ -f pihole-docker/configs/pihole/lan.list ]; then - if ! [ "$(grep -cw 'pihole-docker/configs/pihole/lan.list' -e "$HOST_IP")" -ge 1 ]; then + if ! grep -qw -e "${HOST_IP}" 'pihole-docker/configs/pihole/lan.list'; then echo -e "\n${HOST_IP} ${HOST_NAME}.dns ${HOST_NAME}" | tee -a pihole-docker/configs/pihole/lan.list > /dev/null && - if [ "$(grep -cw 'pihole-docker/configs/pihole/lan.list' -e "$HOST_IP")" -ge 1 ]; then + if grep -qw -e "${HOST_IP}" 'pihole-docker/configs/pihole/lan.list'; then echo "SUCCESS! Added host to 'lan.list' file" else echo "ERROR! Host could not be added to 'lan.list' file" @@ -340,31 +334,5 @@ else fi -# Set WEBPASSWORD if not set -if [ -z "${WEBPASSWORD+x}" ]; then - if [ -z "${PIHOLE_WEBPASSWORD+x}" ]; then - echo "WEBPASSWORD not set. Please enter a Password for the pihole dashboard:" - if ! read -r PIHOLE_WEBPASSWORD; then - echo "ERROR! WEBPASSWORD could not be received." - fi - fi - if export WEBPASSWORD=${PIHOLE_WEBPASSWORD}; then - if [ -z "${WEBPASSWORD}" ]; then - echo "SUCCESS! WEBPASSWORD deactivated." - else - echo "SUCCESS! WEBPASSWORD set." - fi - else - echo "ERROR! WEBPASSWORD could not be set." - fi -else - if [ -z "${WEBPASSWORD}" ]; then - echo "INFO! WEBPASSWORD is deactivated." - else - echo "INFO! WEBPASSWORD is set." - fi -fi - - echo -e "\nSUCCESS! Setup for docker-pihole-unbound-encrypted finished." echo -e "\n####################" \ No newline at end of file