• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

configuring httpd.conf for ip filtering

PowerYoga

Diamond Member
I'm trying to configure some IP blocking on my server and I have some questions about the syntax. I would like to deny a whole IP range of 1.2.3.*, where * is 1-255 since there's been some spambot activity coming from a specific set of addresses.

Under the Directory tag I have:

<Directory /sitename>

stuff

Deny from 1.2.3.1/24
Deny from 4.5.6.7
Deny from etcetcetc

stuff

</Directory>

Is this the right syntax?
 
Wouldn't it be better to do this in the firewall? Httpd can block it, but then any other services on the system (SSH, etc.) are still accessible.
 
Do you have access to the software firewall(iptables) on the server? The application can block it fine, but it may be better to block it at a lower level before the traffic even gets to the application.
 
Do you have access to the software firewall(iptables) on the server? The application can block it fine, but it may be better to block it at a lower level before the traffic even gets to the application.

I actually don't. The hosted solution doesn't give us access to the software firewall since there are often multiple sites hosted on the VPS owned by different users.

I'm looking at the man page and I have tried already tested (and failed) those, but noticed the comment below:

123.231 // this WON'T work
123.231. //this WILL work

I mentioned previously I'm attempting to block an IP range using this syntax:

Deny from 1.2.3.1/24

Is this not the right way to block 1.2.3.*?
 
I have both of those modules declared.

I actually don't have an order allow,deny statement or order deny, allow declaration. I just have the Deny From statements.

The site is being routed through a proxy and load balancer if that matters.
 
not available for my hosted solution, or I'd be using it already. They've also requested that we don't install additional firewall solutions as other people share the VPS.
 
Yeah I think you did it right.

You need to put order deny,allow though, or order allow,deny. I forget 100% what the difference is, you'll want to read up on it to make sure you put the right one. I think it has to do with priority, so if an IP matches for both allow and deny one takes precedence.

I would also look at maybe putting it in a separate .htaccess or include file just to make it cleaner. It also allows you to dynamically move/add IPs to it easily on the fly since if you put it in httpd.conf it requires a restart
 
I actually don't. The hosted solution doesn't give us access to the software firewall since there are often multiple sites hosted on the VPS owned by different users.

I'm looking at the man page and I have tried already tested (and failed) those, but noticed the comment below:



I mentioned previously I'm attempting to block an IP range using this syntax:

Deny from 1.2.3.1/24

Is this not the right way to block 1.2.3.*?

Deny from 1.2.3.0/24
 
Back
Top