View Full Version : Как заблокиовать доступ извне к роутеру с определенного адреса?!
BlackHorse
17-03-2008, 03:50
Есть vsftp на asus wl500 - заколебал ломать один из товарищей далекого забугорья...
есть желание забанить его совсем, но vsftp не умеет такого делать...
а как по другому не пойму...
подскажите, плс!?!
добавить в post-firewall
iptables -P INPUT DROP
iptables -D INPUT -j DROP
iptables -A INPUT -s _IP_TO_BE_BLOCKED_ -j DROP
И проконтролировать полученный порядок правил iptables -L
BlackHorse
17-03-2008, 20:55
Файл post-firewall
===============================
#!/bin/sh
iptables -P DROP
iptabels -D INPUT -j DROP
iptables -A INPUT -s 72.22.64.86 -j DROP
iptables -I INPUT -i ppp0 -p tcp --syn --dport 65534:65534 -j ACCEPT
===============================
Результат
[admin@WL500 root]$ iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT tcp -- anywhere anywhere tcp dpt:65534 flags:
SYN,RST,ACK/SYN
DROP all -- anywhere anywhere state INVALID
ACCEPT all -- anywhere anywhere state RELATED,ESTABL
ISHED
ACCEPT all -- anywhere anywhere state NEW
ACCEPT all -- anywhere anywhere state NEW
ACCEPT igmp -- anywhere BASE-ADDRESS.MCAST.NET/4
ACCEPT udp -- anywhere BASE-ADDRESS.MCAST.NET/4
SECURITY all -- anywhere anywhere state NEW
ACCEPT udp -- anywhere anywhere udp spt:bootps dpt:b
ootpc
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
ACCEPT icmp -- anywhere anywhere
DROP all -- anywhere anywhere
DROP all -- dedicated.ipowerweb.com anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
DROP all -- anywhere anywhere state INVALID
ACCEPT udp -- anywhere BASE-ADDRESS.MCAST.NET/4
TCPMSS tcp -- anywhere anywhere tcp flags:SYN,RST,AC
K/SYN TCPMSS clamp to PMTU
ACCEPT all -- anywhere anywhere state RELATED,ESTABL
ISHED
DROP all -- anywhere anywhere
DROP all -- anywhere anywhere
SECURITY all -- anywhere anywhere state NEW
ACCEPT tcp -- anywhere anywhere tcp spts:ftp-data:ft
p dpts:ftp-data:ftp
ACCEPT all -- anywhere anywhere ctstate DNAT
DROP all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain MACS (0 references)
target prot opt source destination
Chain SECURITY (2 references)
target prot opt source destination
RETURN tcp -- anywhere anywhere tcp flags:SYN,RST,AC
K/SYN limit: avg 1/sec burst 5
RETURN tcp -- anywhere anywhere tcp flags:FIN,SYN,RS
T,ACK/RST limit: avg 1/sec burst 5
RETURN udp -- anywhere anywhere limit: avg 5/sec bur
st 5
RETURN icmp -- anywhere anywhere limit: avg 5/sec bur
st 5
DROP all -- anywhere anywhere
Chain logaccept (0 references)
target prot opt source destination
LOG all -- anywhere anywhere state NEW LOG level
warning tcp-sequence tcp-options ip-options prefix `ACCEPT '
ACCEPT all -- anywhere anywhere
Chain logdrop (0 references)
target prot opt source destination
LOG all -- anywhere anywhere state NEW LOG level
warning tcp-sequence tcp-options ip-options prefix `DROP '
DROP all -- anywhere anywhere
====================
Итог - нулевой... где копать?!
Работа над ошибками:
да, действительно, сходу не сообразил --- для того чтобы запрещать надо добавлять в начало цепочки, т.е.:
iptables -I INPUT -s 72.22.64.86 -j DROP
Остальное не нужно
BlackHorse
18-03-2008, 04:41
Спасибо! Судя по всему забанил... иначе лог vsftp за сутки 30МГб... :(