Skip to content

Commit

Permalink
removed WEBPASSWORD functionality because it did not work like intended
Browse files Browse the repository at this point in the history
minor script improvements
  • Loading branch information
Cielquan committed Aug 5, 2019
1 parent 10423c3 commit c603ec9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 52 deletions.
29 changes: 12 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand All @@ -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.
Expand All @@ -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.
Expand Down Expand Up @@ -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=<your password>

### Update
If you want to update container with a newer image run following commands on your server while inside the repository directory _(via SSH)_.

Expand Down Expand Up @@ -201,7 +196,7 @@ Christian Riedel


## Version and State
Version: 2.0.2
Version: 2.1.0

State: 05.08.2019

Expand Down
1 change: 0 additions & 1 deletion docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
36 changes: 2 additions & 34 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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####################"

0 comments on commit c603ec9

Please sign in to comment.