1
sub getTracker 
    {
    my ($self) = @_;    
    my $url =  HOST() . $URIFromSTDIN;   
    my $req = HTTP::Request->new(GET => $url);
  
    $req->header('Accept', 'application/xml');   
    my @credentials = get_system_credentials();  

    $req->authorization_basic(@credentials[0], @credentials[1]); 
  
    my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0 },);   
    $ua->agent("wfa/$VERSION");    
    my $resp = $ua->request($req);    

    if ($resp->is_success) {    
        print $resp->decoded_content;    
    }       
    else {    
        die $resp->status_line;    
    }     
 
    my $output = $resp->decoded_content;    
    my $ref = xml_in($output);    
    $ref->{'userAgent'} = $ua;
    $ref->{'url'} = $url; 
}

above code works fine on RHEL 7.x but on RHEL 8.x it is throwing an error: Unable to contact service url 500 Can't connect to localhost:443 (certificate verify failed)

Steffen Ullrich
  • 114,247
  • 10
  • 131
  • 172
shubham
  • 21
  • 3
  • See if [this](https://stackoverflow.com/questions/19397346/error-500-cant-connect-to-example-com443-certificate-verify-failed/19397909) helps you. – vkk05 Jun 09 '21 at 06:42
  • I have tried it but it didn't work. – shubham Jun 09 '21 at 06:46
  • Does this answer your question? [How to accept self-signed certificates with LWP::UserAgent](https://stackoverflow.com/questions/47662461/how-to-accept-self-signed-certificates-with-lwpuseragent). In short: either properly validate the certificate or set `SSL_verify_mode` to none. – Steffen Ullrich Jun 09 '21 at 10:57

0 Answers0