#!/bin/sh PATH=/bin:/usr/bin:/sbin:/usr/sbin:/var/mod/sbin . /usr/lib/libmodcgi.sh VERSION="1.0.5" # HTML QUERY STRING for remove option IPTABLES_DELETE_CHAIN="$(echo "$QUERY_STRING" | sed -e 's/^.*iptables//g' | sed -e 's/^.*chain=//g' | sed -e 's/&.*//g')" IPTABLES_DELETE_RULE="$(echo "$QUERY_STRING" | sed -e 's/^.*iptables//g' | sed -e 's/^.*remove=//g')" # Deleting Rule if [ $IPTABLES_DELETE_CHAIN ] && [ $IPTABLES_DELETE_RULE ]; then if [ $IPTABLES_DELETE_CHAIN = "PREROUTING" ] || [ $IPTABLES_DELETE_CHAIN = "POSTROUTING" ]; then SPECIAL='-t nat ' fi iptables $SPECIAL-D $IPTABLES_DELETE_CHAIN $IPTABLES_DELETE_RULE /var/mod/etc/init.d/rc.iptables save fi auto_chk=''; man_chk=''; if [ "$IPTABLES_ENABLED" = "yes" ]; then auto_chk=' checked'; else man_chk=' checked'; fi sec_begin 'Activation' cat << EOF
EOF sec_end sec_begin 'iptables add/remove rule' cat << EOF
Add
Insert
Chain | ||
Position (ID) | (only for Insert!) | |
Source Address | Port | |
Destination Address | Port | |
Protocol | ||
Input-Interface |
${IPTABLES_LINE} | " echo "||||||||||||
ID | " echo "Source | " echo "Destination | " echo "Protocol | " echo "Service | " echo "Service | " echo "Action | " echo "in | " echo "out | " echo "Configure | " echo "|||
---|---|---|---|---|---|---|---|---|---|---|---|---|
$(echo ${IPTABLES_LINE} | awk '{print $1}') | " echo "$(echo ${IPTABLES_LINE} | awk '{print $9}') | " echo "$(echo ${IPTABLES_LINE} | awk '{print $10}') | " echo "$(echo ${IPTABLES_LINE} | awk '{print $5}') | " if [ ! $(echo ${IPTABLES_LINE} | awk '{print $12}') ]; then echo "ANY | " else PORT="$(echo ${IPTABLES_LINE} | awk '{print $12}' | sed -e "s/.*://g")" SERVICE="$(cat /tmp/flash/iptables_services | grep :$PORT$ | sed -e "s/:.*//g")" echo "$(echo ${IPTABLES_LINE} | awk '{print $12}' | sed -e "s/:.*//g"):$SERVICE | " fi if [ ! $(echo ${IPTABLES_LINE} | awk '{print $13}') ]; then echo "ANY | " else echo ${IPTABLES_LINE} | awk '{print $13}'|grep '^to:' > /dev/null if [ $? -eq 1 ]; then PORT="$(echo ${IPTABLES_LINE} | awk '{print $13}' | sed -e "s/.*://g")" SERVICE="$(cat /tmp/flash/iptables_services | grep :$PORT$ | sed -e "s/:.*//g")" echo "$(echo ${IPTABLES_LINE} | awk '{print $13}' | sed -e "s/:.*//g"):$SERVICE | " else echo "$(echo ${IPTABLES_LINE} | awk '{print $13}') | " fi fi IMAGE="$(echo ${IPTABLES_LINE} | awk '{print $4}')" echo "" echo " | $(echo ${IPTABLES_LINE} | awk '{print $7}') | " echo "$(echo ${IPTABLES_LINE} | awk '{print $8}') | " echo "remove | " echo "