mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Update iptables msgs
This commit is contained in:
parent
47af4c7815
commit
cd92bdae46
@ -11,20 +11,20 @@ auth=$2
|
|||||||
interface=$3
|
interface=$3
|
||||||
|
|
||||||
if [ "$auth" = 1 ]; then
|
if [ "$auth" = 1 ]; then
|
||||||
echo "Enabling auth-user-pass in OpenVPN client.conf"
|
echo "Enabling auth-user-pass in OpenVPN client.conf"
|
||||||
line='auth-user-pass'
|
line='auth-user-pass'
|
||||||
if grep -q "$line" $file; then
|
if grep -q "$line" $file; then
|
||||||
echo "Updating $line"
|
echo "Updating $line"
|
||||||
sudo sed -i "s/$line/$line login.conf/g" $file
|
sudo sed -i "s/$line/$line login.conf/g" $file
|
||||||
else
|
else
|
||||||
echo "Adding $line"
|
echo "Adding $line"
|
||||||
sudo sed -i "$ a $line login.conf" $file
|
sudo sed -i "$ a $line login.conf" $file
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Generate iptables entries to place into rc.local file.
|
# Generate iptables entries to place into rc.local file.
|
||||||
# #RASPAP is for uninstall script
|
# #RASPAP is for uninstall script
|
||||||
echo "Adding iptables rules for $interface"
|
echo "Checking iptables rules for $interface"
|
||||||
|
|
||||||
lines=(
|
lines=(
|
||||||
"iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE #RASPAP"
|
"iptables -t nat -A POSTROUTING -o tun0 -j MASQUERADE #RASPAP"
|
||||||
@ -33,11 +33,11 @@ lines=(
|
|||||||
)
|
)
|
||||||
|
|
||||||
for line in "${lines[@]}"; do
|
for line in "${lines[@]}"; do
|
||||||
if grep "$line" /etc/rc.local > /dev/null; then
|
if grep "$line" /etc/rc.local > /dev/null; then
|
||||||
# iptables rule exists
|
|
||||||
else
|
else
|
||||||
sudo sed -i "s/^exit 0$/$line\nexit 0/" /etc/rc.local
|
sudo sed -i "s/^exit 0$/$line\nexit 0/" /etc/rc.local
|
||||||
fi
|
echo "Adding rule: $line"
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# Force a reload of new settings in /etc/rc.local
|
# Force a reload of new settings in /etc/rc.local
|
||||||
|
Loading…
Reference in New Issue
Block a user