Commit Graph

19153 Commits

Author SHA1 Message Date
Stefan Schantl
77af89e59f ipblocklist.cgi: Use changed fw reload language string.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:28:05 +02:00
Tim FitzGeorge
a2e095aff1 ipblocklist: Add neccessary files for logwatch. 2022-07-07 17:28:05 +02:00
Stefan Schantl
ce5b281190 fcron: Try to update ipblocklists every 15 min.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:28:01 +02:00
Stefan Schantl
6f37368da6 rules.pl: Do not check private networks against ipblocklists.
In case some of these private networks are part of an used blocklist
this kind of traffic needs to be allowed. Otherwise some services may
not work properly.

For example:
In case one ore more IPSec N2N connections are configured no traffic can
be passed through it, if the used networks are part of an blocklist.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:27:14 +02:00
Stefan Schantl
e6928a6472 ipblocklist-sources: Change checksum definition from md5 to b2.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:27:14 +02:00
Stefan Schantl
adbd2bd6d4 rules.pl: Flush ipblocklist DROP chains.
Flush the DROP chains of the blocklist chains while reloading the
firewall. Otherwise the log rules will stay even if logging has been
disabled in the meantime.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:27:14 +02:00
Stefan Schantl
404b513794 ipblocklist: Add "v4" as extension to the ipset set names.
This easily allows us to swap the sets after updating, without
unloading them.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:27:14 +02:00
Stefan Schantl
9759d96e1b stage2: Add database directory for ipblocklist feature.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:27:14 +02:00
Stefan Schantl
018a809831 crontab: Add job for periodic ipblocklist updates.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:27:06 +02:00
Tim FitzGeorge
5af16e17df ipblocklist: Rootfile updates.
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Tim FitzGeorge
52bb9af897 configroot: Create ipblocklist related dir and settings file.
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Tim FitzGeorge
4ca678a857 ipblocklist-sources: New package.
Placing the ipblocklist sources file as an own package, easily
allows to update this single file during a core update and to
keep the vendor details for the blocklists up-to-date.

Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Tim FitzGeorge
d8bb263819 backup: Add ipblocklist related files.
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Stefan Schantl
6223e2b498 showrequestfromblocklist.dat: Fix silly typos.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Stefan Schantl
82fea6d575 update-ipblocklists: Do not log the pid in syslog.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Stefan Schantl
aba4e1cd1e rules.pl: Refactor logic to handle the IP blocklist feature.
* Fixes that the same chain would be created each time a firewall
reload is performed.

* Also fixes multiple log and drop rules inside the the BLOCKLIST_DROP
  chains after doing a firewall reload.

* Orphaned BLOCKLIST_DROP chains now will be flushed and removed in case
  the blocklist gets disabled or the entire feature will be swithed off.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Stefan Schantl
960608c8b5 rules.pl: Add function to check if given firewall chain exists.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Stefan Schantl
36330f84fb rules.pl: Fix typo when creating blocklist drop chains.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Stefan Schantl
39eba7abab rules.pl: Check if the blocklist is part of the settings hash.
Otherwise there will pop up some ugly notices on the command line and
the logs.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Tim FitzGeorge
733267f35a firewall: Add ipblocklist related chains.
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Rob Brewer
3e0cb28fc6 showrequestfromblocklist.dat: Modify regex for added space in
log-prefix.

Signed-off-by: Rob Brewer <rob.brewer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Rob Brewer
98d50c03e7 ipblocklist.dat: Do not rely on any theme settings.
The support for themes has been removed since ages, so we
do not need this anymore and may crash the page.

Signed-off-by: Rob Brewer <rob.brewer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Rob Brewer
bbbea6f9ba rules.pl: Add space at the end of the log prefix.
This improves the readabiliy when digging through the logs.

Signed-off-by: Rob Brewer <rob.brewer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Stefan Schantl
ac8e283eb4 update-ipblocklist: Add code to reload updated blocklists.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Stefan Schantl
3b114903aa ipblocklist.cgi: Mark and display a notice about a required reload of
the firewall.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Stefan Schantl
a72c2458c4 ipblocklist.cgi: Add better messages in error case.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Tim FitzGeorge
c0472dcf2a logs.cgi/log.dat: Allow to show logged ipblocklist messages.
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Tim FitzGeorge
1fd351d407 Menu: Add ipblocklist entry to firewall menu.
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Tim FitzGeorge
42564758ab Menu: Add ipblocklist entry to log menu.
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Rob Brewer
d6b0613744 ipblocklists.dat: Remove uneccessary and broken module includes.
Signed-off-by: Rob Brewer <rob.brewer@ipfire.org>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Tim FitzGeorge
33a446d8e1 Language file update for ipblocklist
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Tim FitzGeorge
cd07e6c659 ipblacklist: WUI Log details page
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Tim FitzGeorge
09a8d6127a ipblocklist: WUI Log page
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Stefan Schantl
8f49b75b08 ipblocklist.cgi: Adjust CGI to work with backend from ipblocklist-functions.pl
* Slightly adjust code indention.
* Remove Java Script code for show/hiding.
* Remove unnedded functions.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:14 +02:00
Tim FitzGeorge
5d24215341 ipblocklist: WUI Settings page
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
2022-07-07 17:26:13 +02:00
Stefan Schantl
ec1878771a ipblocklist-update: Introduce script to automatically update blacklists.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Stefan Schantl
7f4829de97 ipblocklist-functions.pl: Allow export of modified_file and
blocklist_dir values.

They so easily can be accessed by other perl scripts.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Stefan Schantl
d8113820e3 ipblocklist-functions.pl: Store the local time if no last modified could
be determined.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Tim FitzGeorge
8d12d12a4f ipblocklist-functions.pl: Add function to get the holdoff_rate of a
given list.

The function will return the rate in seconds based on the configured
rate value in the blocklist sources file and the given blocklist.

Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Stefan Schantl
a7bf1d9666 rules.pl: Add code to deal with ipblocklists.
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Stefan Schantl
d7dd565341 ipblocklist-functions.pl: Abort and return code if a list is empty or
not parse-able.

In case the downloaded list is empty or the parser is not able to parse
it properly, the download_and_create_blocklist() function now exits and
will return "empty_list" as new error code.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Tim FitzGeorge
0a4f60f28c ipblocklist-functions.pl: Add helper function to proper calculate the
hashsize.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Tim FitzGeorge
ac9b5d8e6b ipblocklist-functions.pl: Add parser of dshield.
This vendor has a different list format and therefore requires an
own parser.

Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Tim FitzGeorge
ab0179617d ipblocklist-functions.pl: Add parser to obtain IP or Net addresses from
a blocklist.

Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Stefan Schantl
ba8455e469 ipblocklist-functions.pl: Add download_and_create_blocklist function.
This function is responisible for downloading and converting the
blocklist into an ipset compatible format.

The only required argument is the blocklist (in upper letter format) which should be
performed. It automatically will setup an upstream proxy (if configured)
and grab the file specified in the blocklist vendor configuration hash.

There is a maximum amount of five attempts until the script gives up and
returns a "dl_error". In case the server responses with "Not Modified"
(Code 304) a "not_modified" will be returned.

If the blocklist successfully has been grabbed, the modification date
get stored for further purposes and the list content will be converted
and stored in an ipset compatible format.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Inspired-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
2022-07-07 17:26:13 +02:00
Stefan Schantl
e64587a43d ipblocklist-functions.pl: Add get_ipset_db_file() function.
This function is used to generate the filename and full path
for a given blocklist name.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Stefan Schantl
f4c25a44e2 ipblocklist-functions.pl: Initial commit.
This library file will contain a collection of functions, which are
required to deal with the ipblocklist feature.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Tim FitzGeorge
f17b5303cb ipblocklist: Add sources file.
Signed-off-by: Tim FitzGeorge <ipfr@tfitzgeorge.me.uk>
Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
2022-07-07 17:26:13 +02:00
Stefan Schantl
3c63c5da5e Merge branch 'next' of ssh://git.ipfire.org/pub/git/ipfire-2.x into next 2022-07-07 17:17:54 +02:00
Peter Müller
7f623de323 Revert "Core Update 169: Delete unused initrd on 32-bit ARM to save space in /boot"
This reverts commit 5ead33d796.
2022-07-07 13:55:29 +00:00