- Access exclusive content
- Connect with peers
- Share your expertise
- Find support resources
03-14-2014 07:15 AM
We are using the PAN::XAPI quite often to verify and fix configurations, but I ran into a problem when setting the "ua_ssl_opts"...
#ERROR: Unable to retrieve configuration from firewall: LWP::UserAgent: 500 Can't verify SSL peers without knowing which Certificate Authorities to trust
I'm using the following call to create a new api:
$api = PAN::XAPI->new(
api_username => $username,
api_password => $password,
hostname => $url,
debug => $debug,
use_http => $use_http,
use_get => 0,
ua_timeout => 10,
ua_ssl_opts => {
SSL_verify_mode => 0,
verify_hostname => 0,
},
);
I checked the actual code and think I found what is 'wrong':
/PAN-perl-20121110/lib/PAN/XAPI.pm lines 117-123:
if ($this->{ua}->can('ssl_opts')) { # >= LWP 6.0
if (defined $this->{ua_ssl_opts}) {
$this->{ua}->ssl_opts($this->{ua_ssl_opts});
} else {
$this->{ua}->ssl_opts(verify_hostname => 0);
}
}
... appears to fail, because an actual HASH is expected as parameter and not a HASH reference. I've changed it to:
if ($this->{ua}->can('ssl_opts')) { # >= LWP 6.0
if (defined $this->{ua_ssl_opts}) {
# ON2IT fix ....
$this->{ua}->ssl_opts(%{$this->{ua_ssl_opts}});
} else {
$this->{ua}->ssl_opts(verify_hostname => 0);
}
}
.. and this change appears to fix my issues.
I'm not sure if I'm the only one running into this problem (the software is pretty old by now), but maybe it can help someone?
Regards
Peter-Paul Worm
Click Accept as Solution to acknowledge that the answer to your question has been provided.
The button appears next to the replies on topics you’ve started. The member who gave the solution and all future visitors to this topic will appreciate it!
These simple actions take just seconds of your time, but go a long way in showing appreciation for community members and the LIVEcommunity as a whole!
The LIVEcommunity thanks you for your participation!