From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <development+bounces-29-archive=lists.ipfire.org@lists.ipfire.org>
Received: from mail02.haj.ipfire.org (localhost [127.0.0.1])
	by mail02.haj.ipfire.org (Postfix) with ESMTP id 4ZCYNV6L4Jz34b3
	for <archive@lists.ipfire.org>; Wed, 12 Mar 2025 14:46:18 +0000 (UTC)
Received: from mail01.ipfire.org (mail01.haj.ipfire.org [172.28.1.202])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mail01.haj.ipfire.org", Issuer "R10" (verified OK))
	by mail02.haj.ipfire.org (Postfix) with ESMTPS id 4ZCYNR1Df0z2xSM
	for <development@lists.ipfire.org>; Wed, 12 Mar 2025 14:46:15 +0000 (UTC)
Received: from [127.0.0.1] (localhost [127.0.0.1])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by mail01.ipfire.org (Postfix) with ESMTPSA id 4ZCYNQ36clz4jd;
	Wed, 12 Mar 2025 14:46:14 +0000 (UTC)
DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=ipfire.org;
	s=202003ed25519; t=1741790774;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding;
	bh=kC6oo8oqNhzPISYsgHRUUysZYRgJFZ42De3WUkr4PMU=;
	b=NuM6stYGT+bSikx6mpEH6DfAUNeDI/AULz69EfqfSYyAGXutU//eseLHP7VrOZH2n8akZK
	e0nTLi1B7qsMF8Dg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfire.org; s=202003rsa;
	t=1741790774;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:
	 content-transfer-encoding:content-transfer-encoding;
	bh=kC6oo8oqNhzPISYsgHRUUysZYRgJFZ42De3WUkr4PMU=;
	b=HbylwHMI6RPhf8Qu2wb4HRKUF/pXAcs71YD25ASQEV2YLRTekbAL1LccrV1sa/W1Z2aArs
	kxBCBrSH0meFFyxj9gxNIsLZxmvAHT0kshyh4XOPf7Uiatmwse4rychsWdXldPDTay2kp6
	L+7eyHT+Myvu/zk6W32hD5/RC+XpVlMMm7A4Po6sGclK3jtPBJD3AevOnric8Lg5z/rooN
	DASnvyf2L/drT9Xx0SwfjpYN3tZUDQzuYF2Dmph9I6IJ3FDnErVEure9QZc9yo4AznFgvk
	w7w+SUcZXWHfdfVEHb3M8A+aWSXwwM0ynlBvUBfgeE8c9+a0YU1bk1+/AukdeQ==
From: Adolf Belka <adolf.belka@ipfire.org>
To: development@lists.ipfire.org
Cc: Adolf Belka <adolf.belka@ipfire.org>
Subject: [PATCH] ipblocklist-functions.pl: Specify an IPFire user agent for the downloads
Date: Wed, 12 Mar 2025 15:46:10 +0100
Message-ID: <20250312144610.3254927-1-adolf.belka@ipfire.org>
Precedence: list
List-Id: <development.lists.ipfire.org>
List-Subscribe: <https://lists.ipfire.org/>,
 <mailto:development+subscribe@lists.ipfire.org?subject=subscribe>
List-Unsubscribe: <https://lists.ipfire.org/>,
 <mailto:development+unsubscribe@lists.ipfire.org?subject=unsubscribe>
List-Post: <mailto:development@lists.ipfire.org>
List-Help: <mailto:development+help@lists.ipfire.org?subject=help>
Sender: <development@lists.ipfire.org>
Mail-Followup-To: <development@lists.ipfire.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit

- 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