Firefox PHP

Spam Hurdles Module (CAPTCHA's and other anti-spam tools)

Posted by Maurice Makaay 
Re: Spam Hurdles Module (CAPTCHA's and other anti-spam tools)
September 26, 2006 08:03AM
The links have nothing to do with what you have in your forum. The error message tells you that the cache directory could not be generated. The "too many links" is an OS error, telling you that the maximum number of directories/files in a specific directory has been reached and that no extra directories can be created.

The spamhurdles store data in the cache. This is needed, because the module needs to remember some things (e.g. the generated captcha code and the one-time posting key that is used to prevent duplicate posting of forms). Another way to store data would be using the database, but that would require creating extra tables and custom SQL queries for handling the data. I chose to use the Phorum caching system instead, to use as much of the Phorum system as possible.

Based on the error that you have, I'd say that the directory /tmp/58c47d2d1fa77e6876a5b2f7adc9c68f/mod_spamhurdles is quite full. Can you check this? A possible solution could be to clear the spamhurdles cache data. There's an option for this on the spam hurdles module settings page.

What version of the Spam Hurdles are you running? The latest version does do some work to get rid of no longer needed cache entries. Only, the file caching layer of Phorum does not cleanup the hashing directories (e.g. 9ef5/7762/1f3c/eed2) if cached entries are deleted. So maybe there's just too many stale hash directories beneath /tmp/58c47d2d1fa77e6876a5b2f7adc9c68f/mod_spamhurdles. If clearing the cache doesn't help, then delete the directory /tmp/58c47d2d1fa77e6876a5b2f7adc9c68f/mod_spamhurdles in full. That should give you room again to store cache data.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Spam Hurdles Module (CAPTCHA's and other anti-spam tools)
September 26, 2006 04:20PM
I'm using mod 1.0.6 version with phorum 5.1.14
The problem seems to be as you say, the maximum number of directories/files in a specific directory has been reached. I'm unable to count them (I'm not a linux os expert) but there are many, many... of directories and subdirectories. If I guess that you're using hexadecimal naming and consider that the last name is fffb, that makes 4379 subdirectories only under /tmp/58c47d2d1fa77e6876a5b2f7adc9c68f/mod_spamhurdles to multiply with subdirectories of subdirectories...

I aborted purging the cache data through module's "cache manager" (module settings page) because it was too long (more than 15 minutes and that slowed down the server), then I deleted the entire /tmp/.../mod_spamhurdles folder with the "rm -rf" linux command - whitch also slowed down the server :( - and that solved the problem.
I have to mention that I'm only using "interactive KAPTCHA" and noone of the "Non interactive spam blocking methods". I was thinking that the caching data were only useful for the interactive methods, but do you still need to keep a trace of the KAPTCHA code even if it is javascript generated ?

Anyway, I think this is a problem if so many subdirs are generated. I'm using Spam Hurdles Module since only 2 or 3 weeks and this is not the most active period in my forums. I can't imaging that every week I should have to clean the cache manualy. Perhaps an autoexpiration/autodeletion method is possible.

I'm using the following modules : Spam Hurdles Module of course, but also Editor tools, Embed Phorum, ForumPath Module, HTML Phorum Mod, Message icons, Simple Text Replacement Mod, Smiley Replacement Mod and Spellchecker. Do you know if all of these are 5.1.6 compliant ? I didn't upgrade yet because of I'm afraid something breaks and as I'm a little bit busy at this moment... not enough time to (re)tune all this stuff.

Added after edit:
Finaly it took me several hours to remove all folder, subfolder and files under /tmp/.../mod_spamhurdles which means the were very very numerous. Here is an example of the subfolder's depth /tmp/.../mod_spamhurdles/ef20/35a2/17c7/a922/3922/5db5/f576/58a4/data.php
How does this work ? Does it write a file in a sub/sub/sub/sub/dir at each time the Captcha code appears ? So if in a thread (tree view) someone walks through all the messages, there are as many files writen as there are messages. And what about when google or/(mostly)and any other bot visit the forum ? Is there a new cache created by visitor ? I suspect spiders beeing the cause I had so many files and folder in /tmp cache. If it's true that makes this nice tool inoperable. Also I remarqued that the cache (data.php) contains an entire file avec user message, java code, html code, and so on, not only a (coded)code! Is all this stuff necessary ?



Edited 2 time(s). Last edit at 09/28/2006 08:53PM by milos.
Re: Spam Hurdles Module (CAPTCHA's and other anti-spam tools)
October 01, 2006 03:59AM
Hello,

I've installed "spamhurdles" mod 1.0.6 and last version of Phorum 5.1.16. First I've turned on the JavaScript captcha, but it still get spam too much (about 50 msgs per day), then I've turned on the GIF captcha, but it ended up with a error because php 4.2.3 doesn't have a GIF support. I didn't know that, and emailed
sysadmins for help. When they answer me, I've found that the phorum STILL GET SPAM, while the captcha image was BROKEN!!! No one could see the code! Here is the question: how could that be?

Today I've just opened the class.captcha_image.php file and change imagegif() to imagepng(), the captcha starts to work. But it doesn't matter, it seems that somewhere is a bug that allows spam-robots even not to try to recognize the image or JavaScript.
Re: Spam Hurdles Module (CAPTCHA's and other anti-spam tools)
October 01, 2006 04:31PM
Thanks to Thomas, who was so kind to read with me through the Spam Hurdles module, we found a possible cause for this problem. A fixed version of the module is uploaded to the first message in this thread. Can you please check if this new version fixes your problem?


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
mac
Re: Spam Hurdles Module (CAPTCHA's and other anti-spam tools)
October 02, 2006 02:42AM
I'm using v 5.016 and have added

{HOOK tpl_register_form}

to the tpl file. But the captcha does not appear?
Its the correct tpl and the mod settings is OK.
Re: Spam Hurdles Module (CAPTCHA's and other anti-spam tools)
October 02, 2006 04:21AM
The spam hurdles are written for and tested on 5.1.x. There's no support for running them on 5.0.x. Please upgrade your Phorum installation if you want to use this module.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
mac
Re: Spam Hurdles Module (CAPTCHA's and other anti-spam tools)
October 02, 2006 04:25AM
Oops - sorry. Assumed it will include 5.0.x as well. Always a bit scared to upgrade in the middle of a semester with 15 000 students using the forum!
Re: Spam Hurdles Module (CAPTCHA's and other anti-spam tools)
October 02, 2006 04:30AM
then stay cool and do the upgrade on a test-location first. changes to the template need to be done again.


Thomas Seifert
Re: Spam Hurdles Module (CAPTCHA's and other anti-spam tools)
October 02, 2006 04:37AM
That is scary, but it's of course possible to prepare and test the upgrade on a separate database. Because templates have changed, you'll have to redo your changes anyway, which costs a bit of time and is a nice task to do on a test system. Once you have successfully run a conversion on the test install (put a dump of the active database in there once in a while to test from scratch), you can do it on the live install (after backing up the active data of course). Scary, but not impossible.

It's up to you to choose if it's all worth the upgrade. More important than the Spam Hurdles would be security of the Phorum system. There might be security issues in 5.0.x which are solved in 5.1.x.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Spam Hurdles Module (CAPTCHA's and other anti-spam tools)
October 02, 2006 06:06AM
Quote
milos
I got this err msg
Warning: mkdir(/tmp/58c47d2d1fa77e6876a5b2f7adc9c68f/mod_spamhurdles/9ef5): 
Too many links in /my_absolute_root_to_phorum/cache.php on line 147

Together with Thomas, this issue was investigated some more.

It seems that you are running out of inode slots in the mod_spamhurdles cache directory. The maximum number of directories that could be created at this time for caching is 65535 ("0000" up to "ffff"). However, there seem to be operating systems with certain filesystems that cannot handle this amount of links in a directory (each subdirectory counts as a link). For example, Solaris/UFS can handle 32767 links and for Linux/Ext2fs we've seen a report that 32000 links can be used. Since the number of possibly created subdirectories is larger than the max amount on these systems, the caching system needs changing.

To fix it, we decided that the directory hashing needs to be changed a bit, so less directories are created at each level. In Phorum 5.2 we will implement this in full. For your system, you can change the file include/constants.php. Find the line that says:
    // split-variable for file-based cache
    define('PHORUM_CACHE_SPLIT',4);
In this line change 4 to 3. That will arrange for hash directories that are only three characters in length. That way, at most 4096 subdirectories are created at each level. Each operating system should be able to handle this amount without breaking into sweat.

So please try if this solves the problem for you.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Sorry, only registered users may post in this forum.

Click here to login