Re: [gentoo-user] apache htaccess - block IP range

2020-03-18 Thread Alarig Le Lay
Hi,

On mar. 17 mars 15:47:36 2020, the...@sys-concept.com wrote:
> How to block in .htaccess file certain IP range?
> 
> I have bot from huawei.com on my server for several days:
> IP: 114.119.128.0 - 114.119.191.255
> Or just block all China

In a case like this, I’m not trying to bother about how to do this with
apache/nginx or another process, I’m blocking the traffic directly from
iptables:
iptables -s 114.119.128.0/19 -j DROP

-- 
Alarig



Re: [gentoo-user] apache htaccess - block IP range

2020-03-17 Thread thelma
On 03/17/2020 04:51 PM, Michael wrote:
> Please do not top-post in this mailing list.
> 
> On Tuesday, 17 March 2020 22:41:26 GMT the...@sys-concept.com wrote:
>> I have tried (doesn't work)
>>
>> 
>> order allow,deny
>> allow from all
>>
>> # block spamers:
>> deny from huawei.com
>> 
>>
>> I'm still getting over 800-entires from: 114.119.128.0 - 114.119.191.255
> 
> I just noticed the address is not a /24 but a /18 address space!  My mistake, 
> the correct IP notation therefore becomes:
> 
> 114.119.128.0/18
> 
> Or;
> 
> 114.119.128.0/255.255.192.0
> 
> Don't forget to reload the apache config, or restart the server.
> 
> If changes to the .htaccess do not work, this may mean the hosting company is 
> overriding such directives with their configuration - you'll need to talk to 
> them.

Yes, it worked the entries are dropping, from 800+ to 44 now
 Thank you!



Re: [gentoo-user] apache htaccess - block IP range

2020-03-17 Thread Michael
Please do not top-post in this mailing list.

On Tuesday, 17 March 2020 22:41:26 GMT the...@sys-concept.com wrote:
> I have tried (doesn't work)
> 
> 
> order allow,deny
> allow from all
> 
> # block spamers:
> deny from huawei.com
> 
> 
> I'm still getting over 800-entires from: 114.119.128.0 - 114.119.191.255

I just noticed the address is not a /24 but a /18 address space!  My mistake, 
the correct IP notation therefore becomes:

114.119.128.0/18

Or;

114.119.128.0/255.255.192.0

Don't forget to reload the apache config, or restart the server.

If changes to the .htaccess do not work, this may mean the hosting company is 
overriding such directives with their configuration - you'll need to talk to 
them.

signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] apache htaccess - block IP range

2020-03-17 Thread thelma
I have tried (doesn't work)


order allow,deny
allow from all

# block spamers:
deny from huawei.com


I'm still getting over 800-entires from: 114.119.128.0 - 114.119.191.255


Thelma
On 03/17/2020 04:00 PM, Michael wrote:
> Require not ip 114.119.128.0/255.255.255.0



Re: [gentoo-user] apache htaccess - block IP range

2020-03-17 Thread thelma
The below are not blocking those IP's :
deny from 114.119.128.0/24
deny from 114.119.128.0

Thelma
On 03/17/2020 04:00 PM, Michael wrote:
> On Tuesday, 17 March 2020 21:56:29 GMT the...@sys-concept.com wrote:
>> Will it work:
>> deny from 114.119.128.0/114.119.191.255
>>
>> Thelma
> 
> It is better to use this syntax:
> 
> 
> Require all granted
> Require not ip XX.XXX.XX.XXX
> 
> 
> 
> So your example address space becomes:
> 
> Require not ip 114.119.128
> 
> Or;
> 
> Require not ip 114.119.128.0/24
> 
> Or; 
> 
> Require not ip 114.119.128.0/255.255.255.0
> 
> 
> Look in Google for webpages providing geo-ip blocking advice, but China is 
> vast and so is their ability to buy/change more IP addresses per day.  So 
> this 
> is a moving beast.
> 
> HTH.
> 



Re: [gentoo-user] apache htaccess - block IP range

2020-03-17 Thread thelma
I'm still using apache 2.2

So I think it should be:
deny from 114.119.128.0/24

With the:

Require all granted
Require not ip 114.119.128.0/24


I couldn't even access my own webpage from localhost.


Thelma
On 03/17/2020 04:00 PM, Michael wrote:
> On Tuesday, 17 March 2020 21:56:29 GMT the...@sys-concept.com wrote:
>> Will it work:
>> deny from 114.119.128.0/114.119.191.255
>>
>> Thelma
> 
> It is better to use this syntax:
> 
> 
> Require all granted
> Require not ip XX.XXX.XX.XXX
> 
> 
> 
> So your example address space becomes:
> 
> Require not ip 114.119.128
> 
> Or;
> 
> Require not ip 114.119.128.0/24
> 
> Or; 
> 
> Require not ip 114.119.128.0/255.255.255.0
> 
> 
> Look in Google for webpages providing geo-ip blocking advice, but China is 
> vast and so is their ability to buy/change more IP addresses per day.  So 
> this 
> is a moving beast.
> 
> HTH.
> 



Re: [gentoo-user] apache htaccess - block IP range

2020-03-17 Thread Michael
On Tuesday, 17 March 2020 21:56:29 GMT the...@sys-concept.com wrote:
> Will it work:
> deny from 114.119.128.0/114.119.191.255
> 
> Thelma

It is better to use this syntax:


Require all granted
Require not ip XX.XXX.XX.XXX



So your example address space becomes:

Require not ip 114.119.128

Or;

Require not ip 114.119.128.0/24

Or; 

Require not ip 114.119.128.0/255.255.255.0


Look in Google for webpages providing geo-ip blocking advice, but China is 
vast and so is their ability to buy/change more IP addresses per day.  So this 
is a moving beast.

HTH.


signature.asc
Description: This is a digitally signed message part.


Re: [gentoo-user] apache htaccess - block IP range

2020-03-17 Thread thelma
Will it work:
deny from 114.119.128.0/114.119.191.255

Thelma
On 03/17/2020 03:47 PM, the...@sys-concept.com wrote:
> How to block in .htaccess file certain IP range?
> 
> I have bot from huawei.com on my server for several days:
> IP: 114.119.128.0 - 114.119.191.255
> Or just block all China
>