replaced iptables with nftables

This commit is contained in:
2026-02-01 16:37:08 +01:00
parent 143d5fd470
commit 8b49189438
2 changed files with 11 additions and 11 deletions

View File

@@ -12,7 +12,7 @@ show_help(){
echo " -y | Answer all questions with yes" echo " -y | Answer all questions with yes"
echo "" echo ""
echo "-- MODES --" echo "-- MODES --"
echo " access | control over remote access to the device (mac-based-filtering using iptables)" echo " access | control over remote access to the device (mac-based-filtering using nftables)"
exit 0 exit 0
} }

View File

@@ -6,12 +6,12 @@ allow_mac(){
} }
check(){ check(){
if command -v iptables &>/dev/null if command -v nftables &>/dev/null
then then
echo "iptables is installed. Check passed. Bye." echo "nftables is installed. Check passed. Bye."
exit 0; exit 0;
else else
echo "Please install iptables." echo "Please install nftables."
while [[ -z "$HAD_BEST_SUCCESS" ]]; do while [[ -z "$HAD_BEST_SUCCESS" ]]; do
read -p "Install now? [y/N] " QUESTION read -p "Install now? [y/N] " QUESTION
if [[ -z "$QUESTION" ]] || [[ "$QUESTION" = "n" ]] || [[ "$QUESTION" = "N" ]]; then if [[ -z "$QUESTION" ]] || [[ "$QUESTION" = "n" ]] || [[ "$QUESTION" = "N" ]]; then
@@ -20,27 +20,27 @@ check(){
fi fi
if [[ "$QUESTION" = "y" ]] || [[ "$QUESTION" = "Y" ]]; then if [[ "$QUESTION" = "y" ]] || [[ "$QUESTION" = "Y" ]]; then
HAD_BEST_SUCCESS="true" HAD_BEST_SUCCESS="true"
echo "Trying to install iptables..." echo "Trying to install nftables..."
if command -v apt &>/dev/null if command -v apt &>/dev/null
then then
sudo apt update sudo apt update
sudo apt install iptables -y sudo apt install nftables -y
echo "Attempted to install iptables. Please execute the check again. Bye." echo "Attempted to install nftables. Please execute the check again. Bye."
exit 0; exit 0;
fi fi
if command -v dnf &>/dev/null if command -v dnf &>/dev/null
then then
sudo dnf update sudo dnf update
sudo dnf install iptables -y sudo dnf install nftables -y
echo "Attempted to install iptables. Please execute the check again. Bye." echo "Attempted to install nftables. Please execute the check again. Bye."
exit 0; exit 0;
fi fi
if command -v pacman &>/dev/null if command -v pacman &>/dev/null
then then
sudo pacman -S iptables sudo pacman -S nftables
echo "Attempted to install iptables. Please execute the check again. Bye." echo "Attempted to install nftables. Please execute the check again. Bye."
exit 0; exit 0;
fi fi
fi fi