Skip to content

Instantly share code, notes, and snippets.

@bitbeans
Last active January 31, 2018 06:10
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 bitbeans/89c0b430f48a35cd39164aaa07fc15f2 to your computer and use it in GitHub Desktop.
Save bitbeans/89c0b430f48a35cd39164aaa07fc15f2 to your computer and use it in GitHub Desktop.
Automatic installation of dnscrypt on vultr. com
#!/bin/sh
yum -y update
export SERVER=$(hostname)
export SERVER_IP=`ip route get 1 | awk '{print $NF;exit}'`
echo $SERVER
echo $SERVER_IP
docker run --name=dnscrypt-server -p 443:443/udp -p 443:443/tcp --net=host jedisct1/dnscrypt-server init -N $SERVER -E $SERVER_IP:443
docker update --restart=unless-stopped dnscrypt-server
docker run -d --name watchtower -v /var/run/docker.sock:/var/run/docker.sock v2tec/watchtower dnscrypt-server
docker update --restart=unless-stopped watchtower
docker cp dnscrypt-server:/opt/dnscrypt-wrapper/etc/keys /root
yum remove -y firewalld
yum install -y iptables-services
systemctl start iptables
systemctl enable iptables
/usr/libexec/iptables/iptables.init save
sed -i 's/-A INPUT -i lo -j ACCEPT/\n-A INPUT -p udp -m state --state NEW -m udp --dport 443 -j ACCEPT/' /etc/sysconfig/iptables
sed -i 's/-A INPUT -i lo -j ACCEPT/\n-A INPUT -p tcp -m state --state NEW -m tcp --dport 443 -j ACCEPT/' /etc/sysconfig/iptables
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment