From 5eac7569469e7041f46cdb45d8b2103523f3fe0a Mon Sep 17 00:00:00 2001 From: billz Date: Sun, 17 Nov 2019 18:20:25 +0000 Subject: [PATCH] Added argument for auth-user-pass --- installers/configauth.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) mode change 100644 => 100755 installers/configauth.sh diff --git a/installers/configauth.sh b/installers/configauth.sh old mode 100644 new mode 100755 index 7293d16d..65224e4d --- a/installers/configauth.sh +++ b/installers/configauth.sh @@ -7,23 +7,25 @@ # license: GNU General Public License v3.0 file=$1 -interface=$2 +auth=$2 +interface=$3 -echo "Enabling auth credentials in OpenVPN client.conf" -line='auth-user-pass' - -if grep -q "$line" $file; then - echo "Updating $line" - sudo sed -i "s/$line/$line login.conf/g" $file -else - echo "Adding $line" - sudo sed -i "$ a $line login.conf" $file +if [ "$auth" = 1 ]; then + echo "Enabling auth-user-pass in OpenVPN client.conf" + line='auth-user-pass' + if grep -q "$line" $file; then + echo "Updating $line" + sudo sed -i "s/$line/$line login.conf/g" $file + else + echo "Adding $line" + sudo sed -i "$ a $line login.conf" $file + fi fi -echo "Adding iptables rules for $interface" - # Generate iptables entries to place into rc.local file. # #RASPAP is for uninstall script +echo "Adding iptables rules for $interface" + lines=( "iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE #RASPAP" "iptables -A FORWARD -i tun0 -o $interface -m state --state RELATED,ESTABLISHED -j ACCEPT #RASPAP"