ipblocklist-functions.pl: Specify an IPFire user agent for the downloads

Message ID 20250312144610.3254927-1-adolf.belka@ipfire.org
State New
Headers
Series ipblocklist-functions.pl: Specify an IPFire user agent for the downloads |

Commit Message

Adolf Belka March 12, 2025, 2:46 p.m. UTC
  - 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>
---
 config/cfgroot/ipblocklist-functions.pl | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
  

Comments

Michael Tremer March 12, 2025, 4:34 p.m. UTC | #1
Very interesting. I wasn’t even aware that we had this function.

> On 12 Mar 2025, at 14:46, Adolf Belka <adolf.belka@ipfire.org> wrote:
> 
> - 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>
> ---
> config/cfgroot/ipblocklist-functions.pl | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/config/cfgroot/ipblocklist-functions.pl b/config/cfgroot/ipblocklist-functions.pl
> index bd026a01d..665dadb4c 100644
> --- a/config/cfgroot/ipblocklist-functions.pl
> +++ b/config/cfgroot/ipblocklist-functions.pl
> @@ -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,
> );
> 
> -- 
> 2.48.1
> 
>
  

Patch

diff --git a/config/cfgroot/ipblocklist-functions.pl b/config/cfgroot/ipblocklist-functions.pl
index bd026a01d..665dadb4c 100644
--- a/config/cfgroot/ipblocklist-functions.pl
+++ b/config/cfgroot/ipblocklist-functions.pl
@@ -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,
 	);