-
Notifications
You must be signed in to change notification settings - Fork 1k
Updates
The script below will check to see if dnscrypt-proxy needs updating by comparing the installed version with the latest git version.
If the installed version is older, then the script will update to the newest version.
Tested on: Ubuntu 18.04
This script requires dnscrypt-proxy
to be installed as a service using,./dnscrypt-proxy -service install
and for dnscrypt-proxy
to be installed in /opt/dnscrypt-proxy
.
Initially make sure all the above requirements are met.
Then to get this script to automatically run add this as a cron job under root
using sudo crontab -e
but, change the file path to the file path the script is saved.
0 */12 * * * /path/dnscrypt-proxy-update.sh
Also, this script needs to be run as root
.
#! /bin/sh
INSTALL_DIR="/opt/dnscrypt-proxy"
LATEST_URL="https://api.github.com/repos/jedisct1/dnscrypt-proxy/releases/latest"
Update() {
workdir="$(mktemp -d)"
curl -sL $(curl -sL "$LATEST_URL" |
grep dnscrypt-proxy-linux_x86_64- | grep browser_download_url | head -1 | cut -d \" -f 4) |
tar xz -C "$workdir" -f - linux-x86_64/dnscrypt-proxy &&
[ -x linux-x86_64/dnscrypt-proxy ] &&
mv -f "${INSTALL_DIR}/dnscrypt-proxy" "${INSTALL_DIR}/dnscrypt-proxy.old" || : &&
mv -f "${workdir}/linux-x86_64/dnscrypt-proxy" "${INSTALL_DIR}/" &&
cd "$INSTALL_DIR" && rm -fr "$workdir" &&
./dnscrypt-proxy -check && ./dnscrypt-proxy -service install 2>/dev/null || : &&
./dnscrypt-proxy -service restart || ./dnscrypt-proxy -service start
}
lversion=$("${INSTALL_DIR}/dnscrypt-proxy" -version)
rmersion=$(curl -sL "$LATEST_URL" | grep "tag_name" | head -1 | cut -d \" -f 4)
[ -z "$lversion" ] && exit 1
[ -z "$rmersion" ] && exit 1
echo locally installed
echo "$lversion"
echo remote git version
echo "$rmersion"
if [ "$rmersion" != "$lversion" ]; then
echo "Updating" && Update
else
echo "No Update Needed"
fi
In somecases if you want to run dnscrypt-proxy as a non-root user you'll get the error "[FATAL] listen udp 0.0.0.0:53: bind: permission denied"
to solve this problem you can run the following command and allow dnscrypt to have access to a low level port :
sudo setcap cap_net_bind_service=+ep $(which dnscrypt-proxy)
- Home
- Installation
- Configuration
- Checking that your DNS traffic is encrypted
- Automatic Updates
- Server sources
- Combining blocklists
- Public Blocklist and other configuration files
- Building from source
- Run your own DNSCrypt server in under 10 minutes
- DNS stamps specifications
- Windows Tips
- dnscrypt-proxy in the media
- Planned Features