update
This commit is contained in:
22
defaults.inc
22
defaults.inc
@@ -1,6 +1,6 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
VERS='2.02252023'
|
VERS='2.03042023'
|
||||||
|
|
||||||
MMFOLDER="/opt/idssys/mediamanager"
|
MMFOLDER="/opt/idssys/mediamanager"
|
||||||
MMSRV=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
|
MMSRV=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
|
||||||
@@ -8,7 +8,6 @@ MMSRV=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
|
|||||||
noheader=' check noup stop '
|
noheader=' check noup stop '
|
||||||
|
|
||||||
declare -A NM_SERVICES
|
declare -A NM_SERVICES
|
||||||
NM_SERVICES['nordvpn']='NordVPN (VPN Tunnel)'
|
|
||||||
NM_SERVICES['openvpn']='OpenVPN (TorGuard VPN Tunnel)'
|
NM_SERVICES['openvpn']='OpenVPN (TorGuard VPN Tunnel)'
|
||||||
NM_SERVICES['wireguard']='WireGuard (TorGuard VPN Tunnel)'
|
NM_SERVICES['wireguard']='WireGuard (TorGuard VPN Tunnel)'
|
||||||
NM_SERVICES['lidarr']='Lidarr (Music Manager)'
|
NM_SERVICES['lidarr']='Lidarr (Music Manager)'
|
||||||
@@ -21,19 +20,14 @@ NM_SERVICES['qbittorrent']='qBittorrent (Torrent Downloader)'
|
|||||||
NM_SERVICES['snap.tautulli.tautulli']='Tautulli (Plex Stats)'
|
NM_SERVICES['snap.tautulli.tautulli']='Tautulli (Plex Stats)'
|
||||||
NM_SERVICES['ombi']='Ombi (Download Requester)'
|
NM_SERVICES['ombi']='Ombi (Download Requester)'
|
||||||
|
|
||||||
#if [[ $(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1) == *"10.10.1.24"* ]]; then
|
if [ "${VPN_INTERFACE}" = "tun0" ]; then #openvpn
|
||||||
if [ "${VPN_INTERFACE}" = "nordlynx" ]; then
|
VPN_START=(/bin/systemctl start openvpn)
|
||||||
|
VPN_STOP=(/bin/systemctl stop openvpn)
|
||||||
|
|
||||||
|
else #default wireguard
|
||||||
|
VPN_START=(/usr/bin/wg-quick up ${VPN_INTERFACE})
|
||||||
|
VPN_STOP=(/usr/bin/wg-quick down ${VPN_INTERFACE})
|
||||||
|
|
||||||
# VPN_START=(/usr/bin/nordvpn connect United_States Chicago)
|
|
||||||
# VPN_START=(/usr/bin/nordvpn connect us9316)
|
|
||||||
VPN_START=(/usr/bin/nordvpn c double_vpn)
|
|
||||||
|
|
||||||
VPN_STOP=(/usr/bin/nordvpn disconnect)
|
|
||||||
else
|
|
||||||
#VPN_START=(/bin/systemctl start openvpn)
|
|
||||||
#VPN_STOP=(/bin/systemctl stop openvpn)
|
|
||||||
VPN_START=(/usr/bin/wg-quick up wg-torguard)
|
|
||||||
VPN_STOP=(/usr/bin/wg-quick down wg-torguard)
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DEBUGLOGSTOP(){
|
DEBUGLOGSTOP(){
|
||||||
|
|||||||
138
mm-scripts.sh
138
mm-scripts.sh
@@ -380,12 +380,6 @@ MMSTOP(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
MMSTATUS(){
|
MMSTATUS(){
|
||||||
# if [[ ${MMSRV} == *"10.10.1.24"* ]]; then
|
|
||||||
# statusArray=("nordvpn")
|
|
||||||
# else
|
|
||||||
# statusArray=("openvpn")
|
|
||||||
# fi
|
|
||||||
#statusArray=(nordvpn openvpn)
|
|
||||||
statusArray=(wireguard)
|
statusArray=(wireguard)
|
||||||
statusArray+=(${SERVICES_CHECK[@]})
|
statusArray+=(${SERVICES_CHECK[@]})
|
||||||
echo
|
echo
|
||||||
@@ -395,86 +389,70 @@ MMSTATUS(){
|
|||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en " ${NM_SERVICES[${srvc}]}$spc: "
|
echo -en " ${NM_SERVICES[${srvc}]}$spc: "
|
||||||
|
|
||||||
# if [[ ${MMSRV} == *"10.10.1.24"* ]] && [ "${srvc}" = "nordvpn" ]; then
|
if [ "$(systemctl is-active ${srvc})" != "active" ] && [ "${srvc}" != "wireguard" ]; then
|
||||||
if [ "${srvc}" = "nordvpn" ]; then
|
echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
|
||||||
if [[ "$(nordvpn status)" == *"Status: Disconnected"* ]]; then
|
|
||||||
echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
|
elif [ "${srvc}" == "wireguard" ] && [ "$(ip link | grep $VPN_INTERFACE)" == "" ]; then
|
||||||
else
|
echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
|
||||||
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
|
|
||||||
DIVIDER . lightBlue
|
|
||||||
nordvpn status
|
|
||||||
DIVIDER . lightBlue
|
|
||||||
echo ""
|
|
||||||
fi
|
|
||||||
else
|
else
|
||||||
if [ "$(systemctl is-active ${srvc})" != "active" ] && [ "${srvc}" != "wireguard" ]; then
|
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
|
||||||
echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
|
if [[ ${srvc} == *"vpn"* ]] || [[ ${srvc} == *"wireguard"* ]]; then
|
||||||
|
zerogw=$(ip route show | grep 0.0.0.0 | cut -d' ' -f 3)
|
||||||
|
defaultgw=$(ip route show | grep default | cut -d' ' -f 3)
|
||||||
#OUT=$(ip link | grep "$VPN_INTERFACE")
|
echo -e " |- 0.0.0.0 gateway : ${idsCL[Green]}$zerogw${idsCL[Default]}"
|
||||||
#if [ ${#OUT} = 0 ]; then
|
echo -en " |- DEFAULT gateway : "
|
||||||
elif [ "${srvc}" == "wireguard" ] && [ "$(ip link | grep $VPN_INTERFACE)" == "" ]; then
|
if [ "${zerogw}" == "${defaultgw}" ] && [ "${zerogw}" == "${VPN_INTERFACE}" ]; then
|
||||||
echo -e "${idsCL[Red]}Not Running${idsCL[Default]}"
|
echo -e "${idsCL[Green]}$defaultgw${idsCL[Default]}"
|
||||||
|
else
|
||||||
else
|
echo -e "${idsCL[Red]}Not correct${idsCL[Default]}"
|
||||||
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
|
if [ ! -f ${MMFOLDER}/mm.stop ]; then
|
||||||
if [[ ${srvc} == *"vpn"* ]] || [[ ${srvc} == *"wireguard"* ]]; then
|
echo
|
||||||
zerogw=$(ip route show | grep 0.0.0.0 | cut -d' ' -f 3)
|
echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
|
||||||
defaultgw=$(ip route show | grep default | cut -d' ' -f 3)
|
MMSTOP
|
||||||
echo -e " |- 0.0.0.0 gateway : ${idsCL[Green]}$zerogw${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}Pausing for 30secs... ${idsCL[Default]}"
|
||||||
echo -en " |- DEFAULT gateway : "
|
sleep 30s
|
||||||
if [ "${zerogw}" == "${defaultgw}" ] && [ "${zerogw}" == "${VPN_INTERFACE}" ]; then
|
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||||
echo -e "${idsCL[Green]}$defaultgw${idsCL[Default]}"
|
MMSTART
|
||||||
else
|
|
||||||
echo -e "${idsCL[Red]}Not correct${idsCL[Default]}"
|
echo -e " ${NM_SERVICES[wireguard]} : ${idsCL[Green]}Running${idsCL[Default]}"
|
||||||
if [ ! -f ${MMFOLDER}/mm.stop ]; then
|
zerogw=$(ip route show | grep 0.0.0.0 | cut -d' ' -f 3)
|
||||||
|
defaultgw=$(ip route show | grep default | cut -d' ' -f 3)
|
||||||
|
echo -e " |- 0.0.0.0 gateway : ${idsCL[Green]}$zerogw${idsCL[Default]}"
|
||||||
|
echo -en " |- DEFAULT gateway : "
|
||||||
|
if [ "${zerogw}" == "${defaultgw}" ] && [ "${zerogw}" == "${VPN_INTERFACE}" ]; then
|
||||||
|
echo -e "${idsCL[Green]}$defaultgw${idsCL[Default]}"
|
||||||
|
else
|
||||||
|
echo -e "${idsCL[Red]}Not correct${idsCL[Default]}"
|
||||||
echo
|
echo
|
||||||
echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
|
if [ ! -f ${MMFOLDER}/mm.checking ]; then
|
||||||
MMSTOP
|
echo -e "${idsCL[LightCyan]}Shutting down system... fix yo shit${idsCL[Default]}"
|
||||||
echo -en "${idsCL[LightCyan]}Pausing for 30secs... ${idsCL[Default]}"
|
MMSTOP
|
||||||
sleep 30s
|
|
||||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
|
||||||
MMSTART
|
|
||||||
|
|
||||||
echo -e " ${NM_SERVICES[wireguard]} : ${idsCL[Green]}Running${idsCL[Default]}"
|
|
||||||
zerogw=$(ip route show | grep 0.0.0.0 | cut -d' ' -f 3)
|
|
||||||
defaultgw=$(ip route show | grep default | cut -d' ' -f 3)
|
|
||||||
echo -e " |- 0.0.0.0 gateway : ${idsCL[Green]}$zerogw${idsCL[Default]}"
|
|
||||||
echo -en " |- DEFAULT gateway : "
|
|
||||||
if [ "${zerogw}" == "${defaultgw}" ] && [ "${zerogw}" == "${VPN_INTERFACE}" ]; then
|
|
||||||
echo -e "${idsCL[Green]}$defaultgw${idsCL[Default]}"
|
|
||||||
else
|
|
||||||
echo -e "${idsCL[Red]}Not correct${idsCL[Default]}"
|
|
||||||
echo
|
|
||||||
if [ ! -f ${MMFOLDER}/mm.checking ]; then
|
|
||||||
echo -e "${idsCL[LightCyan]}Shutting down system... fix yo shit${idsCL[Default]}"
|
|
||||||
MMSTOP
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -en " |- Verify routing through VPN : "
|
|
||||||
scip=$(dig +short sc1.scity.us @9.9.9.9)
|
|
||||||
mmip=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
|
||||||
if [ "${scip}" != "${mmip}" ]; then
|
|
||||||
echo -e "${idsCL[Green]}Good${idsCL[Default]}"
|
|
||||||
else
|
|
||||||
echo -e "${idsCL[Red]}Not Good${idsCL[Default]}"
|
|
||||||
if [ ! -f ${MMFOLDER}/mm.stop ] && [ ! -f ${MMFOLDER}/mm.checking ]; then
|
|
||||||
echo
|
|
||||||
echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
|
|
||||||
MMSTOP
|
|
||||||
echo -en "${idsCL[LightCyan]}Pausing for 30secs... ${idsCL[Default]}"
|
|
||||||
sleep 30s
|
|
||||||
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
|
||||||
MMSTART
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo -en " |- Verify routing through VPN : "
|
||||||
|
scip=$(dig +short sc1.scity.us @9.9.9.9)
|
||||||
|
mmip=$(dig +short myip.opendns.com @resolver1.opendns.com)
|
||||||
|
if [ "${scip}" != "${mmip}" ]; then
|
||||||
|
echo -e "${idsCL[Green]}Good${idsCL[Default]}"
|
||||||
|
else
|
||||||
|
echo -e "${idsCL[Red]}Not Good${idsCL[Default]}"
|
||||||
|
if [ ! -f ${MMFOLDER}/mm.stop ] && [ ! -f ${MMFOLDER}/mm.checking ]; then
|
||||||
|
echo
|
||||||
|
echo -e "${idsCL[LightCyan]}Restarting system...${idsCL[Default]}"
|
||||||
|
MMSTOP
|
||||||
|
echo -en "${idsCL[LightCyan]}Pausing for 30secs... ${idsCL[Default]}"
|
||||||
|
sleep 30s
|
||||||
|
echo -e "${idsCL[Green]}Done${idsCL[Default]}"
|
||||||
|
MMSTART
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user