From b09c0c23eec6bce61bd7ee69a0ac5a7fb6087243 Mon Sep 17 00:00:00 2001 From: Přemysl Janouch Date: Wed, 7 Jun 2017 05:47:22 +0200 Subject: Better error output --- acme-tinier.pl | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/acme-tinier.pl b/acme-tinier.pl index 96424fa..0ed35e2 100755 --- a/acme-tinier.pl +++ b/acme-tinier.pl @@ -97,7 +97,7 @@ my ($code, $result, $headers) = get "$ca/terms"; ? $headers->{Location} : '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 sub verify_http { @@ -109,11 +109,11 @@ sub verify_http { ($code, $result) = send_signed($challenge_uri, { 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) { ($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); if ($status->{status} eq 'valid') { last; @@ -130,7 +130,7 @@ for my $domain (@domains) { resource => 'new-authz', 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' } @{$json->decode($result)->{challenges}}; @@ -155,7 +155,7 @@ die 'cannot convert CSR' if $?; ($code, $result) = send_signed("$ca/acme/new-cert", { 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, '')); print "-----BEGIN CERTIFICATE-----\n$pem\n-----END CERTIFICATE-----\n"; -- cgit v1.2.3-70-g09d2