Weblog entry #47 for Utumno

hosts.deny
Posted by Utumno on Fri 12 Dec 2008 at 18:21
Tags: none.

Some bastards from domain 'kimsufi.com' run bots that keep hammering my forum. They keep trying to register and post their pornspam. So couple of days ago I added the whole domain to /etc/hosts.deny like this:

ALL: .kimsufi.com

/etc/hosts.allow is empty.

Now, I thought that would do it, but today I looked at the logs and the hammering is still there! Do I have to restart something before hosts.deny starts working?

 

Comments on this Entry

Posted by Anonymous (72.253.xx.xx) on Fri 12 Dec 2008 at 20:31
hosts.deny should work straight off, nothing needs restarted. One thought though, look for a /usr/local/etc/hosts.deny (or one under /usr/local anyway) I've discovered on some systems a hosts.deny in there that seems to be the active one. Also its worth look in hosts.allow for any quirkiness.

I spent 30 minutes trying to figure out why a block I added to /etc/hosts.deny wasn't working only to discover a hosts.deny in /usr/local. It may be worth blocking their whole subnet through iptables, along with reporting the abuse to their ISP/Hosting firm. If they don't care to deal with the abuse issue, you shouldn't care to receive traffic from them.

[ Parent | Reply to this comment ]

Posted by Anonymous (128.173.xx.xx) on Fri 12 Dec 2008 at 22:00
Make sure the ALL: PARANOID is not commented (Remove the #). That is why it probably isn't working. It only blocks SSH otherwise.

-ZeroDamage

[ Parent | Reply to this comment ]

Posted by Anonymous (128.173.xx.xx) on Fri 12 Dec 2008 at 22:19
I am probably wrong about that actually now that I think about it. Been a long day. You could try removing that though to see if it works. Another thing you could do is deny the domain through the .htaccess file in the root directory of your domain.

It would look like this:

Order Allow,Deny
Deny from kimsufi.com
Allow from All

[ Parent | Reply to this comment ]

Posted by Utumno (60.248.xx.xx) on Mon 15 Dec 2008 at 11:11
[ Send Message | View Utumno's Scratchpad | View Weblogs ]

This also doesn't work here...

Fortunately editing /etc/phpbb2/apache.conf and adding there

Order Allow,Deny
Deny from kimsufi.com
Allow from All

works :)

[ Parent | Reply to this comment ]

Posted by Utumno (60.248.xx.xx) on Mon 15 Dec 2008 at 10:31
[ Send Message | View Utumno's Scratchpad | View Weblogs ]

well, no matter what I do, hosts.deny does not work.

I just logged to a remote server and used 'links' to test if I can connect to my forum. I could. Then I added the domain of the remote server to hosts.deny like this

ALL: .domain

I tried links and I still could connect. Then I tried the above with exact IP of the server, still no success.

/etc/hosts.allow is empty, there is no additional hosts.deny at /usr/local/etc/

[ Parent | Reply to this comment ]

Posted by mcortese (213.70.xx.xx) on Mon 15 Dec 2008 at 16:44
[ Send Message | View Weblogs ]

AFAIK, hosts.allow and hosts.deny are the conf files for the tcpd wrapper. These are usually read only when a new connection arrives that triggers inetd, which in turn has to launch the appropriate daemon.

Some other applications (e.g. ssh) were designed to obey their contents as well, but they are not forced to.

Which web server do you use? Are you sure it chose to obey these files? If yes, are you sure it re-reads them at every access, or it just reads them once at startup?

[ Parent | Reply to this comment ]

Posted by rjc (85.12.xx.xx) on Tue 16 Dec 2008 at 09:55
[ Send Message ]
What does 'tcpdchk' say?
Have you tried 'tcpdmatch'?

Last but not least: if your web server's not started from (x)inetd or isn't built with tcpwrappers support /etc/hosts.{allow,deny} won't work.
If that's the case use iptables/netfilter.

rjc

[ Parent | Reply to this comment ]

Posted by Utumno (118.160.xx.xx) on Tue 23 Dec 2008 at 15:28
[ Send Message | View Utumno's Scratchpad | View Weblogs ]
ok, I see. That explains it. I was under the impression that hoss.deny should work for all network-related activity; now that I think about it, it does make sense it only works for stuff started from under inetd. Thanks for all the advice!

[ Parent | Reply to this comment ]

User Login

Username:

Password:

[ Advanced Login ]

Register Account

Quick Site Search