Have debug work without being root

This commit is contained in:
Kaladin Light 2017-01-27 17:46:34 -05:00
parent 5ce48cbaaf
commit dc9924f147
2 changed files with 5 additions and 3 deletions

View file

@ -244,6 +244,8 @@ chooseInterface() {
if [[ $(echo "${availableInterfaces}" | wc -l) -eq 1 ]]; then
pivpnInterface="${availableInterfaces}"
echo "${pivpnInterface}" > /tmp/pivpnINT
$SUDO cp /tmp/pivpnINT /etc/pivpn/pivpnINTERFACE
return
fi

6
pivpn
View file

@ -29,14 +29,14 @@ function listOVPNFunc {
function debugFunc {
noUFW=$(cat /etc/pivpn/NO_UFW)
echo "::: Generating Debug Output"
$SUDO . /opt/pivpn/pivpnDebug.sh | tee /tmp/debug.txt
$SUDO /opt/pivpn/pivpnDebug.sh | tee /tmp/debug.txt
echo "::: "
echo "::: Debug output completed above."
echo "::: Copy saved to /tmp/debug.txt"
echo "::: "
if [[ ${noUFW} -eq 1 ]]; then
IPTABLES_FIX=`iptables -t nat -L -n -v | grep -c 'MASQUERADE.*10.8.0.0\/24'`
iptables -t nat -L -n -v | grep -q 'MASQUERADE.*10.8.0.0\/24'
IPTABLES_FIX=`$SUDO iptables -t nat -L -n -v | grep -c 'MASQUERADE.*10.8.0.0\/24'`
$SUDO iptables -t nat -L -n -v | grep -q 'MASQUERADE.*10.8.0.0\/24'
if [ $? -ne 0 ]; then
IPTABLES_FIX=2
fi