1 package PVE
::ACME
::Challenge
;
6 use PVE
::JSONSchema
qw(get_standard_option);
8 use base
qw(PVE::SectionConfig);
11 additionalProperties
=> 0,
14 description
=> "ACME Plugin ID name",
18 description
=> "ACME challenge type.",
22 description
=> "Flag to disable the config.",
26 nodes
=> get_standard_option
('pve-node-list', { optional
=> 1 }),
35 my ($class, $filename, $raw) = @_;
37 my $cfg = $class->SUPER::parse_config
($filename, $raw);
38 my $ids = $cfg->{ids
};
40 # make sure we have a standalone plugin definition as fallback!
41 if (!$ids->{standalone
} || $ids->{standalone
}->{type
} ne 'standalone') {
42 $ids->{standalone
} = {
50 sub supported_challenge_types
{
54 sub extract_challenge
{
55 my ($self, $challenges, $c_type) = @_;
57 die "no challenges defined\n" if !$challenges;
58 die "no challenge type is defined \n" if !$c_type;
60 my $tmp_challenges = [ grep {$_->{type
} eq $c_type} @$challenges ];
61 die "no $c_type challenge defined in authorization\n"
62 if ! scalar $tmp_challenges;
64 my $challenge = $tmp_challenges->[0];
73 # acme => PVE::ACME instance
74 # auth => authorization object returned by ACME server
76 # plugin => plugin config data
77 # alias => optional domain alias
79 # needs to set $data->{url} to URL of the challenge which has been set up
80 # can set other $data keys needed by teardown sub
82 my ($self, $acme, $auth, $data) = @_;
89 my ($self, $acme, $auth, $data) = @_;