From 9d829406d15d1d9d3608b7d9c3028d6668f8d205 Mon Sep 17 00:00:00 2001 From: necro-nemesis Date: Sat, 14 Sep 2019 23:01:34 -0400 Subject: [PATCH] Add nft support --- installers/common.sh | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/installers/common.sh b/installers/common.sh index d75a4c7..e1d9e95 100755 --- a/installers/common.sh +++ b/installers/common.sh @@ -7,6 +7,7 @@ version=`sed 's/\..*//' /etc/debian_version` # php package to install if [ $version -eq 10 ]; then version_msg="Raspbian 10.0 (Buster)" + sudo apt update --allow-releaseinfo-change php_package="php7.1-cgi" elif [ $version -eq 9 ]; then version_msg="Raspbian 9.0 (Stretch)" @@ -214,13 +215,24 @@ function default_configuration() { sudo chmod 755 /var/lib/lokinet/lokilaunch.sh # Generate required lines for Rasp AP to place into rc.local file. - # #RASPAP is for removal script + # #RASPAP is for removal + # select iptables or nftables + + function networktables() { + if [ ! -f /usr/sbin/iptables-nft ]; then + tablerouteA='iptables -t nat -A POSTROUTING -s 10.3.141.0\/24 -o lokitun0 -j MASQUERADE #RASPAP' + tablerouteB='iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP' + else + sudo apt-get -y install nftables + tablerouteA='nft add rule ip nat POSTROUTING oifname "lokitun0" ip saddr 10.3.141.0\/24 counter masquerade #RASPAP' + tablerouteB='nft add rule ip nat POSTROUTING counter masquerade #RASPAP' + } + lines=( - 'echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward #RASPAP' - 'iptables -t nat -A POSTROUTING -s 10.3.141.0\/24 -o lokitun0 -j MASQUERADE #RASPAP' - 'iptables -t nat -A POSTROUTING -j MASQUERADE #RASPAP' + 'echo 1 > \/proc\/sys\/net\/ipv4\/ip_forward #RASPAP') + $tablerouteA + $tablerouteB 'sudo \/var\/lib\/lokinet\/.\/lokilaunch.sh start #RASPAP' - ) for line in "${lines[@]}"; do