]> 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, 7 May 2022 09:30:17 +0000 (11:30 +0200)
commit085915dff17276040c3dffa89cd3ba550a2082af
treedb6976b4179fd577983f20c8849864df3eae8269
parent65df900dc940558e6405068dd4e46164b44f962c
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