first commit

This commit is contained in:
hhofmann 2023-02-23 15:27:42 +01:00
commit 30240d2b93

31
wirebash.sh Executable file
View File

@ -0,0 +1,31 @@
#!/bin/bash
# Update Apt cache
sudo apt-get update
# Update Packete
sudo apt-get upgrade -y
# Installiere Wireguard
sudo apt-get install wireguard-tools -y
echo
echo "Gebe hier nun die Wireguard Konfiguration ein: (Beende eingabe mit strg+d)"
# Lese die Config Zeile bei Zeile
config=""
while read -r line; do
config+="$line"$'\n'
done
# Überprüfe ob im etc Ordner ein Wireguard Ordner exestiert, wenn nicht, erstelle diesen
if ! [ -d /etc/wireguard ]; then
sudo mkdir /etc/wireguard
fi
echo "$config" | sudo tee /etc/wireguard/wg0.conf >/dev/null
sudo systemctl enable wg-quick@wg0.service
sudo systemctl daemon-reload
sudo systemctl start wg-quick@wg0
if ping -c2 10.200.100.1 >/dev/null; then
echo "Wireguard wurde erfolgreich eingerichtet"
else
echo "Wireguard nicht Funktional! 10.200.100.1 konnte nicht angepingt werden!"
fi