Skip to content

Instantly share code, notes, and snippets.

@darkerego
Created December 24, 2022 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save darkerego/331ed9616653f195f485191bb3e20a85 to your computer and use it in GitHub Desktop.
Save darkerego/331ed9616653f195f485191bb3e20a85 to your computer and use it in GitHub Desktop.
dnscrypt_installer.sh
#!/usr/bin/env bash
echo "Updating the system ... "
apt-get -y update
echo "Installing the packages ... "
apt-get -y install dnscrypt-proxy dnsutils net-tools
cat << _EOF_ >> /etc/dnscrypt-proxy/dnscrypt-proxy.toml
# Empty listen_addresses to use systemd socket activation
listen_addresses = ['10.8.0.1:53', '127.0.0.127:53']
server_names = ['cloudflare', 'ams-dnscrypt-nl']
[query_log]
file = '/var/log/dnscrypt-proxy/query.log'
[nx_log]
file = '/var/log/dnscrypt-proxy/nx.log'
[sources]
[sources.'public-resolvers']/etc/dnscrypt-proxy/dnscrypt-proxy.toml
url = 'https://download.dnscrypt.info/resolvers-list/v2/public-resolvers.md'
cache_file = '/var/cache/dnscrypt-proxy/public-resolvers.md'
minisign_key = 'RWQf6LRCGA9i53mlYecO4IzT51TGPpvWucNSCh1CBM0QTaLn73Y7GFO3'
refresh_delay = 72
prefix = ''
_EOF_
echo "Configuring dnscrypt ... "
systemctl stop dnscrypt-proxy.service
systemctl stop dnscrypt-proxy.socket
systemctl disable dnscrypt-proxy.socket
systemctl disable dnscrypt-proxy.service
rm /lib/systemd/system/dnscrypt-proxy.service /lib/systemd/system/dnscrypt-prox>
rm /var/lib/systemd/deb-systemd-helper-enabled/dnscrypt-proxy.service.dsh-also >
systemctl daemon-reload
systemctl reset-failed
dnscrypt-proxy -config /etc/dnscrypt-proxy/dnscrypt-proxy.toml -service install
service dnscrypt-proxy start
echo "Lets see if that worked ... hopefully dnscrypt is running and listening on 127.0.0.127 ..."
ss -atnu | grep 127.0.0.127 && echo "Successful!"||echo "Dnscrypt failed to start. Please ask your admin for help."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment