Nie jesteś zalogowany.
Jeśli nie posiadasz konta, zarejestruj je już teraz! Pozwoli Ci ono w pełni korzystać z naszego serwisu. Spamerom dziękujemy!
Prosimy o pomoc dla małej Julki — przekaż 1% podatku na Fundacji Dzieciom zdazyć z Pomocą.
Więcej informacji na dug.net.pl/pomagamy/.
To naprawdę dobra wiadomość :D.
Możesz z resztą ubić wszystkie połączenia, bo prawdopodobnie wiszą w regułach zawierających RELATED,ESTABLISHED, dlatego nie znikają od razu.
Trzeba by tylko wszystkie reguły dotyczące kontroli stanu pakietu objąć takimi samymi warunkami, jak INPUT i OUTPUT, czyli jest z tym trochę dodatkowej zabawy.
Przy czym nie ma różnicy, czy w skrypcie Crona, czy regułami w FW, bo sytuacja z nawiązanymi i kontynuowanymi połączeniami w obu przypadkach będzie wyglądała identycznie.
Offline
Ja nieco przerobiłem swój skrypt iptables i ostatecznie to wygląda tak:
iptables -t filter -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED,NEW -m mark --mark 5 -j time-p2p iptables -t filter -A INPUT -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT ... iptables -t filter -A OUTPUT -m conntrack --ctstate ESTABLISHED,RELATE,NEW -m cgroup --cgroup 5 -j time-p2p iptables -t filter -A OUTPUT -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT ... iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 0:03:30 --timestop 0:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 1:03:30 --timestop 1:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 2:03:30 --timestop 2:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 3:03:30 --timestop 3:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 4:03:30 --timestop 4:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 5:03:30 --timestop 5:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 6:03:30 --timestop 6:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 7:03:30 --timestop 7:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 8:03:30 --timestop 8:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 9:03:30 --timestop 9:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 10:03:30 --timestop 10:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 11:03:30 --timestop 11:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 12:03:30 --timestop 12:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 13:03:30 --timestop 13:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 14:03:30 --timestop 14:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 15:03:30 --timestop 15:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 16:03:30 --timestop 16:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 17:03:30 --timestop 17:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 18:03:30 --timestop 18:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 19:03:30 --timestop 19:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 20:03:30 --timestop 20:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 21:03:30 --timestop 21:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 22:03:30 --timestop 22:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -m time --weekdays 1,2,3,4,5,6,7 --timestart 23:03:30 --timestop 23:58:00 --kerneltz -j ACCEPT iptables -t filter -A time-p2p -j DROP
Narazie testuje i póki co jest wszystko zgodnie z planem:
Chain time-p2p (2 references) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 00:03:30 to 00:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 01:03:30 to 01:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 02:03:30 to 02:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 03:03:30 to 03:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 04:03:30 to 04:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 05:03:30 to 05:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 06:03:30 to 06:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 07:03:30 to 07:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 08:03:30 to 08:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 09:03:30 to 09:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 10:03:30 to 10:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 11:03:30 to 11:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 12:03:30 to 12:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 13:03:30 to 13:58:00 2048K 1498M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 14:03:30 to 14:58:00 456K 149M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 15:03:30 to 15:58:00 323K 130M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 16:03:30 to 16:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 17:03:30 to 17:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 18:03:30 to 18:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 19:03:30 to 19:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 20:03:30 to 20:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 21:03:30 to 21:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 22:03:30 to 22:58:00 0 0 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 TIME from 23:03:30 to 23:58:00 20016 1509K DROP all -- * * 0.0.0.0/0 0.0.0.0/0
Możesz z resztą ubić wszystkie połączenia, bo prawdopodobnie wiszą w regułach zawierających RELATED,ESTABLISHED, dlatego nie znikają od razu.
A jak je ubić?
Offline