Improve error messages
This commit is contained in:
parent
952d12825c
commit
d1f7b80ca9
@ -85,7 +85,7 @@ die 'cannot parse CSR' if $?;
|
|||||||
|
|
||||||
my @domains;
|
my @domains;
|
||||||
push @domains, $1 if $csr =~ /Subject:.*? CN *= *([^\s,;\/]+)/;
|
push @domains, $1 if $csr =~ /Subject:.*? CN *= *([^\s,;\/]+)/;
|
||||||
# FIXME: this may not parse correctly either, try it out
|
# FIXME: this may not parse correctly anymore, try it out
|
||||||
push @domains, map { substr $_, 4 } grep { /^DNS:/ } split(/, /)
|
push @domains, map { substr $_, 4 } grep { /^DNS:/ } split(/, /)
|
||||||
for $csr =~ /X509v3 Subject Alternative Name: \n +([^\n]+)\n/g;
|
for $csr =~ /X509v3 Subject Alternative Name: \n +([^\n]+)\n/g;
|
||||||
|
|
||||||
@ -121,7 +121,7 @@ for my $domain (@domains) {
|
|||||||
eval {
|
eval {
|
||||||
my $url = "http://$domain/.well-known/acme-challenge/$token";
|
my $url = "http://$domain/.well-known/acme-challenge/$token";
|
||||||
my ($code, $result) = get $url;
|
my ($code, $result) = get $url;
|
||||||
die "checking challenge failed: $code" if $code != 200;
|
die "checking $url failed: $code" if $code != 200;
|
||||||
die 'challenge contents differ' if $result ne $key_auth;
|
die 'challenge contents differ' if $result ne $key_auth;
|
||||||
|
|
||||||
# Submit the challenge and wait for the verification to finish
|
# Submit the challenge and wait for the verification to finish
|
||||||
@ -129,18 +129,18 @@ eval {
|
|||||||
resource => 'challenge',
|
resource => 'challenge',
|
||||||
keyAuthorization => $key_auth
|
keyAuthorization => $key_auth
|
||||||
});
|
});
|
||||||
die "checking challenge failed: $code" if $code != 202;
|
die "challenge submission failed: $code" if $code != 202;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
($code, $result) = get $challenge->{uri};
|
($code, $result) = get $challenge->{uri};
|
||||||
die "verifying challenge failed: $code" if $code >= 400;
|
die "challenge verification failed: $code" if $code >= 400;
|
||||||
my $status = $json->decode($result);
|
my $status = $json->decode($result);
|
||||||
if ($status->{status} eq 'valid') {
|
if ($status->{status} eq 'valid') {
|
||||||
last;
|
last;
|
||||||
} elsif ($status->{status} eq 'pending') {
|
} elsif ($status->{status} eq 'pending') {
|
||||||
sleep 1;
|
sleep 1;
|
||||||
} else {
|
} else {
|
||||||
die "verifying challenge failed: $status";
|
die "challenge verification failed: $result";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user