Paul-Christian Volkmer 18bda9f1c6 Use dnsmasq and configure dns server config for clients
This will add a DNS config to the client configurations pointing to the
wireguard server. With this configuration, all DNS requests are sent
through the VPN and are no longer answered by the local DNS server.

Each client now has a hostname like <device>-client<id>.
2023-01-21 01:41:41 +01:00

18 lines
342 B
Bash
Executable File

#!/bin/bash
if [ ! -f "$DEVICE-client_$1.conf" ]; then
echo "No client $1"
exit 1
fi
CONFIG=$(cat "$DEVICE.conf" | sed "/^\# Client $1/{N;N;N;N;d}")
echo "$CONFIG" > "$DEVICE.conf"
rm "$DEVICE-client_$1.conf" 2>/dev/null
rm "$DEVICE-client_$1.png" 2>/dev/null
# Update dnsmasq hosts file
/scripts/hosts.sh
echo "Client # $1 removed"