- Código: Selecionar todos
#!/bin/bash
liberar(){
iptables -D FORWARD -s $i -p tcp --dport 80 -j ACCEPT
iptables -D FORWARD -s $i -p tcp --dport 22 -j ACCEPT
iptables -t nat -D PREROUTING -s $i -p tcp --dport 80 -j DNAT --to-destination 192.168.3.1:8005
iptables -t nat -D PREROUTING -s $i -p tcp --dport 80 -j DNAT --to-destination 192.168.3.1:8005
iptables -D FORWARD -s $i -j DROP
echo "$i Liberado"
}
bloquear() {
iptables -A FORWARD -s $i -p tcp --dport 80 -j ACCEPT
iptables -A FORWARD -s $i -p tcp --dport 22 -j ACCEPT
iptables -t nat -A PREROUTING -s $i -p tcp --dport 80 -j DNAT --to-destination 192.168.3.1:8005
iptables -t nat -A PREROUTING -s $i -p tcp --dport 80 -j DNAT --to-destination 192.168.3.1:8005
iptables -A FORWARD -s $i -j DROP
echo "$i Bloqueado"
exit
}
prebloquear() {
iptables -t nat -A PREROUTING -s $i -p tcp --dport 80 -j DNAT --to-destination 192.168.3.1:8005
iptables -t nat -A PREROUTING -s $i -p tcp --dport 80 -j DNAT --to-destination 192.168.3.1:8005
echo "$i Probloqueado"
exit
}
if [ "$#" -ne 2 ]; then
echo "Faltan parámetros";
echo "Debe ser: $0 comando ip"
exit 1;
fi
case "$1" in
ban) bloquear $i;;
unban) liberar $i;;
preban) prebloquear $i;;
esac
me da el siguiente error
- Código: Selecionar todos
[brazilfw]/# sh /partition/webserver/htdocs/script/firewall ban 172.16.0.11
Bad argument `tcp'
Try `iptables -h' or 'iptables --help' for more information.
Bad argument `tcp'
Try `iptables -h' or 'iptables --help' for more information.
Bad argument `tcp'
Try `iptables -h' or 'iptables --help' for more information.
Bad argument `tcp'
Try `iptables -h' or 'iptables --help' for more information.
Bad argument `DROP'
Try `iptables -h' or 'iptables --help' for more information.