Author |
|
puertoblack2003
Joined: 31 Jul 2009 Posts: 121 Location: U.S
|
Posted: Tue 10 Aug '21 15:41 Post subject: converting directives in apache 2.4 |
|
|
trying to convert this for htacces
Code: |
#deny all russian IP's
Order allow,deny
deny from .ru
Allow from all |
not having luck no matter which way, getting error 500 |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Tue 10 Aug '21 16:49 Post subject: |
|
|
The normal
Code: |
Order allow,deny
Allow from all
|
becomes
Code: |
Require all granted
|
Your code
Code: |
Require not X.Y.Z.S
Require all granted
|
in your case, I would do it like this[1]
Code: |
<AuthzProviderAlias ip reject-ips "XXX.XXX.XXX.XXX YYY.YYY.YYY.YYY">
</AuthzProviderAlias>
<Directory "/path/to/dir">
<RequireAll>
Require not reject-ips
Require all granted
</RequireAll>
</Directory>
|
However, there are a lot of Russian IPs. I created a "snippet". [2] The range is roughly 12.6 thousand lines long. I would NOT put that in the Apache config. If you want to lock such large IP ranges I recommend using Cloudflare free version in front of your Apache. Don't do that on your local machine. Maintaining that list is horrible and Apache will take much longer to start and restart. You can do it if you want to.
I did forget to mention that the snippet is only IPv4. The IPv6 list[3] is about 17 thousand lines long.
[1] https://httpd.apache.org/docs/2.4/mod/mod_authz_core.html#authzprovideralias
[2] https://apaste.info/W5R7
[3] https://apaste.info/9knP |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Tue 10 Aug '21 16:58 Post subject: |
|
|
The main question why want to block those IPs? |
|
Back to top |
|
puertoblack2003
Joined: 31 Jul 2009 Posts: 121 Location: U.S
|
Posted: Wed 11 Aug '21 15:28 Post subject: |
|
|
James Blond wrote: | The main question why want to block those IPs? |
thanks for the info James, mainly for hack attempts to my forum board. all ip traced back to ru. |
|
Back to top |
|
puertoblack2003
Joined: 31 Jul 2009 Posts: 121 Location: U.S
|
Posted: Wed 11 Aug '21 15:33 Post subject: |
|
|
can i just block .ru instead of ip ? I remember a hacking website that provided info to block country. 3 years ago my computer HD crashed and lost all my bookmark. |
|
Back to top |
|
James Blond Moderator
Joined: 19 Jan 2006 Posts: 7373 Location: Germany, Next to Hamburg
|
Posted: Mon 16 Aug '21 19:19 Post subject: |
|
|
You "can" block .ru. But that depends on the factor that Apache / your OS needs to resolve the IP to a DNS name that ends in .ru That isn't working well. |
|
Back to top |
|
glsmith Moderator
Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
|
Posted: Mon 16 Aug '21 22:57 Post subject: |
|
|
mod_maxminddb
Not always perfect, but does the job. |
|
Back to top |
|
puertoblack2003
Joined: 31 Jul 2009 Posts: 121 Location: U.S
|
Posted: Tue 17 Aug '21 15:16 Post subject: |
|
|
thanks guys |
|
Back to top |
|