[8/8] pakfire: Adjust code to deal with new LWP::UserAgent.

Message ID 20220203111613.13632-8-stefan.schantl@ipfire.org
State Accepted
Commit 53f7dc7620bfb51e8b1daa8c727206425e06d87a
Headers
Series [1/8] perl-Try-Tiny: New package. |

Commit Message

Stefan Schantl Feb. 3, 2022, 11:16 a.m. UTC
  Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
---
 src/pakfire/lib/functions.pl | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
  

Comments

Peter Müller Feb. 5, 2022, 12:26 p.m. UTC | #1
Same here. Let's hope we never overlook this is necessary...

Reviewed-by: Peter Müller <peter.mueller@ipfire.org>

> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> ---
>  src/pakfire/lib/functions.pl | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl
> index 2f34763d5..37b930080 100644
> --- a/src/pakfire/lib/functions.pl
> +++ b/src/pakfire/lib/functions.pl
> @@ -155,7 +155,14 @@ sub fetchfile {
>  		
>  		logger("DOWNLOAD INFO: Host: $host ($proto) - File: $file");
>  
> -		my $ua = LWP::UserAgent->new;
> +		# Init LWP::UserAgent, request SSL hostname verification
> +		# and specify CA file.
> +		my $ua = LWP::UserAgent->new(
> +			ssl_opts => {
> +				SSL_ca_file     => '/etc/ssl/cert.pem',
> +				verify_hostname => 1,
> +			}
> +		);
>  		$ua->agent("Pakfire/$Conf::version");
>  		$ua->timeout(20);
>
  
Adolf Belka Feb. 14, 2022, 9:15 p.m. UTC | #2
Reviewed-by: Adolf Belka <adolf.belka@ipfire.org>

On 03/02/2022 12:16, Stefan Schantl wrote:
> Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
> ---
>   src/pakfire/lib/functions.pl | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl
> index 2f34763d5..37b930080 100644
> --- a/src/pakfire/lib/functions.pl
> +++ b/src/pakfire/lib/functions.pl
> @@ -155,7 +155,14 @@ sub fetchfile {
>   		
>   		logger("DOWNLOAD INFO: Host: $host ($proto) - File: $file");
>   
> -		my $ua = LWP::UserAgent->new;
> +		# Init LWP::UserAgent, request SSL hostname verification
> +		# and specify CA file.
> +		my $ua = LWP::UserAgent->new(
> +			ssl_opts => {
> +				SSL_ca_file     => '/etc/ssl/cert.pem',
> +				verify_hostname => 1,
> +			}
> +		);
>   		$ua->agent("Pakfire/$Conf::version");
>   		$ua->timeout(20);
>
  

Patch

diff --git a/src/pakfire/lib/functions.pl b/src/pakfire/lib/functions.pl
index 2f34763d5..37b930080 100644
--- a/src/pakfire/lib/functions.pl
+++ b/src/pakfire/lib/functions.pl
@@ -155,7 +155,14 @@  sub fetchfile {
 		
 		logger("DOWNLOAD INFO: Host: $host ($proto) - File: $file");
 
-		my $ua = LWP::UserAgent->new;
+		# Init LWP::UserAgent, request SSL hostname verification
+		# and specify CA file.
+		my $ua = LWP::UserAgent->new(
+			ssl_opts => {
+				SSL_ca_file     => '/etc/ssl/cert.pem',
+				verify_hostname => 1,
+			}
+		);
 		$ua->agent("Pakfire/$Conf::version");
 		$ua->timeout(20);