Вот тут начитался одного из туториалов по iptables (огромный), и захотелось настроить его, но столкнулся с проблеммой блокировки инета при определённых условиях.
А именно при политике DROP цепочки INPUT при следующих правилах:
bash-2.05b# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT udp -- localhost anywhere udp spt:631
ACCEPT udp -- localhost anywhere udp dpt:631
ACCEPT tcp -- localhost anywhere tcp spt:631
ACCEPT tcp -- localhost anywhere tcp dpt:631
ACCEPT udp -- localhost anywhere udp spt:6000
ACCEPT udp -- localhost anywhere udp dpt:6000
ACCEPT tcp -- localhost anywhere tcp spt:6000
ACCEPT tcp -- localhost anywhere tcp dpt:6000
ACCEPT tcp -- anywhere anywhere tcp dpt:www
ACCEPT tcp -- anywhere anywhere tcp dpt:ftp
ACCEPT tcp -- anywhere anywhere tcp dpt:pop3
ACCEPT tcp -- anywhere anywhere tcp dpt:telnet
ACCEPT tcp -- anywhere anywhere tcp dpt:smtp
ACCEPT tcp -- anywhere anywhere tcp dpt:nntp
ACCEPT tcp -- anywhere anywhere tcp spt:www
ACCEPT tcp -- anywhere anywhere tcp spt:ftp
ACCEPT tcp -- anywhere anywhere tcp spt:pop3
ACCEPT tcp -- anywhere anywhere tcp spt:telnet
ACCEPT tcp -- anywhere anywhere tcp spt:smtp
ACCEPT tcp -- anywhere anywhere tcp spt:nntp
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
А вот при ACCEPT на INPUT и при таких правилах:
bash-2.05b# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
DROP tcp -- !localhost anywhere tcp dpt:6000
DROP tcp -- !localhost anywhere tcp dpt:631
DROP udp -- !localhost anywhere udp dpt:6000
DROP udp -- !localhost anywhere udp dpt:631
DROP icmp -- anywhere anywhere
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
Пускает.
Вопрос в том что эти наборы правил вроде как идентичны, но в инет пускает только второй блок. Просто хотелось закрыть всё и оставить только доступ основным сервисам, ну и закрыть доступ из вне к cupsd и X11, так на всякий пожарный. И столкнулся с такой штукой. Второй способ не устраивает тем, что если появится ещё что то то опять придётся его добавлять, а так один раз и навсегда. Может кто скажет какой нибудь способ реализовать это.
Заранее спасибо!!!