Hi,
this is a reviewed HowTo that replaces the previous one.
Why dnscrypt is important?
In the same way the SSL turns HTTP web traffic into HTTPS encrypted Web traffic, DNSCrypt turns regular DNS traffic into encrypted DNS traffic that is secure from eavesdropping and man-in-the-middle attacks. extract.
This DNSCrypt installation has been tested successfully on RPI and RPI2 with the stable release OSMC
Install necessary system packages and reboot:
sudo apt-get update
sudo apt-get install build-essential locate bash-completion tcpdump dnsutils libsodium-dev
sudo reboot
Compile dnscrypt from source and install:
mkdir -p dnscrypt
cd dnscrypt
wget http://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-proxy-1.5.0.tar.gz
tar -xf dnscrypt-proxy-1.5.0.tar.gz
cd dnscrypt-proxy-1.5.0
sudo ldconfig
./configure
make
sudo make install
Configure the system
Preparing resolv.conf:
sudo mv /etc/resolv.conf /etc/resolv.conf.ORIGINAL
sudo nano /etc/resolv.conf
Then paste and save the following:
nameserver 127.0.0.2
Lock resolv.conf file
sudo chattr +i /etc/resolv.conf
Starts dnsproxy in daemon mode automatically in systemd (create & edit systemd service file, credits to: [hypechaotic][4]):
sudo touch /etc/systemd/system/multi-user.target.wants/dnscrypt-proxy.service
sudo nano /etc/systemd/system/multi-user.target.wants/dnscrypt-proxy.service
and paste & save the following:
[Unit]
Description=Secure connection between your computer and DNS resolver
After=network.target network-online.target
[Service]
Type=forking
Restart=always
RestartSec=5
PIDFile=/var/run/dnscrypt-proxy.pid
ExecStart=/usr/local/sbin/dnscrypt-proxy --daemonize \
-a 127.0.0.2 \
-R dnscrypt.eu-dk \
--edns-payload-size=4096 \
-p /var/run/dnscrypt-proxy.pid
[Install]
WantedBy=multi-user.target
Then reboot the RPI
sudo reboot
Test dnscrypt
sudo journalctl -u dnscrypt-proxy
You’ll get a similar output:
Apr 12 10:31:44 osmc dnscrypt-proxy[235]: Starting dnscrypt-proxy 1.4.3
Apr 12 10:31:44 osmc dnscrypt-proxy[235]: Initializing libsodium for optimal performance
Apr 12 10:31:44 osmc dnscrypt-proxy[235]: Generating a new key pair
Apr 12 10:31:44 osmc dnscrypt-proxy[235]: Done
Apr 12 10:31:49 osmc dnscrypt-proxy[235]: Server certificate #808864433 received
Apr 12 10:31:49 osmc dnscrypt-proxy[235]: This certificate looks valid
Apr 12 10:31:49 osmc dnscrypt-proxy[235]: Chosen certificate #808864433 is valid from [2014-09-11] to [2015-09-11]
Apr 12 10:31:49 osmc dnscrypt-proxy[235]: Server key fingerprint is 6231:4AFE:4AA3:7E6F:9B8C:DAA6:6F6E:E8x5:F8xB:10A8:6DB1:C5CB:
Apr 12 10:31:49 osmc dnscrypt-proxy[235]: Proxying from 127.0.0.2:53 to 176.56.x.x:443
Notes on this configuration:
I’ve choose as resolver name a DNS located in Denmark (dnscrypt.eu-dk); you can choose a different resolver here the list https://github.com/jedisct1/dnscrypt-proxy/blob/master/dnscrypt-resolvers.csv the resolver name to use is the one in the first column; plus I’ve choose a different local address (127.0.0.2) in order to avoid possible conflicts with 127.0.0.1 already taken by other network daemon of the system. Change your systemd service with your values.
That’s all folks! Happy crypt