poniedziałek, 11 kwietnia 2011

Bye, bye Yandex!

Niestety wymieniony wcześniej sposób nie zadziałał. Próbowałam nawet blokować pojedyncze IP,  ale i to nie pomogło.
Rzecz była w tym, ze tomcat do nasłuchiwania na porcie 80 nie korzysta z inet-u. Poniżej krótkie wyjaśnienie, dlaczego blokada nie działała:

Files hosts.allow and hosts.deny work through a daemon (a program running in the background) called inetd. (On some systems, xinetd is used.) Other files used by inetd are /etc/services and /etc/inetd.conf. The purpose of inetd is to listen on various ports; when it accepts a connection on one of these ports, it fires up the appropriate service.

You can set up your system so that one of the services that inetd passes off connections to is a web server. For the purpose of efficiency, though, most systems do not have their web servers set up that way; they listen directly to the appropriate ports (usually port 80 at least).

If your web server is configured so that it listens directly to the appropriate ports, then inetd is not offering the protection you request in file hosts.deny. There's nothing wrong with this; you just have to configure your web server (Apache, in your case?) to provide the appropriate protection.


Więc się wkurzyłam i żeby nie grzebać bezpośrednio w iptables'ach wykorzystałam programik Ulatra Simple Firewall.
wystarczyło wpisać:

ufw insert 1 deny from 77.88.0.0/16
ufw enable
ufw status  #wyswietl reguly

Rekordy wpisywane są chyba jako reguły do iptables, więc należy pamiętać o ich dobrej kolejności. Jeśli mechanizm napotka pierwszą pasującą regułę, nie będzie uwzględniał już dalszych. I tak, "Insert 1" wstawił regułę na pierwszym miejscu, natomiast gdyby przed tym znajdowała się reguła pozwalająca się łączyć wszystkim komputerom, to nasza reguła zostałaby zignorowana.

Brak komentarzy:

Prześlij komentarz