Hier ist ein Arbeitsskript:
iptables -t nat --list-rules PREROUTING | while IFS='' read -r line || [[ -n "$line" ]]; do RULE443=$(echo $line | grep "REDIRECT --to-ports 8443") RULE80=$(echo $line | grep "REDIRECT --to-ports 8080") if [ "$RULE80" != '' ] then PORT80=$(echo $RULE80 | grep -o '\-\-dport.*' | cut -d' ' -f2) iptables -t nat -D PREROUTING -p tcp --dport $PORT80 -j REDIRECT --to-port 8080 elif [ "$RULE443" != '' ] then PORT443=$(echo $RULE443 | grep -o '\-\-dport.*' | cut -d' ' -f2) iptables -t nat -D PREROUTING -p tcp --dport $PORT443 -j REDIRECT --to-port 8443 fi done