2023-10-28 21:38:26 +02:00
|
|
|
#!/bin/bash
|
2023-11-01 18:05:46 +01:00
|
|
|
########################################################
|
|
|
|
########################################################
|
2023-11-14 19:54:51 +01:00
|
|
|
# Wire-G App for simple management a Wireguard TUNNEL ##
|
2023-11-01 18:05:46 +01:00
|
|
|
# Author: Désiré Werner Menrath ##
|
|
|
|
# Email: polunga40@unity-mail.de ##
|
|
|
|
# Translate German to English with LibreTranslate ##
|
|
|
|
# Translatefiles edit with Poedit ##
|
|
|
|
# Use without warranty! ##
|
|
|
|
########################################################
|
|
|
|
########################################################
|
|
|
|
|
2023-11-01 17:44:23 +01:00
|
|
|
Encoding=UTF-8
|
2023-11-01 18:05:46 +01:00
|
|
|
|
2023-11-01 17:44:23 +01:00
|
|
|
# i18n - Internationalization - Internationalisierung
|
2023-11-01 18:05:46 +01:00
|
|
|
|
2023-11-01 21:46:24 +01:00
|
|
|
export TEXTDOMAIN=wire-g
|
|
|
|
export TEXTDOMAINDIR="/usr/share/locale"
|
2023-11-01 18:05:46 +01:00
|
|
|
|
2023-10-28 21:38:26 +02:00
|
|
|
############################################################################################################
|
|
|
|
############################################################################################################
|
2023-11-20 20:33:34 +01:00
|
|
|
VERSION=3.1.9
|
2023-10-28 21:38:26 +02:00
|
|
|
# wg_workdir Arbeitsverzeichnis wg
|
2023-11-14 19:54:51 +01:00
|
|
|
WG_WDIR="/home/$USER/.config/wg_nmcli/"
|
2023-10-28 21:38:26 +02:00
|
|
|
# Pfad wg Icons
|
2023-11-14 19:54:51 +01:00
|
|
|
WG_PIC="/home/$USER/.icons/"
|
|
|
|
# Wireguard TUNNEL auslesen mit grep nur Wireguard zeigen
|
2023-11-16 17:27:05 +01:00
|
|
|
# mit sed alles nach dem ersten Leerzeichen bis Zeilenende weggeschneiden und tunnel.txt schreiben
|
|
|
|
nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' > ${WG_WDIR}tunnel.txt
|
2023-11-14 19:54:51 +01:00
|
|
|
# Variable der verfügbaren TUNNELanzeige für Yad
|
|
|
|
TUNNEL=$(nmcli connection show | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
|
|
|
|
# Variable der aktiven TUNNELanzeige für Yad
|
|
|
|
ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
|
2023-11-16 12:42:18 +01:00
|
|
|
# Dies zeigt auf die richtige pid
|
|
|
|
|
2023-11-16 17:27:05 +01:00
|
|
|
############################################################################################################
|
2023-11-16 12:42:18 +01:00
|
|
|
############################################################################################################
|
2023-10-28 21:38:26 +02:00
|
|
|
|
|
|
|
wg_notify(){
|
2023-11-27 09:19:40 +01:00
|
|
|
sleep 1
|
2023-11-19 18:08:47 +01:00
|
|
|
nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${WG_WDIR}onstart.txt
|
|
|
|
ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
|
2023-11-20 20:39:48 +01:00
|
|
|
case $LANG in
|
|
|
|
|
|
|
|
de_DE.UTF-8) OPEN=öffnen ;;
|
|
|
|
|
|
|
|
*) OPEN=open ;;
|
|
|
|
esac
|
2023-11-15 12:38:16 +01:00
|
|
|
yad --image-on-top --image=${WG_PIC}wg-vpn-info.png \
|
|
|
|
--undecorated --borders=8 --skip-taskbar \
|
2023-11-15 17:14:31 +01:00
|
|
|
--text-align=center --no-buttons --auto-close \
|
2023-11-17 23:09:03 +01:00
|
|
|
--timeout 1 \
|
2023-11-20 20:06:33 +01:00
|
|
|
--text=$"<span color='#0fad0a'><b>$ACTIVE</b></span> <span><b>powered</b></span>"
|
2023-11-19 15:59:41 +01:00
|
|
|
|
2023-11-10 22:50:33 +01:00
|
|
|
yad --notification \
|
2023-11-16 12:42:18 +01:00
|
|
|
--image="${WG_PIC}wg-vpn.png" \
|
|
|
|
--icon-size=32 --no-middle \
|
|
|
|
--text=$"$ACTIVE activ" \
|
2023-11-20 18:25:36 +01:00
|
|
|
--menu=$"Wire-G open!/sbin/wire_g
|
2023-11-16 20:08:18 +01:00
|
|
|
|$ACTIVE stop!/sbin/wg_stop" \
|
2023-11-16 12:42:18 +01:00
|
|
|
--command="menu" &
|
2023-11-15 17:56:10 +01:00
|
|
|
# Schreib die pid von Notify in
|
2023-11-15 20:08:09 +01:00
|
|
|
pid=$(ps aux | grep yad | grep -v grep | awk '{print $2}')
|
2023-11-16 17:27:05 +01:00
|
|
|
echo $pid > ${WG_WDIR}for-kill_pid.txt
|
2023-11-18 09:52:55 +01:00
|
|
|
IFS=$'\n' lines=( $(cat ${WG_WDIR}for-kill_pid.txt) )
|
2023-11-16 18:32:58 +01:00
|
|
|
|
2023-11-15 20:08:09 +01:00
|
|
|
}
|
2023-11-15 20:22:37 +01:00
|
|
|
|
2023-10-28 21:38:26 +02:00
|
|
|
# function end
|
|
|
|
############################################################################################################
|
|
|
|
############################################################################################################
|
|
|
|
# funktion wireguard import
|
|
|
|
|
|
|
|
import_wg(){
|
2023-11-17 21:00:29 +01:00
|
|
|
|
2023-11-14 19:54:51 +01:00
|
|
|
if WG_CONF=$(yad --file --separator=" \n" \
|
2023-11-16 12:42:18 +01:00
|
|
|
--button="OK" --button=$"Cancel" \
|
|
|
|
--width=1200 --height=800 --no-klick \
|
|
|
|
--window-icon=${WG_PIC}wg-import.png \
|
|
|
|
--title=$"Wireguard .conf Select file")
|
2023-11-08 17:53:22 +01:00
|
|
|
then
|
2023-11-17 21:00:29 +01:00
|
|
|
echo $WG_CONF > ${WG_WDIR}exist.txt
|
|
|
|
if grep -f ${WG_WDIR}tunnel.txt ${WG_WDIR}exist.txt
|
|
|
|
then
|
2023-11-16 20:34:33 +01:00
|
|
|
yad --image-on-top --image=${WG_PIC}wg-info.png \
|
|
|
|
--text=$"Tunnel already exists!" \
|
2023-11-17 21:00:29 +01:00
|
|
|
--text-align=center --button "OK" \
|
2023-11-16 20:34:33 +01:00
|
|
|
--borders=8 --undecorated \
|
2023-11-17 21:00:29 +01:00
|
|
|
--timeout-indicator=bottom --skip-taskbar
|
|
|
|
import_wg
|
2023-11-17 21:18:09 +01:00
|
|
|
else
|
2023-11-17 21:26:55 +01:00
|
|
|
|
2023-11-17 21:18:09 +01:00
|
|
|
case "$WG_CONF" in
|
|
|
|
|
|
|
|
*_*.conf) if grep -i 'PEER\|PublicKey' $WG_CONF > /dev/null && grep -i 'Interface\|PrivateKey' $WG_CONF > /dev/null
|
|
|
|
then
|
|
|
|
ACTIVE=$(nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//')
|
|
|
|
if [[ -n $ACTIVE ]]
|
|
|
|
then
|
|
|
|
wg_stop
|
|
|
|
nmcli connection import type wireguard file $WG_CONF &> ${WG_WDIR}.tmp.txt
|
|
|
|
wg_notify
|
|
|
|
else
|
|
|
|
kill $lines
|
|
|
|
nmcli connection import type wireguard file $WG_CONF &> ${WG_WDIR}.tmp.txt
|
|
|
|
wg_notify
|
2023-11-27 12:44:08 +01:00
|
|
|
fi
|
2023-11-22 18:23:38 +01:00
|
|
|
nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${WG_WDIR}onstart.txt
|
2023-11-27 12:44:08 +01:00
|
|
|
IFS=$'\n' WG_START=( $(cat ${WG_WDIR}onstart.txt) )
|
|
|
|
nmcli con mod "$WG_START" connection.autoconnect no
|
2023-11-17 21:26:55 +01:00
|
|
|
fi ;;
|
2023-11-17 21:18:09 +01:00
|
|
|
|
|
|
|
*) yad --image-on-top --image=${WG_PIC}wg-info.png --height=150 --width=240 \
|
|
|
|
--text-align=center --undecorated --skip-taskbar \
|
|
|
|
--borders=12 --button="OK" --buttons-layout=center --center \
|
|
|
|
--text $"<b>Oh, something went wrong. No valid Wireguard file. </b> \n
|
2023-11-17 21:00:29 +01:00
|
|
|
<b>Here is an example:</b><span color='#0fad0a'><b> my_wireguard.conf</b></span>"
|
2023-11-08 17:53:22 +01:00
|
|
|
import_wg ;;
|
2023-11-17 21:18:09 +01:00
|
|
|
esac
|
2023-11-17 21:31:03 +01:00
|
|
|
fi
|
2023-11-17 21:00:29 +01:00
|
|
|
|
2023-11-10 20:48:17 +01:00
|
|
|
fi }
|
2023-10-28 21:38:26 +02:00
|
|
|
|
|
|
|
# function end
|
|
|
|
############################################################################################################
|
|
|
|
############################################################################################################
|
|
|
|
# funktion wireguard remove
|
|
|
|
|
|
|
|
remove(){
|
2023-11-14 12:44:31 +01:00
|
|
|
|
2023-11-14 19:54:51 +01:00
|
|
|
nmcli connection show --active | grep -iPo "(.*)(wireguard)" | sed 's/ .*//' &> ${WG_WDIR}.wg_noactive.txt
|
|
|
|
ACTIVE=$(cat ${WG_WDIR}.wg_noactive.txt)
|
2023-10-28 21:38:26 +02:00
|
|
|
|
2023-11-14 20:03:48 +01:00
|
|
|
nmcli connection delete $SELECTION &> ${WG_WDIR}.tmp.txt
|
|
|
|
if SUCCESS=$(grep -i 'erfolgreich gelöscht\|successfully deleted' ${WG_WDIR}.tmp.txt)
|
|
|
|
then
|
2023-11-15 12:38:16 +01:00
|
|
|
yad --window-icon=${WG_PIC}wg-trash.png --undecorated \
|
2023-11-29 20:33:07 +01:00
|
|
|
--image-on-top --image=${WG_PIC}wg-trash-info.png \
|
2023-11-23 18:30:44 +01:00
|
|
|
--text=$"<span>Your Tunnel $SELECTION was successfully deleted.</span> \n
|
2023-11-24 12:18:30 +01:00
|
|
|
<span>Attention! The autostart has been reset.</span> \n
|
2023-11-24 12:44:28 +01:00
|
|
|
<span>If you need the autostart for another tunnel,</span> \n
|
2023-11-24 12:18:30 +01:00
|
|
|
<span>please activate it again.</span> \n" \
|
2023-11-15 12:38:16 +01:00
|
|
|
--text-align=center --button=$"OK" \
|
2023-11-23 18:30:44 +01:00
|
|
|
--fixed --buttons-layout=center --borders=8
|
2023-11-14 20:03:48 +01:00
|
|
|
else
|
2023-11-15 12:38:16 +01:00
|
|
|
yad --window-icon=${WG_PIC}wg-trash.png --undecorated \
|
2023-11-22 20:38:44 +01:00
|
|
|
--image-on-top --image=${WG_PIC}wg-trash-info.png \
|
2023-11-14 20:03:48 +01:00
|
|
|
--text=$"Oh something went wrong.\nPlease delete Tunnel in the network manager." \
|
2023-11-15 12:38:16 +01:00
|
|
|
--text-align=center --button=$"OK" --height=60 --width=350 \
|
|
|
|
--buttons-layout=center --borders=8 --fixed
|
2023-11-14 20:03:48 +01:00
|
|
|
fi
|
2023-11-14 12:31:52 +01:00
|
|
|
|
2023-11-14 20:03:48 +01:00
|
|
|
if [ "$SELECTION" = "$ACTIVE" ]
|
|
|
|
then
|
2023-11-18 09:52:55 +01:00
|
|
|
IFS=$'\n' lines=( $(cat ${WG_WDIR}for-kill_pid.txt) )
|
2023-11-16 12:42:18 +01:00
|
|
|
kill $lines
|
2023-11-29 19:40:28 +01:00
|
|
|
echo > ${WG_WDIR}onstart.txt
|
2023-11-23 18:30:44 +01:00
|
|
|
fi
|
|
|
|
if grep 'TRUE TRUE' ${WG_WDIR}about.txt
|
|
|
|
then
|
|
|
|
echo FALSE TRUE > ${WG_WDIR}about.txt
|
|
|
|
|
|
|
|
elif grep 'TRUE FALSE' ${WG_WDIR}about.txt
|
|
|
|
then
|
|
|
|
echo FALSE FALSE > ${WG_WDIR}about.txt
|
|
|
|
fi
|
|
|
|
rm /home/$USER/.config/autostart/wgonstart.desktop
|
|
|
|
}
|
|
|
|
|
2023-11-10 22:20:33 +01:00
|
|
|
|
2023-10-28 21:38:26 +02:00
|
|
|
# function end
|
|
|
|
############################################################################################################
|
|
|
|
############################################################################################################
|
2023-11-14 19:54:51 +01:00
|
|
|
#funktion for active TUNNEL a stop
|
2023-11-07 20:37:53 +01:00
|
|
|
|
2023-11-01 09:54:42 +01:00
|
|
|
up_or_down(){
|
2023-11-14 19:54:51 +01:00
|
|
|
|
|
|
|
if [[ -z $ACTIVE ]]
|
2023-11-01 10:31:14 +01:00
|
|
|
then
|
2023-11-14 19:54:51 +01:00
|
|
|
yad --image-on-top --image=${WG_PIC}wg-info.png \
|
2023-11-15 12:38:16 +01:00
|
|
|
--text=$"There is no active Tunnel that you could stop." \
|
2023-11-14 21:09:08 +01:00
|
|
|
--text-align=center --no-buttons \
|
2023-11-14 19:54:51 +01:00
|
|
|
--borders=8 --undecorated \
|
2023-11-16 12:42:18 +01:00
|
|
|
--timeout 3 --timeout-indicator=bottom --skip-taskbar
|
2023-11-01 10:31:14 +01:00
|
|
|
else
|
|
|
|
wg_stop
|
2023-11-01 09:54:42 +01:00
|
|
|
|
2023-11-01 10:31:14 +01:00
|
|
|
fi }
|
2023-11-01 09:54:42 +01:00
|
|
|
|
|
|
|
# funktion end
|
|
|
|
############################################################################################################
|
2023-11-29 20:33:07 +01:00
|
|
|
############################################################################################################
|
2023-11-20 16:59:50 +01:00
|
|
|
#for about of select Autostart
|
|
|
|
|
|
|
|
on_start(){
|
|
|
|
|
|
|
|
if [ -d /home/$USER/.config/autostart ] # for GNOME, XFCE, KDE, Budgie
|
|
|
|
then
|
|
|
|
if grep 'TRUE TRUE\|TRUE FALSE' ${WG_WDIR}about.txt
|
|
|
|
then
|
|
|
|
cp /home/"$USER"/.local/share/wg_nmcli/wgonstart.desktop /home/"$USER"/.config/autostart/
|
|
|
|
else
|
|
|
|
rm /home/"$USER"/.config/autostart/wgonstart.desktop
|
|
|
|
fi
|
|
|
|
|
|
|
|
elif [ -d /home/$USER/.config/lxsession/Lubuntu/autostart ] # for LXDE
|
|
|
|
then
|
|
|
|
if grep 'TRUE TRUE\|TRUE FALSE' ${WG_WDIR}about.txt
|
|
|
|
then
|
2023-11-29 20:33:07 +01:00
|
|
|
cp /home/"$USER"/.local/share/wg_nmcli/wgonstart.desktop /home/$USER/.config/lxsession/Lubuntu/autostart/
|
2023-11-20 16:59:50 +01:00
|
|
|
else
|
|
|
|
rm /home/$USER/.config/lxsession/Lubuntu/autostart/wgonstart.desktop
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2023-11-29 19:40:28 +01:00
|
|
|
#function on_start end
|
2023-11-16 17:27:05 +01:00
|
|
|
# function button "about"
|
2023-10-29 18:33:07 +01:00
|
|
|
|
2023-11-10 12:44:08 +01:00
|
|
|
about(){
|
2023-11-29 19:40:28 +01:00
|
|
|
|
|
|
|
IFS=$'\n' WG_START=( $(cat ${WG_WDIR}onstart.txt) )
|
|
|
|
if [[ -z "$WG_START" ]]
|
|
|
|
then
|
|
|
|
yad --form --fixed \
|
|
|
|
--borders=8 --buttons-layout=center --text-align=center \
|
|
|
|
--button="OK" --undecorated \
|
|
|
|
--image-on-top --image=${WG_PIC}wg-info.png \
|
|
|
|
--separator=" " \
|
|
|
|
--text=$"<span>If they activate the car start,</span> \n
|
|
|
|
<span>then they need to start a tunnnel so that the car start works correctly.</span>\n"
|
|
|
|
fi
|
|
|
|
|
2023-11-19 11:21:45 +01:00
|
|
|
if grep 'TRUE TRUE' ${WG_WDIR}about.txt
|
2023-11-19 11:15:52 +01:00
|
|
|
then
|
|
|
|
yad --form --fixed \
|
|
|
|
--borders=8 --buttons-layout=center --text-align=center \
|
|
|
|
--button="OK" --undecorated \
|
2023-11-20 18:25:36 +01:00
|
|
|
--field=$"Autoconnect on PC Start:CHK" TRUE \
|
2023-11-20 20:31:56 +01:00
|
|
|
--field=$"Search automatically for Wire-G updates:CHK" TRUE \
|
2023-11-19 11:15:52 +01:00
|
|
|
--image-on-top --image=${WG_PIC}wg-vpn-info.png \
|
|
|
|
--separator=" " --window-icon=${WG_PIC}wg-vpn.png \
|
|
|
|
--text=$"<span color='#626ff1'><b>Wire-G Author: Désiré Werner Menrath</b></span> \n
|
|
|
|
<span color='#626ff1'><b>E-Mail: polunga40@unity-mail.de</b></span> \n
|
|
|
|
<span color='#626ff1'><b>At all Tunnels, the auto start is disabled.</b></span> \n
|
|
|
|
<span color='#626ff1'><b>Version: $VERSION </b></span> \n
|
|
|
|
<span color='#626ff1'><b>Use without warranty.</b></span> \n
|
2023-11-20 17:16:38 +01:00
|
|
|
<a href='https://git.lunix.dedyn.io/punix/Wire-G/releases'>Download Wire-G </a> \n" &> ${WG_WDIR}about.txt
|
2023-11-14 19:54:51 +01:00
|
|
|
|
2023-11-20 16:59:50 +01:00
|
|
|
on_start
|
|
|
|
|
2023-11-19 11:21:45 +01:00
|
|
|
elif grep 'FALSE TRUE' ${WG_WDIR}about.txt
|
2023-11-19 11:15:52 +01:00
|
|
|
then
|
|
|
|
yad --form --fixed \
|
|
|
|
--borders=8 --buttons-layout=center --text-align=center \
|
|
|
|
--button="OK" --undecorated \
|
2023-11-20 18:25:36 +01:00
|
|
|
--field=$"Autoconnect on PC Start:CHK" FALSE \
|
2023-11-20 20:27:48 +01:00
|
|
|
--field=$"Search automatically for Wire-G updates:CHK" TRUE \
|
2023-11-19 11:15:52 +01:00
|
|
|
--image-on-top --image=${WG_PIC}wg-vpn-info.png \
|
|
|
|
--separator=" " --window-icon=${WG_PIC}wg-vpn.png \
|
|
|
|
--text=$"<span color='#626ff1'><b>Wire-G Author: Désiré Werner Menrath</b></span> \n
|
|
|
|
<span color='#626ff1'><b>E-Mail: polunga40@unity-mail.de</b></span> \n
|
|
|
|
<span color='#626ff1'><b>At all Tunnels, the auto start is disabled.</b></span> \n
|
|
|
|
<span color='#626ff1'><b>Version: $VERSION </b></span> \n
|
|
|
|
<span color='#626ff1'><b>Use without warranty.</b></span> \n
|
2023-11-20 17:16:38 +01:00
|
|
|
<a href='https://git.lunix.dedyn.io/punix/Wire-G/releases'>Download Wire-G </a> \n" &> ${WG_WDIR}about.txt
|
2023-11-19 11:15:52 +01:00
|
|
|
|
2023-11-20 16:59:50 +01:00
|
|
|
on_start
|
|
|
|
|
2023-11-19 11:21:45 +01:00
|
|
|
elif grep 'FALSE FALSE' ${WG_WDIR}about.txt
|
2023-11-19 11:15:52 +01:00
|
|
|
then
|
|
|
|
yad --form --fixed \
|
|
|
|
--borders=8 --buttons-layout=center --text-align=center \
|
|
|
|
--button="OK" --undecorated \
|
2023-11-20 18:25:36 +01:00
|
|
|
--field=$"Autoconnect on PC Start:CHK" FALSE \
|
2023-11-20 20:31:56 +01:00
|
|
|
--field=$"Search automatically for Wire-G updates:CHK" FALSE \
|
2023-11-19 11:15:52 +01:00
|
|
|
--image-on-top --image=${WG_PIC}wg-vpn-info.png \
|
|
|
|
--separator=" " --window-icon=${WG_PIC}wg-vpn.png \
|
|
|
|
--text=$"<span color='#626ff1'><b>Wire-G Author: Désiré Werner Menrath</b></span> \n
|
2023-11-29 20:33:07 +01:00
|
|
|
<span color='#626ff1'><b>E-Mail: polunga40@unity-mail.de</b></span> \n
|
2023-11-19 11:15:52 +01:00
|
|
|
<span color='#626ff1'><b>At all Tunnels, the auto start is disabled.</b></span> \n
|
|
|
|
<span color='#626ff1'><b>Version: $VERSION </b></span> \n
|
|
|
|
<span color='#626ff1'><b>Use without warranty.</b></span> \n
|
2023-11-20 17:16:38 +01:00
|
|
|
<a href='https://git.lunix.dedyn.io/punix/Wire-G/releases'>Download Wire-G </a> \n" &> ${WG_WDIR}about.txt
|
2023-11-19 11:15:52 +01:00
|
|
|
|
2023-11-20 16:59:50 +01:00
|
|
|
on_start
|
2023-11-29 20:25:24 +01:00
|
|
|
|
2023-11-19 11:21:45 +01:00
|
|
|
elif grep 'TRUE FALSE' ${WG_WDIR}about.txt
|
2023-11-19 11:15:52 +01:00
|
|
|
then
|
|
|
|
yad --form --fixed \
|
|
|
|
--borders=8 --buttons-layout=center --text-align=center \
|
|
|
|
--button="OK" --undecorated \
|
2023-11-20 18:25:36 +01:00
|
|
|
--field=$"Autoconnect on PC Start:CHK" TRUE \
|
2023-11-20 20:31:56 +01:00
|
|
|
--field=$"Search automatically for Wire-G updates:CHK" FALSE \
|
2023-11-19 11:15:52 +01:00
|
|
|
--image-on-top --image=${WG_PIC}wg-vpn-info.png \
|
|
|
|
--separator=" " --window-icon=${WG_PIC}wg-vpn.png \
|
|
|
|
--text=$"<span color='#626ff1'><b>Wire-G Author: Désiré Werner Menrath</b></span> \n
|
2023-11-03 14:05:31 +01:00
|
|
|
<span color='#626ff1'><b>E-Mail: polunga40@unity-mail.de</b></span> \n
|
2023-11-14 19:54:51 +01:00
|
|
|
<span color='#626ff1'><b>At all Tunnels, the auto start is disabled.</b></span> \n
|
|
|
|
<span color='#626ff1'><b>Version: $VERSION </b></span> \n
|
2023-11-03 18:30:57 +01:00
|
|
|
<span color='#626ff1'><b>Use without warranty.</b></span> \n
|
2023-11-20 17:16:38 +01:00
|
|
|
<a href='https://git.lunix.dedyn.io/punix/Wire-G/releases'>Download Wire-G </a> \n" &> ${WG_WDIR}about.txt
|
2023-11-03 14:05:31 +01:00
|
|
|
|
2023-11-20 16:59:50 +01:00
|
|
|
on_start
|
|
|
|
|
2023-11-19 11:21:45 +01:00
|
|
|
fi
|
|
|
|
|
2023-10-29 18:33:07 +01:00
|
|
|
}
|
2023-11-01 07:57:13 +01:00
|
|
|
|
2023-10-29 18:33:07 +01:00
|
|
|
# function end
|
|
|
|
############################################################################################################
|
|
|
|
############################################################################################################
|
2023-10-28 21:38:26 +02:00
|
|
|
# funktion wireguard enable select Tunnel
|
|
|
|
|
|
|
|
connect(){
|
|
|
|
|
2023-11-14 19:54:51 +01:00
|
|
|
if SUCCESS=$(grep -i 'erfolgreich aktiviert\|successfully activated' ${WG_WDIR}.tmp.txt)
|
2023-11-19 15:59:41 +01:00
|
|
|
then
|
2023-11-14 18:18:43 +01:00
|
|
|
wg_notify
|
2023-11-14 18:09:15 +01:00
|
|
|
|
2023-10-30 19:44:47 +01:00
|
|
|
fi }
|
2023-10-28 21:38:26 +02:00
|
|
|
|
|
|
|
# function end
|
|
|
|
############################################################################################################
|
2023-11-29 12:17:31 +01:00
|
|
|
|
2023-11-18 15:34:52 +01:00
|
|
|
if [[ ! -d ${WG_WDIR} || ! -e ${WG_WDIR}about.txt ]]
|
|
|
|
then
|
|
|
|
mkdir -p /home/"$USER"/.config/wg_nmcli
|
|
|
|
echo FALSE TRUE > ${WG_WDIR}about.txt
|
|
|
|
fi
|
2023-11-29 12:17:31 +01:00
|
|
|
#Search on Updates
|
|
|
|
if AUTOUPDATE=$(grep 'TRUE TRUE\|FALSE TRUE' ${WG_WDIR}about.txt)
|
|
|
|
then
|
|
|
|
rm /tmp/CHANGELOG &> /dev/null
|
|
|
|
wget https://git.lunix.dedyn.io/punix/Wire-G/raw/branch/main/wg_nmcli/CHANGELOG -P /tmp
|
|
|
|
|
|
|
|
UPDATE=$(diff -q /home/"$USER"/.local/share/wg_nmcli/CHANGELOG /tmp/CHANGELOG)
|
|
|
|
|
|
|
|
if [[ -n "$UPDATE" ]]
|
|
|
|
then
|
|
|
|
yad --form --fixed \
|
|
|
|
--borders=8 --buttons-layout=center --text-align=center \
|
|
|
|
--button="OK" --undecorated \
|
|
|
|
--image-on-top --image=${WG_PIC}wg-vpn-info.png \
|
|
|
|
--separator=" " \
|
|
|
|
--text=$"<span>Update for Wireg-G is available.</span> \n
|
|
|
|
<a href='https://git.lunix.dedyn.io/punix/Wire-G'>Download Wire-G </a> \n"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
#Here is start Wire-G
|
2023-11-18 08:20:55 +01:00
|
|
|
SELECTION=$(yad --no-klick --list --center \
|
2023-11-10 21:05:43 +01:00
|
|
|
--height=300 --width=60 --title="Wire-G" \
|
|
|
|
--buttons-layout=center \
|
2023-11-16 12:42:18 +01:00
|
|
|
--button=$"Start:0" --button=$"Stop:2" \
|
|
|
|
--button=$"Import:3" --button=$"Remove:4" \
|
|
|
|
--button=$"About:5" --separator="" \
|
2023-11-14 19:54:51 +01:00
|
|
|
--window-icon=${WG_PIC}wg-vpn.png \
|
|
|
|
--borders=8 --image-on-top --image=${WG_PIC}wg-active.png \
|
2023-11-17 23:01:45 +01:00
|
|
|
--column=$"Selection" Tunnel \
|
|
|
|
--rest=${WG_WDIR}tunnel.txt \
|
2023-11-14 19:54:51 +01:00
|
|
|
--text=$"<b>Activ Tunnel: </b> <span color='#0fad0a'><b>$ACTIVE</b></span>
|
2023-11-15 17:24:27 +01:00
|
|
|
<b>-----------------------------------------------------------------------------------------------------</b>
|
2023-11-24 17:49:19 +01:00
|
|
|
<b>If no tunnels are listed,</b>
|
|
|
|
<b>you must first import your tunnel.</b>")
|
2023-11-14 20:03:48 +01:00
|
|
|
RET=$?
|
2023-11-14 12:42:40 +01:00
|
|
|
|
|
|
|
[[ $? -eq 1 ]] && exit 0
|
2023-11-11 21:02:41 +01:00
|
|
|
|
2023-11-16 12:42:18 +01:00
|
|
|
if [[ $RET -eq 2 ]]
|
|
|
|
then
|
2023-11-17 21:48:24 +01:00
|
|
|
up_or_down
|
2023-11-18 08:56:16 +01:00
|
|
|
wire_g
|
2023-11-16 12:42:18 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $RET -eq 3 ]]
|
|
|
|
then
|
|
|
|
import_wg
|
2023-11-18 08:56:16 +01:00
|
|
|
wire_g
|
2023-11-16 12:42:18 +01:00
|
|
|
fi
|
|
|
|
|
2023-11-14 20:03:48 +01:00
|
|
|
if [[ $RET -eq 4 ]]
|
|
|
|
then
|
|
|
|
remove
|
2023-11-18 08:56:16 +01:00
|
|
|
wire_g
|
2023-11-14 20:03:48 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ $RET -eq 5 ]]
|
2023-10-30 19:44:47 +01:00
|
|
|
then
|
2023-11-14 21:14:09 +01:00
|
|
|
about
|
2023-11-18 08:56:16 +01:00
|
|
|
wire_g
|
2023-11-14 12:42:40 +01:00
|
|
|
fi
|
|
|
|
|
2023-11-14 20:03:48 +01:00
|
|
|
if [[ $RET -eq 0 ]]
|
2023-11-14 12:42:40 +01:00
|
|
|
then
|
2023-11-14 19:54:51 +01:00
|
|
|
if [[ -n $ACTIVE ]]
|
2023-10-30 19:44:47 +01:00
|
|
|
then
|
2023-11-01 09:05:51 +01:00
|
|
|
wg_stop
|
2023-11-14 19:54:51 +01:00
|
|
|
nmcli connection up $SELECTION &> ${WG_WDIR}.tmp.txt
|
2023-11-18 08:56:16 +01:00
|
|
|
connect
|
|
|
|
wire_g
|
2023-10-30 19:44:47 +01:00
|
|
|
else
|
2023-11-14 19:54:51 +01:00
|
|
|
nmcli connection up $SELECTION &> ${WG_WDIR}.tmp.txt
|
2023-10-30 19:44:47 +01:00
|
|
|
connect
|
2023-11-18 08:56:16 +01:00
|
|
|
wire_g
|
2023-10-30 19:44:47 +01:00
|
|
|
fi
|
2023-11-14 12:31:52 +01:00
|
|
|
fi
|
2023-11-01 07:57:13 +01:00
|
|
|
############################################ END ##########################################################
|
2023-10-28 21:38:26 +02:00
|
|
|
|
2023-11-01 13:10:57 +01:00
|
|
|
|