Cleaned up wireguard config
This commit is contained in:
parent
25b9c35a5c
commit
ec059b29d4
@ -88,12 +88,10 @@ cat > /federated/apps/wireguard/data/config/coredns/Corefile <<EOF
|
|||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
echo -ne "done."
|
echo -ne "done.\n"
|
||||||
}
|
}
|
||||||
email_wireguard() {
|
email_wireguard() {
|
||||||
echo -ne "* Sending email to customer.."
|
echo -ne "* Sending email to customer.."
|
||||||
spin &
|
|
||||||
SPINPID=$!
|
|
||||||
|
|
||||||
cat > /federated/apps/mail/data/root/certs/mailfile <<EOF
|
cat > /federated/apps/mail/data/root/certs/mailfile <<EOF
|
||||||
<html>
|
<html>
|
||||||
@ -133,13 +131,10 @@ EOF
|
|||||||
docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Application installed on $DOMAIN\" $EMAIL < /root/certs/mailfile"
|
docker exec mail bash -c "mail -r admin@$DOMAIN -a \"Content-type: text/html\" -s \"Application installed on $DOMAIN\" $EMAIL < /root/certs/mailfile"
|
||||||
rm /federated/apps/mail/data/root/certs/mailfile
|
rm /federated/apps/mail/data/root/certs/mailfile
|
||||||
|
|
||||||
kill -9 $SPINPID &> /dev/null
|
|
||||||
echo -ne "done.\n"
|
echo -ne "done.\n"
|
||||||
}
|
}
|
||||||
uninstall_wireguard() {
|
uninstall_wireguard() {
|
||||||
echo -ne "* Uninstalling wireguard container.."
|
echo -ne "* Uninstalling wireguard container.."
|
||||||
spin &
|
|
||||||
SPINPID=$!
|
|
||||||
|
|
||||||
# First stop the service
|
# First stop the service
|
||||||
cd /federated/apps/wireguard && docker compose -f docker-compose.yml -p wireguard down &> /dev/null
|
cd /federated/apps/wireguard && docker compose -f docker-compose.yml -p wireguard down &> /dev/null
|
||||||
@ -147,12 +142,19 @@ uninstall_wireguard() {
|
|||||||
# Delete the app directory
|
# Delete the app directory
|
||||||
rm -rf /federated/apps/wireguard
|
rm -rf /federated/apps/wireguard
|
||||||
|
|
||||||
kill -9 $SPINPID &> /dev/null
|
docker exec pdns pdnsutil delete-rrset $DOMAIN vpn A
|
||||||
|
docker exec pdns pdnsutil delete-rrset $DOMAIN wireguard A
|
||||||
|
|
||||||
echo -ne "done.\n"
|
echo -ne "done.\n"
|
||||||
}
|
}
|
||||||
start_wireguard() {
|
start_wireguard() {
|
||||||
# Start service with command to make sure it's up before proceeding
|
# Start service with command to make sure it's up before proceeding
|
||||||
start_service "wireguard" "nc -uvz 192.168.0.24 51820 &> /dev/null" "8"
|
start_service "wireguard" "nc -uvz 192.168.0.24 51820 &> /dev/null" "8"
|
||||||
|
|
||||||
|
docker exec pdns pdnsutil add-record $DOMAIN wireguard A 86400 $EXTERNALIP &> /dev/null
|
||||||
|
[ $? -ne 0 ] && fail "Couldn't add dns record"
|
||||||
|
docker exec pdns pdnsutil add-record $DOMAIN vpn A 86400 $EXTERNALIP &> /dev/null
|
||||||
|
[ $? -ne 0 ] && fail "Couldn't add dns record"
|
||||||
|
|
||||||
echo -ne "done."
|
echo -ne "done."
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user