store | blogs | forums | twitter | facebook | wiki | mailing lists | downloads | support portal
Atomic Secure Linux
It is currently Mon May 20, 2013 11:04 pm

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic Share/Bookmark  [ 12 posts ] 
Author Message
 Post subject: How many items a .txt file on a rule can have?
Unread postPosted: Sat Jan 23, 2010 12:22 pm 
Offline
Forum User
Forum User

Joined: Sat Jan 17, 2009 2:19 pm
Posts: 99
Hi,
I am wondering if there is a maximum of lines that a file invoked in a rule can have, for example, the file malware-blacklist.txt, How many items can hold?


Top
 Profile  
 
 Post subject: Re: How many items a .txt file on a rule can have?
Unread postPosted: Sun Jan 24, 2010 10:46 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1846
As many as you like, but there's a panalty in system load and memory usage.

In our case (and many others too), too many line/rules = apache segfaulting.

Faris.

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: How many items a .txt file on a rule can have?
Unread postPosted: Sun Jan 24, 2010 12:06 pm 
Offline
Forum User
Forum User

Joined: Sat Jan 17, 2009 2:19 pm
Posts: 99
faris wrote:
As many as you like, but there's a panalty in system load and memory usage.

In our case (and many others too), too many line/rules = apache segfaulting.

Faris.

Thank you Faris,
but it seems there is a limit of some sort (at least in my servers), I have tried with a list of 4,000 items and there was no problem, then I increased the list to 7,500 and then the rule didn't catch the items in the list.

Sergio.


Top
 Profile  
 
 Post subject: Re: How many items a .txt file on a rule can have?
Unread postPosted: Sun Jan 24, 2010 3:29 pm 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1846
And no segfaults in /var/log/httpd/error_log or rules processing failure in any domain's log?

Try splitting the file into two, and load them separately.

If that works, try loading the two files in the reverse order. If that doesn't work then there may be a some strange character within the file you are using that causes the problem or something like that)

The full malware-blacklist and domains-blacklist files used to be huge.
The malware-blacklist by itself was nearly 90K in size, though obviously that's roughly (or exactly?) equal to the number of characters not the number of lines.

I don't recall how big the domains-blacklist file was, but it was also huge.

Faris.

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: How many items a .txt file on a rule can have?
Unread postPosted: Sun Jan 24, 2010 10:16 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 7420
Location: earth
You should be able to do over 40,000 on a regular centos 5 32-bit box w/ 1 gig of ram no problem. We do that and far more on our systems. Cpanel boxes probably wont be able to do that much given the way they build things.


Top
 Profile  
 
 Post subject: Re: How many items a .txt file on a rule can have?
Unread postPosted: Sun Jan 24, 2010 11:18 pm 
Offline
Forum User
Forum User

Joined: Sat Jan 17, 2009 2:19 pm
Posts: 99
scott wrote:
You should be able to do over 40,000 on a regular centos 5 32-bit box w/ 1 gig of ram no problem. We do that and far more on our systems. Cpanel boxes probably wont be able to do that much given the way they build things.

Yes Scott, that is what I tought, that maybe Cpanel has some limits.

Scott, how RBL works with modsec rules? Does the RBL rule uploads everything from the RBL site to the server memory? or the rule searchs the RBL list every time someone connects to the server?

I ask this because if I can't use @pmFromFile with so many IPs in it, maybe creating my own RBL list could do the trick and the best is that I could have just one centralized file for use with different servers.

Sergio.


Top
 Profile  
 
 Post subject: Re: How many items a .txt file on a rule can have?
Unread postPosted: Sun Jan 24, 2010 11:51 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 7420
Location: earth
The RBL is going to do a lookup on each new IP that connects to the system. In terms of the total number of entries, its orders of magnitude higher. The limitation there is the number of entries storable in the named cache. The cost here is that you add latency for the time required to do that lookup, so you want a good fast nameserver.


Top
 Profile  
 
 Post subject: Re: How many items a .txt file on a rule can have?
Unread postPosted: Mon Jan 25, 2010 12:16 am 
Offline
Forum User
Forum User

Joined: Sat Jan 17, 2009 2:19 pm
Posts: 99
scott wrote:
The RBL is going to do a lookup on each new IP that connects to the system. In terms of the total number of entries, its orders of magnitude higher. The limitation there is the number of entries storable in the named cache. The cost here is that you add latency for the time required to do that lookup, so you want a good fast nameserver.

So, @RBL will not work as intended, thanks for your input.

I will try to check on cpanel if they can check on this.

Sergio.


Top
 Profile  
 
 Post subject: Re: How many items a .txt file on a rule can have?
Unread postPosted: Mon Jan 25, 2010 9:18 am 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 7420
Location: earth
Well it works as intended :P Its just going to add some latency to the system, depending on the speed of the nameserver.


Top
 Profile  
 
 Post subject: Re: How many items a .txt file on a rule can have?
Unread postPosted: Mon Jan 25, 2010 10:38 pm 
Offline
Forum User
Forum User

Joined: Sat Jan 17, 2009 2:19 pm
Posts: 99
Finally I found the error on my file, thanks to Brian Rectanus.

There is a bug that will be fixed on the future modsec 2.5.12, the error is that the file that I uploaded to the server had MSDOS carriage returns instead of UNIX, so, using the command DOS2UNIX from shell it removed and replaced the CRs and that did the trick.

Sergio.


Top
 Profile  
 
 Post subject: Re: How many items a .txt file on a rule can have?
Unread postPosted: Tue Jan 26, 2010 2:11 am 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
User avatar

Joined: Thu Feb 07, 2008 7:49 pm
Posts: 3243
Location: Chantilly, VA
Thats pretty much a universal UNIX vs DOS issue. Make sure you always run dos2unix when you copy over a file you edit on a Windows box, only Microsoft adds control Ms to the end of every line and it breaks on every platform except Windows. That might not sound like a big deal, but given that ever OS on earth works the same way except Windows its pretty annoying that they do this with TXT files.

_________________
Michael Shinn
Atomicorp - Security For Everyone

Co-Author of Troubleshooting Linux Firewalls.


Top
 Profile  
 
 Post subject: Re: How many items a .txt file on a rule can have?
Unread postPosted: Tue Jan 26, 2010 10:57 am 
Offline
Forum User
Forum User

Joined: Sat Jan 17, 2009 2:19 pm
Posts: 99
"Live to learn" as my grandmom saids, lol, and it always has been true.

Sergio.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic Share/Bookmark  [ 12 posts ] 

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group