项目作者: vanderblugen

项目描述 :
DNS over HTTPS over PiHole
高级语言: Shell
项目地址: git://github.com/vanderblugen/PiDOH.git
创建时间: 2019-11-09T18:17:22Z
项目社区:https://github.com/vanderblugen/PiDOH

开源协议:

下载


PiDOH

DNS over HTTPS over PiHole for Raspbian. This is for a https://github.com/pi-hole.

This has been pulled from https://docs.pi-hole.net/guides/dns-over-https/ and modified so that it can be run as a single script.

Before running the script it’s recommended to run sudo -v may be needed to run to cache the password, depending on how your Pi is setup.

Just give me the script

https://github.com/vanderblugen/PiDOH/blob/master/main.sh

You still have to update the PiHole per the image below.

This is the jist of the script

Here we are downloading the precompiled binary and copying it to the /usr/local/bin/ directory to allow execution by the cloudflared user.

  1. wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-arm.tgz
  2. tar -xvzf cloudflared-stable-linux-arm.tgz
  3. sudo cp ./cloudflared /usr/local/bin
  4. sudo chmod +x /usr/local/bin/cloudflared
  5. cloudflared -v

Create a cloudflared user to run the daemon

  1. sudo useradd -s /usr/sbin/nologin -r -M cloudflared

Proceed to create a configuration file for cloudflared by copying the following in to /etc/default/cloudflared.
This file contains the command-line options that get passed to cloudflared on startup

  1. echo "# Commandline args for cloudflared
  2. CLOUDFLARED_OPTS=--port 5053 --upstream https://1.1.1.1/dns-query --upstream https://1.0.0.1/dns-query" | sudo tee -a /etc/default/a.txt > /dev/null

Create the systemd script in to /etc/systemd/system/cloudflared.service
This controls the running of the service and allow it to run on startup

  1. echo "[Unit]
  2. Description=cloudflared DNS over HTTPS proxy
  3. After=syslog.target network-online.target
  4. [Service]
  5. Type=simple
  6. User=cloudflared
  7. EnvironmentFile=/etc/default/cloudflared
  8. ExecStart=/usr/local/bin/cloudflared proxy-dns $CLOUDFLARED_OPTS
  9. Restart=on-failure
  10. RestartSec=10
  11. KillMode=process
  12. [Install]
  13. WantedBy=multi-user.target" | sudo tee -a /etc/systemd/system/alpha > /dev/null

Enable the systemd service to run on startup

  1. sudo systemctl enable cloudflared
  2. sudo systemctl start cloudflared

Navigate a browser to the PiHole and update the DNS settings per the image

DNS Settings

If anyone wants to contribute please reach out