diff --git a/scripts/install.sh b/scripts/install.sh index 0924e86..4c86999 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -105,13 +105,30 @@ source ./scripts/subinstallers/platform.sh # iptables echo "Setting up firewall (iptables)" -if [ ! -f "/etc/iptables/rules.v4" ]; then - echo "Setting iptables rules..." - ./scripts/subinstallers/iptables.sh -else - echo "iptables rules exist. Leaving alone." +if [ -f "/etc/iptables/rules.v4" ]; then + echo "Caution: iptables rules exist." + + read -p "Would you like to Clear (C) existing iptables rules or Add (A) to existing rules (this may cause problems)?" MISTBORN_IPTABLES_ACTION + echo + + if [[ "${MISTBORN_IPTABLES_ACTION}" =~ ^([cC])$ ]]; then + # clear + sudo rm -rf /etc/iptables/rules.v4 + sudo rm -rf /etc/iptables/rules.v6 || true + + elif [[ "${MISTBORN_IPTABLES_ACTION}" =~ ^([aA])$ ]]; then + # do nothing + echo "Proceeding..." + + else + echo "Unrecognized action: stopping" + exit 1; + + fi fi +echo "Setting iptables rules..." +source ./scripts/subinstallers/iptables.sh # SSH Server sudo -E apt-get install -y openssh-server