]>
git.ipfire.org Git - people/pmueller/ipfire-2.x.git/blob - config/cfgroot/ipblocklist-functions.pl
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007-2022 IPFire Team <info@ipfire.org> #
7 # This program is free software: you can redistribute it and/or modify #
8 # it under the terms of the GNU General Public License as published by #
9 # the Free Software Foundation, either version 2 of the License, or #
10 # (at your option) any later version. #
12 # This program is distributed in the hope that it will be useful, #
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
15 # GNU General Public License for more details. #
17 # You should have received a copy of the GNU General Public License #
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
20 ###############################################################################
24 require '/var/ipfire/ipblocklist/sources';
26 # Location where the blocklists in ipset compatible format are stored.
27 our $blocklist_dir = "/var/lib/ipblocklist";
29 # File extension of the blocklist files.
30 our $blocklist_file_extension = ".conf";
33 ## Function to get all available blocklists.
35 sub get_blocklists
() {
38 # Loop through the hash of blocklists.
39 foreach my $blocklist ( keys %IPblocklist::List
::sources
) {
40 # Add the list to the array.
41 push(@blocklists, $blocklist);
44 # Sort and return the array.
45 return sort(@blocklists);
49 ## Tiny function to get the full path and name of a given blocklist.
51 sub get_ipset_db_file
($) {
55 my $file = "$blocklist_dir/$set$blocklist_file_extension";
57 # Return the file name.