Container deployed with working VPN server built-in. Missing is persistency among recreations, looking into that...

This commit is contained in:
Daan
2024-06-04 22:49:17 +02:00
parent 06193d27c0
commit 0938f5ab71
3 changed files with 46 additions and 9 deletions

View File

@@ -1,10 +1,8 @@
echo "Starting the WireGuard Dashboard."
outgoing=$(ip -o -4 route show to default | awk '{print $NF}')
echo $outgoing
# Starting the WireGuard Dashboard Web-UI.
. ${WGDASH}/venv/bin/activate
cd /opt/wireguardashboard/app/src
cd ${WGDASH}/app/src
bash ./wgd.sh start
if [ "$tz" != "Europe/Amsterdam" ]; then
@@ -12,6 +10,18 @@ if [ "$tz" != "Europe/Amsterdam" ]; then
ln -sf /usr/share/zoneinfo/$tz /etc/localtime
fi
if [ "$global_dns" != "1.1.1.1" ]; then # Changing the DNS used for clients. Had to change it in 2 locations.
echo "Changing default dns..."
sed -i 's/^DNS = .*/DNS = ${global_dns}/' /etc/wireguard/wg0.conf
sed -i "s/^peer_global_dns = .*/peer_global_dns = $global_dns/" /opt/wireguardashboard/app/src/wg-dashboard.ini
fi
if [ "$public_ip" != "0.0.0.0" ]; then # Setting the public IP of the WireGuard Dashboard container host. If not defined, it will be tried using ifconfig.me.
sed -i "s/^remote_endpoint = .*/remote_endpoint = $public_ip/" /opt/wireguardashboard/app/src/wg-dashboard.ini
else
sed -i "s/^remote_endpoint = .*/remote_endpoint = $(curl ifconfig.me)/" /opt/wireguardashboard/app/src/wg-dashboard.ini
fi
sleep 3s
tail -f /opt/wireguardashboard/app/src/log/*.log