[pve-devel] [common 7/9] implement the setup function for DNS challenge

Fabian Grünbichler f.gruenbichler at proxmox.com
Fri Oct 18 11:27:44 CEST 2019


On October 14, 2019 1:08 pm, Wolfgang Link wrote:
> ---
>  src/PVE/ACME/ACME_sh.pm | 23 +++++++++++++++++++++++
>  1 file changed, 23 insertions(+)
> 
> diff --git a/src/PVE/ACME/ACME_sh.pm b/src/PVE/ACME/ACME_sh.pm
> index 40be772..e60fd93 100644
> --- a/src/PVE/ACME/ACME_sh.pm
> +++ b/src/PVE/ACME/ACME_sh.pm
> @@ -5,6 +5,9 @@ use warnings;
>  
>  use HTTP::Daemon;
>  use HTTP::Response;

still not used ;)

> +use Digest::SHA qw(sha256);
> +
> +use PVE::ACME;

missing PVE::Tools

>  
>  use base qw(PVE::ACME::Challenge);
>  
> @@ -59,4 +62,24 @@ sub validating_url {
>  
>  }
>  
> +my $outfunc = sub {
> +    my $line = shift;
> +    print "$line\n";
> +};
> +
> +sub setup {
> +    my ($class, $auth, $acme, $alias) = @_;
> +
> +    my $dns_challenge = PVE::ACME::extract_challenge($auth->{'challenges'}, "dns-01");
> +    my $url = $dns_challenge->{'url'};
> +    my $domain = $auth->{'identifier'}->{'value'};
> +    my $key_auth = $acme->key_authorization($dns_challenge->{'token'});
> +    my $digest = PVE::ACME::encode(sha256($key_auth));
> +    my $cmd = &$compose_cmd('pve-setup', $digest, $domain, $alias);

see comment in #6, alias should already be handled here..

> +
> +    PVE::Tools::run_command($cmd, outfunc => $outfunc);
> +
> +    return ($url, $digest, $domain);
> +}
> +
>  1;
> -- 
> 2.20.1
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
> 
> 




More information about the pve-devel mailing list