Skip to content
Snippets Groups Projects
Commit 6eb093b6 authored by virus2500's avatar virus2500
Browse files

Update README.md. Little intend fix in blocklist.pl

parent 62380127
No related branches found
No related tags found
No related merge requests found
......@@ -2,39 +2,73 @@ blocklist-with-ipset
====================
Use at your own risk :)
Create an ipset based blocklist from an text file (downloaded from e.g. blocklist.de)
Written and tested on Debian Wheezy!
Create an ipset based blocklist from multiple url to an blocklist text file e.g. blocklist.de.
Changes
--------
V1.1.0: blocklist-with-ipset is now IPV6 compatible (Yayyy :) )
- V1.1.0: blocklist-with-ipset is now IPV6 compatible (Yayyy :) )
- V1.0.4: Path to white and blacklist is now set automatically
- V1.0.3: Now you can set multiple blocklist sources
- V1.0.2: Added a whitelist and blacklist
<br>
**!!! IMPORTANT !!!!**
V1.0.4: Path to white and blacklist is now set automatically
When upgrading from a version lower than 1.1.0 you might have to manually drop duplicated INPUT Rules.
V1.0.3: Now you can set multiple blocklist sources
This should be an time issue though!
V1.0.2: Added a whitelist and blacklist
## INSTALL ##
1. Make sure you have ipset installed! If not you can usually install it with your distribution software management tool. E.g. apt for Debian/Ubuntu/Mint.
!!! IMPORTANT !!!!
apt-get install ipset
When upgrading from a version lower than 1.1.0 you might have to manually drop duplicated INPUT Rules.
2. Download the ZIP, or Clone the repository, to a folder on your system.
3. Open blocklist.pl with your favorite text editor and set up your blocklist urls. Two are included as default. You can enhance or edit as you like. The destination URL should be an direct link to an Text file though.
my @listUrl = ("http://lists.blocklist.de/lists/all.txt", "http://www.infiltrated.net/blacklisted");
*You can for example add an list like this*
my @listUrl = ("http://lists.blocklist.de/lists/all.txt", "http://www.infiltrated.net/blacklisted", "http://www.superblocksite.org/anotherBlocklist.txt");
You will need to install ipset!
4. While in blocklist.pl verify the location of your binarys. You can verify them with "which". For example 'which ipset' in an Terminal.
Also you will have to specify where your binarys are located. This settings can be made in blocklist.pl .
(You can find out where your binarys are with "which" e.g. "which iptables")
my $iptables = "/sbin/iptables";
my $ipset = "/usr/sbin/ipset";
my $grep = "/bin/grep";
my $rm = "/bin/rm";
my $wget = "/usr/bin/wget";
5. Create an cronjob. I have mine in /etc/crontab
These values need to verified for your system:
0 */1 * * * root /usr/bin/perl /path/to/the/script/blocklist.pl > /dev/null
my $iptables = "/sbin/iptables";
6. Create an logrotate for the logfile. E.g. under /etc/logrotate.d/blocklist
my $ipset = "/usr/sbin/ipset";
/var/log/blocklist
{
rotate 4
daily
missingok
notifempty
delaycompress
compress
}
my $grep = "/bin/grep";
7. If you have an ip you definitly want to block just put it in blacklist.txt. If you have an IP you definitly never want to have blocked put it in whitelist.txt. This two files are just text lists seperated by new lines. So for example
my $rm = "/bin/rm";
#blacklist.txt
2.2.2.2
3.3.3.3
my $wget = "/usr/bin/wget";
#and in whitelist.txt
4.4.4.4
5.5.5.5
That's it. If you want to manually run the script just cd to the folder where the script is located and run ./blocklist.pl
......@@ -10,18 +10,18 @@ use Data::Validate::IP qw(is_ipv4 is_ipv6);
################################################################
## config ##
my @listUrl = ("http://lists.blocklist.de/lists/all.txt", "http://www.infiltrated.net/blacklisted");
my $tmpDir = "/tmp";
my $logFile = "/var/log/blocklist";
my $whiteList = "$Bin/whitelist.txt";
my $blackList = "$Bin/blacklist.txt";
my @listUrl = ("http://lists.blocklist.de/lists/all.txt", "http://www.infiltrated.net/blacklisted");
my $tmpDir = "/tmp";
my $logFile = "/var/log/blocklist";
my $whiteList = "$Bin/whitelist.txt";
my $blackList = "$Bin/blacklist.txt";
## binarys ##
my $iptables = "/sbin/iptables";
my $ipset = "/usr/sbin/ipset";
my $grep = "/bin/grep";
my $rm = "/bin/rm";
my $wget = "/usr/bin/wget";
my $iptables = "/sbin/iptables";
my $ipset = "/usr/sbin/ipset";
my $grep = "/bin/grep";
my $rm = "/bin/rm";
my $wget = "/usr/bin/wget";
## plain variables ##
my($row, $Blocklist, $line, $check, $checkLine, $result, $output, $url, $ipRegex, $message);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment