Update mm-scripts.sh
This commit is contained in:
@@ -66,7 +66,7 @@ MMSTART(){
|
|||||||
msg="Setting up the VPN Tunnel config"
|
msg="Setting up the VPN Tunnel config"
|
||||||
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en "${idsCL[LightCyan]}${msg}${spc} : ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}${msg}${spc} ${idsCL[White]}: ${idsCL[Default]}"
|
||||||
|
|
||||||
privkey=$(/usr/bin/wg genkey)
|
privkey=$(/usr/bin/wg genkey)
|
||||||
reqpublickey=$(echo "${privkey}" | /usr/bin/wg pubkey)
|
reqpublickey=$(echo "${privkey}" | /usr/bin/wg pubkey)
|
||||||
@@ -114,7 +114,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
|
|||||||
|
|
||||||
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en "${idsCL[LightCyan]}${msg}${spc} : ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}${msg}${spc} ${idsCL[White]}: ${idsCL[Default]}"
|
||||||
|
|
||||||
[ $VERBOSE = true ] && echo "$(date) - ${mmsv} VPN..." >> $logfile
|
[ $VERBOSE = true ] && echo "$(date) - ${mmsv} VPN..." >> $logfile
|
||||||
|
|
||||||
@@ -170,7 +170,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
|
|||||||
msg="Adding VPN default routes"
|
msg="Adding VPN default routes"
|
||||||
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en "${idsCL[LightCyan]}${msg}${spc} : ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}${msg}${spc} ${idsCL[White]}: ${idsCL[Default]}"
|
||||||
|
|
||||||
/bin/ip route del default
|
/bin/ip route del default
|
||||||
/bin/ip route add default dev ${VPN_INTERFACE}
|
/bin/ip route add default dev ${VPN_INTERFACE}
|
||||||
@@ -187,7 +187,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
|
|||||||
msg="Verifying default network routes"
|
msg="Verifying default network routes"
|
||||||
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en "${idsCL[LightCyan]}${msg}${spc} : ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}${msg}${spc} ${idsCL[White]}: ${idsCL[Default]}"
|
||||||
|
|
||||||
checked=false
|
checked=false
|
||||||
cc=0
|
cc=0
|
||||||
@@ -218,7 +218,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
|
|||||||
msg="Verifying traffic routing through VPN"
|
msg="Verifying traffic routing through VPN"
|
||||||
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en "${idsCL[LightCyan]}${msg}${spc} : ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}${msg}${spc} ${idsCL[White]}: ${idsCL[Default]}"
|
||||||
|
|
||||||
scip=""
|
scip=""
|
||||||
mmip=""
|
mmip=""
|
||||||
@@ -267,7 +267,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
|
|||||||
msg="Verifying Plex Media is Mounted"
|
msg="Verifying Plex Media is Mounted"
|
||||||
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en "${idsCL[LightCyan]}${msg}${spc} : ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}${msg}${spc} ${idsCL[White]}: ${idsCL[Default]}"
|
||||||
|
|
||||||
### CHECK FOR PLEX MOUNT
|
### CHECK FOR PLEX MOUNT
|
||||||
files=$(shopt -s nullglob dotglob; echo ${PLEX_MOUNT}/*)
|
files=$(shopt -s nullglob dotglob; echo ${PLEX_MOUNT}/*)
|
||||||
@@ -320,7 +320,7 @@ PersistentKeepalive = 25" >> /etc/wireguard/${VPN_INTERFACE}.conf
|
|||||||
msg="${mmsv} Services"
|
msg="${mmsv} Services"
|
||||||
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en "${idsCL[LightCyan]}${msg}${spc} : ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}${msg}${spc} ${idsCL[White]}: ${idsCL[Default]}"
|
||||||
|
|
||||||
for srvc in "${SERVICES_CHECK[@]}"; do
|
for srvc in "${SERVICES_CHECK[@]}"; do
|
||||||
/bin/systemctl start ${srvc}
|
/bin/systemctl start ${srvc}
|
||||||
@@ -377,7 +377,7 @@ MMSTOP(){
|
|||||||
msg="Stopping Services"
|
msg="Stopping Services"
|
||||||
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en "${idsCL[LightCyan]}${msg}${spc} : ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}${msg}${spc} ${idsCL[White]}: ${idsCL[Default]}"
|
||||||
|
|
||||||
for srvc in "${!MM_SERVICES[@]}"; do
|
for srvc in "${!MM_SERVICES[@]}"; do
|
||||||
if [[ ${srvc} != *"vpn"* ]] && [[ ${srvc} != *"wireguard"* ]]; then
|
if [[ ${srvc} != *"vpn"* ]] && [[ ${srvc} != *"wireguard"* ]]; then
|
||||||
@@ -416,7 +416,7 @@ MMSTOP(){
|
|||||||
msg="Shutting Down VPN Tunnel"
|
msg="Shutting Down VPN Tunnel"
|
||||||
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en "${idsCL[LightCyan]}${msg}${spc} : ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}${msg}${spc} ${idsCL[White]}: ${idsCL[Default]}"
|
||||||
|
|
||||||
"${VPN_STOP[@]}" >/dev/null 2>&1
|
"${VPN_STOP[@]}" >/dev/null 2>&1
|
||||||
|
|
||||||
@@ -434,7 +434,7 @@ MMSTOP(){
|
|||||||
msg="Re-Adding Default Network Routes"
|
msg="Re-Adding Default Network Routes"
|
||||||
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en "${idsCL[LightCyan]}${msg}${spc} : ${idsCL[Default]}"
|
echo -en "${idsCL[LightCyan]}${msg}${spc} ${idsCL[White]}: ${idsCL[Default]}"
|
||||||
|
|
||||||
[ "$(/sbin/ip route show | grep default | cut -d' ' -f 3)" != "10.10.0.1" ] && /bin/ip route add default via 10.10.0.1 && ip route del ${vpn_server_address}
|
[ "$(/sbin/ip route show | grep default | cut -d' ' -f 3)" != "10.10.0.1" ] && /bin/ip route add default via 10.10.0.1 && ip route del ${vpn_server_address}
|
||||||
[ $VERBOSE = true ] && echo "$(date) - Added default route back in" >> $logfile
|
[ $VERBOSE = true ] && echo "$(date) - Added default route back in" >> $logfile
|
||||||
@@ -513,7 +513,7 @@ MMSTATUS(){
|
|||||||
msg=" ${MM_SERVICES[wireguard]}"
|
msg=" ${MM_SERVICES[wireguard]}"
|
||||||
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
echo -en "${idsCL[White]}${msg}${spc}: ${idsCL[Default]}"
|
echo -en "${idsCL[White]}${msg}${spc}${idsCL[White]}: ${idsCL[Default]}"
|
||||||
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
|
echo -e "${idsCL[Green]}Running${idsCL[Default]}"
|
||||||
|
|
||||||
zerogw=$(/sbin/ip route show | grep 0.0.0.0 | cut -d' ' -f 3)
|
zerogw=$(/sbin/ip route show | grep 0.0.0.0 | cut -d' ' -f 3)
|
||||||
@@ -595,7 +595,7 @@ GETVPNINFO(){
|
|||||||
# msg="Server Network"
|
# msg="Server Network"
|
||||||
# c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
# c=0; spc=''; spc1=$((${cw_spc}-${#msg}))
|
||||||
# until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
# until [ $c = ${spc1} ]; do spc="${spc} "; c=`expr $c + 1`; done
|
||||||
# echo -en "${idsCL[LightCyan]}${msg}${spc}: ${idsCL[Default]}"
|
# echo -en "${idsCL[LightCyan]}${msg}${spc}${idsCL[White]}: ${idsCL[Default]}"
|
||||||
#
|
#
|
||||||
# echo -e "${idsCL[Green]}${VPN_SERVER}${idsCL[Default]}"
|
# echo -e "${idsCL[Green]}${VPN_SERVER}${idsCL[Default]}"
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user