LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > General > SecFilterSelective not working?

Reply
 
Thread Tools Display Modes
  #1  
Old 06-21-2012, 11:22 PM
MisterNinja MisterNinja is offline
Member
 
Join Date: Oct 2011
Posts: 13
Default SecFilterSelective not working?

I'm trying to block users who don't have a user agent:
SecFilterSelective HEADER_USER_AGENT "^$"
SecFilterSelective HTTP_USER_AGENT "^$"

Neither work and yes I am using vhosts, no Apache. Any suggestions?
Reply With Quote
  #2  
Old 06-22-2012, 01:38 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,216
I tested
SecFilterSelective HEADER_USER_AGENT "^$"
and
SecFilterSelective HEADER_USER_AGENT ""
not working.the test command is
#curl -A "" -I 127.0.0.1/test.html

however, if not empty, e.g.
SecFilterSelective HEADER_USER_AGENT "chome"
will work as expected -- will forbid Chrome browser to access.

however, you can use rewrite rule to archive the same goal, and much simpler.
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule . - [F]

rewriterule is widely used and well tested, it's simpler yet powerful.
Reply With Quote
  #3  
Old 06-22-2012, 09:20 AM
MisterNinja MisterNinja is offline
Member
 
Join Date: Oct 2011
Posts: 13
I think the issue is I am trying to grab the access my site by the domain (root) - that goes through, but everything else doesn't. For some reason that rule isn't applying to /.

77.9.186.5 - - [22/Jun/2012:19:20:55 +0200] "GET / HTTP/1.1" 200 25992 "-" "-"
77.9.186.5 - - [22/Jun/2012:19:20:55 +0200] "GET / HTTP/1.1" 200 25992 "-" "-"
77.9.186.5 - - [22/Jun/2012:19:20:56 +0200] "GET / HTTP/1.1" 200 25992 "-" "-"
77.9.186.5 - - [22/Jun/2012:19:20:56 +0200] "GET / HTTP/1.1" 200 25992 "-" "-"

vs

77.9.186.5 - - [22/Jun/2012:19:20:55 +0200] "GET /index.php HTTP/1.1" 403 25992 "-" "-"

Is there a reason why rules aren't applying to the root?

Last edited by MisterNinja; 06-22-2012 at 09:35 AM..
Reply With Quote
  #4  
Old 06-22-2012, 09:47 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,216
then please try:
RewriteCond %{HTTP_USER_AGENT} ^$
RewriteRule .* - [F]
Reply With Quote
  #5  
Old 06-22-2012, 10:13 AM
MisterNinja MisterNinja is offline
Member
 
Join Date: Oct 2011
Posts: 13
This doesn't seem to be effective enough to block a DDOS. In fact attacking IPs spam the access logs and don't seem to be blocked lsws's firewall.
Reply With Quote
  #6  
Old 06-22-2012, 07:09 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,216
Code:
77.9.186.5 - - [22/Jun/2012:19:20:55 +0200] "GET /index.php HTTP/1.1" 403 25992 "-" "-"
looks problem. above "25992" should be "380" ?
i.e., response body's size is 380 bytes. content is
Quote:
<html>
<head><title> 403 Forbidden
</title></head>
<body><h1> 403 Forbidden
</h1>
Access to this resource on the server is denied!<hr />
Powered By <a href='http://www.litespeedtech.com'>LiteSpeed Web Server</a><br />
<font face="Verdana, Arial, Helvetica" size=-1>LiteSpeed Technologies is not responsible for administration and contents of this web site!</font></body></html>
although it's not most efficient, but only return 380 bytes instead of 25,992 bytes; more importantly, PHP is not triggered. php/mysql usually to be bottle-neck especially under attack.
Reply With Quote
  #7  
Old 06-22-2012, 07:42 PM
MisterNinja MisterNinja is offline
Member
 
Join Date: Oct 2011
Posts: 13
I just edited the code, because I was too lazy to find the request. The same is there though.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 11:13 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.