mirror of
https://github.com/pivpn/pivpn.git
synced 2024-12-19 19:30:16 +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).
|
||||
|
||||
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
|
||||
else
|
||||
$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
|
||||
|
||||
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
|
||||
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"
|
||||
|
|
|
@ -50,16 +50,10 @@ updatefromtest(){
|
|||
|
||||
##Clone and copy pivpn scripts to /opt/pivpn
|
||||
cloneandupdate(){
|
||||
##This is to be removed after merge.
|
||||
##Alert for users trying to update from master.
|
||||
echo "ERROR: You have installed pivpn from test branch."
|
||||
echo "Wireguard not yet available on master, please use -t flag"
|
||||
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"
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue