Answer the question
In order to leave comments, you need to log in
How to test blocking by IP set in Nginx / Apache?
Good afternoon!
The server is periodically loaded by various scraper bots. I check what kind of bots through awk parsing the logs and sorting them in descending order by the number of requests, then I add these IP / subnets to the blacklist.conf list, which is included in each domain config on the server. There are several servers, I do manual synchronization of the blacklist.
A couple of hundred such IP / subnets have already accumulated. And new IP addresses are constantly added, many of them duplicate each other, for example:
144.76.0.0/16
144.76.118.82
How to set up testing so that fresh IP addresses before entering into the server config first check whether it is already blocked or not? Is there a utility or online service where you can upload your Blacklist by masks and IP list and see which rule blocks it? Googled for an hour...
Answer the question
In order to leave comments, you need to log in
How to set up testing so that fresh IP addresses before entering into the server config first check whether it is already blocked or not?Banal list search.
Is there a utility or online service where you can upload your Blacklist by masks and IP list and see which rule blocks it?What is it like?
Is there a utility or online service where you can upload your Blacklist by masks and IP list and see which rule blocks it?
#!/usr/bin/perl
use 5.010;
use strict;
use warnings;
use NetAddr::IP;
my @list = ('144.76.0.0/16', '144.76.118.82', '144.76.119.28', '144.76.67.0/24', '144.75.0.41');
my @result;
foreach my $ip (@list) {
push(@result, NetAddr::IP->new($ip));
}
@result = NetAddr::IP::compact(@result);
foreach my $ip (@result) {
say $ip->cidr;
}
144.75.0.41/32
144.76.0.0/16
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question