]> git.ipfire.org Git - people/stevee/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>
Sat, 5 Mar 2022 18:36:11 +0000 (19:36 +0100)
commit90f69dd43095939cc6ce7e252d2aed9bb4d1c15d
tree7ad02fff09d5e38da871a57ff5c7e1b7e69370b6
parent52f375f037f7b607021ef4c03fc6e3316133dc07
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