]> git.ipfire.org Git - people/pmueller/ipfire-2.x.git/commit
ipblocklist-functions.pl: Add download_and_create_blocklist function.
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 4 Mar 2022 20:57:03 +0000 (21:57 +0100)
committerStefan Schantl <stefan.schantl@ipfire.org>
Thu, 7 Jul 2022 15:26:13 +0000 (17:26 +0200)
commitba8455e4699b71f07d8cd54e4b4d72edcc5d24c4
treed626338232ec1741b61049032f1657204dd315ba
parente64587a43d9cf5ef6fb275330ef83c62e71e4453
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>
config/cfgroot/ipblocklist-functions.pl