Support

Admin Tools

#10028 Banning spammer IPs: What is best practice?

Posted in ‘Admin Tools for Joomla! 4 & 5’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Environment Information

Joomla! version
n/a
PHP version
n/a
Admin Tools version
n/a

Latest post by nicholas on Thursday, 15 September 2011 02:43 CDT

user40075
Mandatory information about my setup:

Have I read the related troubleshooter articles above before posting (which pages?)? Yes
Have I searched the forum before posting? Yes
Have I read the documentation before posting (which pages?)? Yes
Joomla! version: 1.5.23
PHP version: latest
MySQL version: latest
Host: Rochen
Version: 2.1.6


Description of my issue:

Hi Nikko!

I know there are different ways in Admin Tools Pro to ban spammer IPs. I would like to know the most convenient way.

I used to go directly to the .htaccess file and add the IP under the "Deny From" heading. But when I installed AdminTools Pro, I found that every time I saved and created a new .htaccess file with .htaccess file Maker, it erased my direct .htaccess entries. So,

I have started adding entries in the .htaccess Maker=>custom .htaccess rules screen. This is very convenient when I am adding several at a time, making sure to add the "deny from" in front of each IP.

This seems easier to me than going to the Security Exceptions Log in the Web Applications Firewall, but maybe there is an easier way than the one I am using?

What is the easiest way to get this done?

Thanks, Nikko.

Best,

Lowtech

nicholas
Akeeba Staff
Manager
Hi!

It all depends on what you want to achieve.

The .htaccess method is the most complete one. It will completely disallow the blocked IP from accessing anything on your site. Not just Joomla!, but also static resources (CSS, JS, images, videos, ...) and any HTML pages or PHP scripts running outside of Joomla! itself. On the flip side, the more IP addresses you have in there, the slower your site gets because Apache has to parse the very long .htaccess file on each and every request to any resource, be it Joomla!'s index.php file or static resources. After a few hundred IPs, you get a noticeable delay on your page loading speed.

Going to the security exceptions log and banning the IPs from there is more convenient and performant. For large number of IPs, you get fast filtering using PHP code. On the flip side, if you have only a handful of IPs, it's slower than .htaccess. Moreover, it only protects Joomla!, not static resources.

Finally, if there is a repeat offender, you can simply turn on the automatic IP blocking. IMHO, that's the optimal method. You only ban those who have proven themselves to mean trouble and only long enough to prevent them from potentially doing harm to your site. The IP block list is auto-managed and self-tidying. It pretty much takes IP blocking in auto=pilot mode. I strongly recommend using that method. After all, the vast majority of IPs (and all spammers' and hackers' IPs) are dynamic. After a few hours they are assigned to a different person on the Internet. You don't want to block them just because their IP was once assigned to someone with sinister intentions.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user40075
Wow, Nikko!

I had no idea what is involved!

Your answer raised a couple issues for me:

1. I have two static html sites outside of Joomla and a large static html site accessed directly from Joomla. From what you wrote, I take it writing to the .htaccess file is the best way to protect everything?

2. I have never had a spam attack that succeeded. Registering at my site is difficult because I use Community Builder and each registration is evaluated as to answers to questions followed by IP checks.

3. So the main reason I am trying to control spam is to keep my visitor numbers real. According to the visitor tracker j4age I have 100 real visitors and 100 bots per day. (I don't really know what that means!)

But I also use Firestats because of its easy to view format and the spam attempts stand out (e.g., looking for Agora forum which I don't have, looking for index.php, most Ukrainian, Russian, some Chinese visitors, etc.

I want to exclude them from the statistics so this is what I do:
I check the IPs against StopForumSpam and then Project Honeypot. If either is positive I add the IP to .htaccess and exclude it from Firestats. Now, I say to myself, I have a clean list of visitors free of spammers. Actually, AdminTools Pro works so well that I only find about 2% spammers nowadays, vs 15% before installation!

4. If what you say is true, am I wasting my time checking with Project Honeypot, etc? I have 18 of their redirect urls on my website! Sometimes Project Honeypot says a spammer has been around for three years, etc., so that makes me wonder about dynamic IPs. My own dynamic IP has been static for at least a year, so I don't know what to think about the uselessness of blocking an IP.

What Practices would you recommend for a site operator who barely has time to get new material published 4Xs per week?

Thanks much,

Lowtech

nicholas
Akeeba Staff
Manager
1. In this case, yes. If you don't go through .htaccess, the IP block won't be active on those static sites.

2 & 3. Define "real". It's impossible to define it in terms a computer would understand. Obviously, the same guy coming twice by accident is not "real" traffic, but the same guy coming twice because he wants to re-read your content is "real" traffic. Can a computer detect that? Nope. So, that means nothing.

Also note that "bot" does not mean "hacking bot" or "spam bot". Search engines use automated site crawlers to index your pages. These are also called bots, e.g. Googlebot (Google), MSNBot (Bing), Yahoo Slurp (Yahoo!) and so on. The main difference you see in the numbers is most likely due to Project Honeypot integration which does prevent genuine hack/spam bots to access your site.

4. It's a matter of configuration. The default settings for PH integration make sure that an IP will be blocked if at least 1,000 spam messages have been sent from it and the last detected spam activity was within the last month or so. Please read the documentation for more information. You can configure it to taste. And I actually consider PH integration to be the only IP-blocking feature -apart from the administrator white list- which makes perfect sense. Putting arbitrary IPs in a black list or using GeoBlocking never stuck well with me, but I put those features there due to popular demand - not because I like them or consider them effective.

Side note: You have a static IP. I also have a static IP. We are the minority. The majority of ISP customers are assigned dynamic IPs, simply because there are not enough IPs for all of us. IPv4 addresses are depleted. Until IPv6 is widely deployed, we can't all have static IPs. Besides, if you were a spammer or hacker, would you risk being easily identified and blocked by having a static IP for years? IPs are the cyber equivalent of houses. A legitimate user may use the same IP for years, a crook will change IPs as fast as he can to stay below the radar, just like a crook in the real world changes houses (hideouts) often to remain uncaught.

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user40075
Lovely!

Thanks, Nikko!

Be well!

Lowtech

nicholas
Akeeba Staff
Manager
You're welcome!

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

user40075
Nikko-

I removed 400+IPs (saved them just in case) from .htaccess and my page load times were immediately cut in half!

Now I will see if there any problems that occur later one!

Much thanks,

Lowtech

nicholas
Akeeba Staff
Manager
You're welcome! As I said, too many IPs in .htaccess cause significant page load time increase :)

Nicholas K. Dionysopoulos

Lead Developer and Director

🇬🇷Greek: native 🇬🇧English: excellent 🇫🇷French: basic • 🕐 My time zone is Europe / Athens
Please keep in mind my timezone and cultural differences when reading my replies. Thank you!

Support Information

Working hours: We are open Monday to Friday, 9am to 7pm Cyprus timezone (EET / EEST). Support is provided by the same developers writing the software, all of which live in Europe. You can still file tickets outside of our working hours, but we cannot respond to them until we're back at the office.

Support policy: We would like to kindly inform you that when using our support you have already agreed to the Support Policy which is part of our Terms of Service. Thank you for your understanding and for helping us help you!