Skip to content

Commit

Permalink
Merge instructions for automatic cloudflared updates via cron
Browse files Browse the repository at this point in the history
  • Loading branch information
iUnknwn committed Apr 20, 2020
1 parent 3e2a96b commit 08123a2
Showing 1 changed file with 21 additions and 25 deletions.
46 changes: 21 additions & 25 deletions docs/guides/dns-over-https.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Along with releasing their DNS service [1.1.1.1](https://blog.cloudflare.com/ann

In the following sections, we will be covering how to install and configure this tool on `Pi-hole`.

**Note:** The `cloudflared` binary will work with other DoH providers (for example, you could use `https://8.8.8.8/dns-query` for Google's DNS-Over-HTTPS service).

### Installing `cloudflared`

The installation is fairly straightforward, however, be aware of what architecture you are installing on (`amd64` or `arm`).
Expand Down Expand Up @@ -64,8 +66,6 @@ Proceed to create a configuration file for `cloudflared` by copying the followin
CLOUDFLARED_OPTS=--port 5053 --upstream https://1.1.1.1/dns-query --upstream https://1.0.0.1/dns-query
```

**Note:** The `cloudflared` binary will work with other DoH providers (for example, you could use `https://8.8.8.8/dns-query` for Google DNS).

Update the permissions for the configuration file and `cloudflared` binary to allow access for the cloudflared user:

```bash
Expand Down Expand Up @@ -178,8 +178,12 @@ Finally, configure Pi-hole to use the local `cloudflared` service as the upstrea
(don't forget to hit Return or click on `Save`)

### Updating `cloudflared`
The `cloudflared` tool will not receive updates through the package manager. However, you should keep the program update to date. You can either do this manually, or via a cron script.

#### Manual way
The procedure for updating depends on how you configured the `cloudflared` binary.

#### If you configured cloudflared with your own service files
If you configured `cloudflared` manually (by writing a systemd unit yourself), to update the binary you'll simply redownload the binary from the same link, and repeat the install procedure.

```bash
wget https://bin.equinox.io/c/VdrWdbjqyF/cloudflared-stable-linux-arm.tgz
Expand All @@ -192,13 +196,25 @@ cloudflared -v
sudo systemctl status cloudflared
```

#### Automatic way
#### If you configued cloudflared via `service install`
If you configured `cloudflared` using their `service install` command, then you can use the built in update command.

```bash
sudo cloudflared update
sudo systemctl restart cloudflared
```

#### Automating Cloudflared Updates
If you want to have the system update `cloudflared` automatically, simply place the update commands for your configuration method in the
file `/etc/cron.weekly/cloudflared-updater.sh`, and adjust permissions:

```bash
sudo chmod +x /etc/cron.weekly/cloudflared-updater.sh
sudo chown root:root /etc/cron.weekly/cloudflared-updater.sh
```

The system will now attempt to update the cloudflared binary automatically, once per week.

### Uninstalling `cloudflared`

#### If installed the manual way
Expand All @@ -224,24 +240,4 @@ sudo systemctl daemon-reload

After the above, don't forget to change the DNS back to something else in Pi-hole's DNS settings!

[^guide]: Based on [this guide by Ben Dews | bendews.com](https://bendews.com/posts/implement-dns-over-https/)

### Updating Cloudflared

The `cloudflared` tool will not receive updates through the package manager, however it can be updated
manually by running these commands:

```bash
sudo cloudflared update
sudo systemctl restart cloudflared
```

If you want to have the system update `cloudflared` automatically, simply place the update commands in the
file `/etc/cron.weekly/cloudflared-updater.sh`, and adjust permissions:

```bash
sudo chmod +x /etc/cron.weekly/cloudflared-updater.sh
sudo chown root:root /etc/cron.weekly/cloudflared-updater.sh
```

The system will now attempt to update the cloudflared binary automatically, once per week.
[^guide]: Based on [this guide by Ben Dews | bendews.com](https://bendews.com/posts/implement-dns-over-https/)

0 comments on commit 08123a2

Please sign in to comment.