public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
* [PATCH] ipblocklist-functions.pl: Specify an IPFire user agent for the downloads
@ 2025-03-12 14:46 Adolf Belka
  2025-03-12 16:34 ` Michael Tremer
  0 siblings, 1 reply; 2+ messages in thread
From: Adolf Belka @ 2025-03-12 14:46 UTC (permalink / raw)
  To: development; +Cc: Adolf Belka

- 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



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ipblocklist-functions.pl: Specify an IPFire user agent for the downloads
  2025-03-12 14:46 [PATCH] ipblocklist-functions.pl: Specify an IPFire user agent for the downloads Adolf Belka
@ 2025-03-12 16:34 ` Michael Tremer
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Tremer @ 2025-03-12 16:34 UTC (permalink / raw)
  To: Adolf Belka; +Cc: development

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
> 
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-03-12 16:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-03-12 14:46 [PATCH] ipblocklist-functions.pl: Specify an IPFire user agent for the downloads Adolf Belka
2025-03-12 16:34 ` Michael Tremer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox