mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-20 03:40:17 +00:00
Enable cloneandupdate() function, fixed detecting existing iptables rules.
- Uncommented lines inside the cloneandupdate() function in the update script, so pivpn -up can pull scripts from the master branch - The script was checking for the existence of PiVPN rules in the INPUT and FORWARD chain by passing 'iptables -t nat -S' to grep, but it couldn't find them as they belong to the filer table and not the nat table. The correct command is 'iptables -S'
This commit is contained in:
parent
5bfaa95e9f
commit
30b374054c
2 changed files with 6 additions and 12 deletions
|
@ -1746,7 +1746,7 @@ confNetwork(){
|
||||||
# chain (using -I).
|
# chain (using -I).
|
||||||
|
|
||||||
if [ "$INPUT_RULES_COUNT" -ne 0 ] || [ "$INPUT_POLICY" != "ACCEPT" ]; then
|
if [ "$INPUT_RULES_COUNT" -ne 0 ] || [ "$INPUT_POLICY" != "ACCEPT" ]; then
|
||||||
if $SUDO iptables -t nat -S | grep -q "${VPN}-input-rule"; then
|
if $SUDO iptables -S | grep -q "${VPN}-input-rule"; then
|
||||||
INPUT_CHAIN_EDITED=0
|
INPUT_CHAIN_EDITED=0
|
||||||
else
|
else
|
||||||
$SUDO iptables -I INPUT 1 -i "${IPv4dev}" -p "${pivpnPROTO}" --dport "${pivpnPORT}" -j ACCEPT -m comment --comment "${VPN}-input-rule"
|
$SUDO iptables -I INPUT 1 -i "${IPv4dev}" -p "${pivpnPROTO}" --dport "${pivpnPORT}" -j ACCEPT -m comment --comment "${VPN}-input-rule"
|
||||||
|
@ -1757,7 +1757,7 @@ confNetwork(){
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$FORWARD_RULES_COUNT" -ne 0 ] || [ "$FORWARD_POLICY" != "ACCEPT" ]; then
|
if [ "$FORWARD_RULES_COUNT" -ne 0 ] || [ "$FORWARD_POLICY" != "ACCEPT" ]; then
|
||||||
if $SUDO iptables -t nat -S | grep -q "${VPN}-forward-rule"; then
|
if $SUDO iptables -S | grep -q "${VPN}-forward-rule"; then
|
||||||
FORWARD_CHAIN_EDITED=0
|
FORWARD_CHAIN_EDITED=0
|
||||||
else
|
else
|
||||||
$SUDO iptables -I FORWARD 1 -d "${pivpnNET}/${subnetClass}" -i "${IPv4dev}" -o "${pivpnDEV}" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -m comment --comment "${VPN}-forward-rule"
|
$SUDO iptables -I FORWARD 1 -d "${pivpnNET}/${subnetClass}" -i "${IPv4dev}" -o "${pivpnDEV}" -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT -m comment --comment "${VPN}-forward-rule"
|
||||||
|
|
|
@ -50,16 +50,10 @@ updatefromtest(){
|
||||||
|
|
||||||
##Clone and copy pivpn scripts to /opt/pivpn
|
##Clone and copy pivpn scripts to /opt/pivpn
|
||||||
cloneandupdate(){
|
cloneandupdate(){
|
||||||
##This is to be removed after merge.
|
git clone "$pivpnrepo" "$pivpnlocalpath"
|
||||||
##Alert for users trying to update from master.
|
cp "${pivpnlocalpath}"/scripts/*.sh "$pivpnscripts"
|
||||||
echo "ERROR: You have installed pivpn from test branch."
|
cp "${pivpnlocalpath}"/scripts/$VPN/*.sh "$pivpnscripts"
|
||||||
echo "Wireguard not yet available on master, please use -t flag"
|
cp "${pivpnlocalpath}"/scripts/$VPN/bash-completion "$bashcompletiondir"
|
||||||
exit 1
|
|
||||||
## Remove Above and uncomment below when test is moved to master
|
|
||||||
# git clone "$pivpnrepo" "$pivpnlocalpath"
|
|
||||||
# cp "${pivpnlocalpath}"/scripts/*.sh "$pivpnscripts"
|
|
||||||
# cp "${pivpnlocalpath}"/scripts/$VPN/*.sh "$pivpnscripts"
|
|
||||||
# cp "${pivpnlocalpath}"/scripts/$VPN/bash-completion "$bashcompletiondir"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
##same as cloneandupdate() but from test branch
|
##same as cloneandupdate() but from test branch
|
||||||
|
|
Loading…
Reference in a new issue