mirror of
https://git.proxmox.com/git/pve-manager
synced 2025-08-09 04:51:09 +00:00
API2Client: allow to set ssl options
and use /etc/pve/pve-root-ca.pem as default CA.
This commit is contained in:
parent
7e25caf7c3
commit
7b038caf6d
@ -155,6 +155,12 @@ sub call {
|
|||||||
sub new {
|
sub new {
|
||||||
my ($class, %param) = @_;
|
my ($class, %param) = @_;
|
||||||
|
|
||||||
|
my $default_ca = "/etc/pve/pve-root-ca.pem";
|
||||||
|
|
||||||
|
my $ssl_default_opts = { verify_hostname => 0 };
|
||||||
|
$ssl_default_opts->{SSL_ca_file} = $default_ca
|
||||||
|
if -f $default_ca;
|
||||||
|
|
||||||
my $self = {
|
my $self = {
|
||||||
ticket => $param{ticket},
|
ticket => $param{ticket},
|
||||||
csrftoken => $param{csrftoken},
|
csrftoken => $param{csrftoken},
|
||||||
@ -163,6 +169,7 @@ sub new {
|
|||||||
host => $param{host} || 'localhost',
|
host => $param{host} || 'localhost',
|
||||||
port => $param{port},
|
port => $param{port},
|
||||||
protocol => $param{protocol},
|
protocol => $param{protocol},
|
||||||
|
ssl_opts => $param{ssl_opts} || $ssl_default_opts,
|
||||||
timeout => $param{timeout} || 60,
|
timeout => $param{timeout} || 60,
|
||||||
};
|
};
|
||||||
bless $self;
|
bless $self;
|
||||||
@ -181,7 +188,7 @@ sub new {
|
|||||||
$self->{useragent} = LWP::UserAgent->new(
|
$self->{useragent} = LWP::UserAgent->new(
|
||||||
cookie_jar => $self->{cookie_jar},
|
cookie_jar => $self->{cookie_jar},
|
||||||
protocols_allowed => [ 'http', 'https'],
|
protocols_allowed => [ 'http', 'https'],
|
||||||
ssl_opts => { verify_hostname => 0 },
|
ssl_opts => $self->{ssl_opts},
|
||||||
timeout => $self->{timeout},
|
timeout => $self->{timeout},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user