Changing iptables variables order.

This commit is contained in:
2022-02-27 17:12:36 +00:00
parent 65df14bd1a
commit cf791e3e52

View File

@@ -28,6 +28,9 @@ EXTRA_OPTIONS="$2 $3 $4"
fi;
if [[ -z "$TYPE" ]]; then
TYPE="tcp"
fi;
if [[ -z "$SOURCE_IP" ]]; then
SOURCE_IP="0.0.0.0/0"
fi;
@@ -158,12 +161,14 @@ else
if [ -n "$LINES" ] ; then
for i in $LINES; do
debug "$IPTABLES -D $CHAIN $i"
$IPTABLES -D $CHAIN $i
sleep 0.1
done
fi
$IPTABLES -I $CHAIN -s $SOURCE_IP --sport $SOURCE_PORT -d $TARGET_IP -p $PROTOCOL --dport $TARGET_PORT -m comment --comment "$COMMENT" -j ACCEPT
debug "$IPTABLES -I $CHAIN -p $PROTOCOL -s $SOURCE_IP --sport $SOURCE_PORT -d $TARGET_IP --dport $TARGET_PORT -m comment --comment "$COMMENT" -j ACCEPT"
$IPTABLES -I $CHAIN -p $PROTOCOL -s $SOURCE_IP --sport $SOURCE_PORT -d $TARGET_IP --dport $TARGET_PORT -m comment --comment "$COMMENT" -j ACCEPT
#############################
fi