hns_doh_loadbalancer/install.sh

29 lines
892 B
Bash
Raw Normal View History

2023-12-22 17:41:51 +11:00
#!/bin/bash
# Verify that script is being run as root
if [ "$EUID" -ne 0 ]
then echo "Please run as root to allow installation of dependencies."
exit
fi
2023-12-22 18:16:04 +11:00
chmod +x cert.sh cert.py
2023-12-22 17:41:51 +11:00
sudo apt-get install -y dnsdist
# Install certbot
2023-12-22 18:02:11 +11:00
sudo apt install snapd
sudo snap install --classic certbot
sudo ln -s /snap/bin/certbot /usr/bin/certbot
2023-12-22 17:41:51 +11:00
sudo certbot certonly --manual --manual-auth-hook ./cert.py --preferred-challenges dns -d hnsdoh.com --deploy-hook ./cert.sh
sudo cp ./resolved.conf /etc/systemd/resolved.conf
sudo systemctl restart systemd-resolved
# Move the conf file to the correct location
sudo cp ./dnsdist.conf /etc/dnsdist/dnsdist.conf
# Replace the user and group in the dnsdist.service file to root
# Like this
# User=root
# Group=root
sudo cp ./dnsdist.service /lib/systemd/system/dnsdist.service
sudo systemctl daemon-reload
# Restart dnsdist
sudo systemctl restart dnsdist