Better error output
This commit is contained in:
parent
92c81596c8
commit
b09c0c23ee
@ -97,7 +97,7 @@ my ($code, $result, $headers) = get "$ca/terms";
|
|||||||
? $headers->{Location}
|
? $headers->{Location}
|
||||||
: 'https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf'
|
: 'https://letsencrypt.org/documents/LE-SA-v1.1.1-August-1-2016.pdf'
|
||||||
});
|
});
|
||||||
die "cannot register: $code" if $code != 201 && $code != 409;
|
die "cannot register: $code\n$result" if $code != 201 && $code != 409;
|
||||||
|
|
||||||
# Check if the file is really there, submit an HTTP challenge and wait
|
# Check if the file is really there, submit an HTTP challenge and wait
|
||||||
sub verify_http {
|
sub verify_http {
|
||||||
@ -109,11 +109,11 @@ sub verify_http {
|
|||||||
($code, $result) = send_signed($challenge_uri, {
|
($code, $result) = send_signed($challenge_uri, {
|
||||||
resource => 'challenge', keyAuthorization => $key_auth
|
resource => 'challenge', keyAuthorization => $key_auth
|
||||||
});
|
});
|
||||||
die "challenge submission failed: $code" if $code != 202;
|
die "challenge submission failed: $code\n$result" if $code != 202;
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
($code, $result) = get $challenge_uri;
|
($code, $result) = get $challenge_uri;
|
||||||
die "challenge verification failed: $code" if $code >= 400;
|
die "challenge verification failed: $code\n$result" 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;
|
||||||
@ -130,7 +130,7 @@ for my $domain (@domains) {
|
|||||||
resource => 'new-authz',
|
resource => 'new-authz',
|
||||||
identifier => { type => 'dns', value => $domain }
|
identifier => { type => 'dns', value => $domain }
|
||||||
});
|
});
|
||||||
die "cannot request challenge: $code" if $code != 201;
|
die "cannot request challenge: $code\n$result" if $code != 201;
|
||||||
|
|
||||||
my ($challenge) = grep { $_->{type} eq 'http-01' }
|
my ($challenge) = grep { $_->{type} eq 'http-01' }
|
||||||
@{$json->decode($result)->{challenges}};
|
@{$json->decode($result)->{challenges}};
|
||||||
@ -155,7 +155,7 @@ die 'cannot convert CSR' if $?;
|
|||||||
($code, $result) = send_signed("$ca/acme/new-cert", {
|
($code, $result) = send_signed("$ca/acme/new-cert", {
|
||||||
resource => 'new-cert', csr => b64 $der
|
resource => 'new-cert', csr => b64 $der
|
||||||
});
|
});
|
||||||
die "cannot sign certificate: $code" if $code != 201;
|
die "cannot sign certificate: $code\n$result" if $code != 201;
|
||||||
|
|
||||||
my $pem = join("\n", unpack '(A64)*', encode_base64($result, ''));
|
my $pem = join("\n", unpack '(A64)*', encode_base64($result, ''));
|
||||||
print "-----BEGIN CERTIFICATE-----\n$pem\n-----END CERTIFICATE-----\n";
|
print "-----BEGIN CERTIFICATE-----\n$pem\n-----END CERTIFICATE-----\n";
|
||||||
|
Reference in New Issue
Block a user