X-Git-Url: https://git.rapsys.eu/acme/blobdiff_plain/ae17b69d70ec7ca1df4ed65a70b365d6c838f381..f3840be3ba7f773771001372a57b9fc511ecfc80:/Acme.pm diff --git a/Acme.pm b/Acme.pm index adcc99e..2bb0aaf 100644 --- a/Acme.pm +++ b/Acme.pm @@ -33,11 +33,13 @@ our @EXPORT_OK = qw(VERSION); # Load dependancies use Carp qw(carp confess); use Date::Parse qw(str2time); +use DateTime; use Digest::SHA qw(sha256_base64); use Email::Valid; use File::Copy qw(copy); use File::Path qw(make_path); use File::Slurp qw(read_file write_file); +use File::stat qw(stat); use File::Temp; # qw( :seekable ); use IPC::System::Simple qw(capturex); use JSON qw(from_json to_json); @@ -47,9 +49,6 @@ use Net::Domain::TLD; use POSIX qw(EXIT_FAILURE); use Tie::IxHash; -# Debug -use Data::Dumper; - # Documentation links #XXX: see https://letsencrypt.github.io/acme-spec/ (probably based on https://ietf-wg-acme.github.io/acme/) #XXX: see jwk rfc http://www.rfc-editor.org/rfc/rfc7517.txt @@ -72,7 +71,7 @@ use constant { ACME_PROD_DIR => 'https://acme-v01.api.letsencrypt.org/directory', # Version - VERSION => 'v0.8', + VERSION => '1.3', }; # User agent object @@ -325,7 +324,7 @@ sub directory { my $time = time; # Set directory - my $dir = $self->{prod} ? ACME_PROD_DIR : ACME_DIR; + my $dir = $self->{domain}{prod} ? ACME_PROD_DIR : ACME_DIR; # Create a request my $req = HTTP::Request->new(GET => $dir.'?'.$time); @@ -603,10 +602,10 @@ sub authorize { } @{$self->{domains}}; # Init max run - my $remaining = 10; + my $remaining = 300; # Poll pending - while (--$remaining >= 0 and scalar map { $_->{status} eq 'valid' ? 1 : (); } values %{$self->{challenges}}) { + while (--$remaining >= 0 and scalar map { $_->{status} eq 'pending' ? 1 : (); } values %{$self->{challenges}}) { # Sleep sleep(1); # Poll remaining pending