]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
ipblocklist-functions.pl: Specify an IPFire user agent for the downloads
authorAdolf Belka <adolf.belka@ipfire.org>
Wed, 12 Mar 2025 14:46:10 +0000 (15:46 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 21 Mar 2025 15:09:39 +0000 (15:09 +0000)
- As discussed at the IPFire conf call in March 2025, this patch provides an IPFire
   specific User Agent string for the IP Block Lists downloads using LWP::UserAgent.
- It turned out that there was already a function in general-functions.pl that creates
   an IPFire Useer Agent string. This was used for this IP Blocklist download.
- Currently it gave me the string IPFire/2.29/192.
- This was tested out with the Threatview.io IP blocklist download and it worked fine.
- If this patch is approved and merged then I will let contact Threatview.io to let them
   know what our User Agent string is.

Tested-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Adolf Belka <adolf.belka@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/cfgroot/ipblocklist-functions.pl

index bd026a01dfe0047b1d601298145b1d359ce9b52c..665dadb4cbe6b46747260132c4b80f326a3e1234 100644 (file)
@@ -2,7 +2,7 @@
 ###############################################################################
 #                                                                             #
 # IPFire.org - A linux based firewall                                         #
-# Copyright (C) 2007-2022  IPFire Team  <info@ipfire.org>                     #
+# Copyright (C) 2007-2025  IPFire Team  <info@ipfire.org>                     #
 #                                                                             #
 # This program is free software: you can redistribute it and/or modify        #
 # it under the terms of the GNU General Public License as published by        #
@@ -118,13 +118,15 @@ sub download_and_create_blocklist($) {
        use LWP::UserAgent;
 
        # Create a user agent for downloading the blacklist
+       # Define the User Agent string
        # Limit the download size for safety
+       my $user_agent = &General::MakeUserAgent();
        my $ua = LWP::UserAgent->new (
                ssl_opts => {
                        SSL_ca_file     => '/etc/ssl/cert.pem',
                        verify_hostname => 1,
                },
-
+               agent => $user_agent,
                max_size => $max_dl_bytes,
        );