diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2017-05-16 18:07:37 +0200 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2017-05-16 20:48:43 +0200 |
commit | 25b48baa79cbafb51e39cb89f452dc90d9ec70d4 (patch) | |
tree | 888d56c95985b205611745ed528fa8c1355568ad /acme-tinier.pl | |
parent | 30faa3e60ea79b6ed7710bc9aaef678c63a87e41 (diff) | |
download | acme-tinier-25b48baa79cbafb51e39cb89f452dc90d9ec70d4.tar.gz acme-tinier-25b48baa79cbafb51e39cb89f452dc90d9ec70d4.tar.xz acme-tinier-25b48baa79cbafb51e39cb89f452dc90d9ec70d4.zip |
Use the environment more
Diffstat (limited to 'acme-tinier.pl')
-rwxr-xr-x | acme-tinier.pl | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/acme-tinier.pl b/acme-tinier.pl index c0c54f5..22fd443 100755 --- a/acme-tinier.pl +++ b/acme-tinier.pl @@ -9,11 +9,12 @@ use JSON::PP; use Digest::SHA qw(sha256); use IPC::Open2; -my $ca = 'https://acme-staging.api.letsencrypt.org'; -# 'https://acme-v01.api.letsencrypt.org' -my $account_key = 'account.key'; -my $csr_file = shift; -my $public_dir = '/srv/http/htdocs/acme-challenge'; +# https://acme-staging.api.letsencrypt.org +# https://acme-v01.api.letsencrypt.org +my $ca = $ENV{ACME_CA} || die 'ACME_CA not set'; +my $account_key = $ENV{ACCOUNT_KEY} || die 'ACCOUNT_KEY not set'; +my $csr_file = shift || die 'no file was given'; +my $acme_dir = $ENV{ACME_DIR} || die 'ACME_DIR not set'; # Prepare some values derived from account key for the ACME protocol sub b64 { encode_base64url(shift, '') =~ s/=//gr } @@ -106,7 +107,7 @@ for my $domain (@domains) { @{$json->decode($result)->{challenges}}; my $token = $challenge->{token} =~ s/[^A-Za-z0-9_-]/_/r; my $key_auth = "$token.$thumbprint"; - my $known_path = "$public_dir/$token"; + my $known_path = "$acme_dir/$token"; # Make the challenge file and check that it can be retrieved open(my $fh, '>', $known_path) or die "cannot write $known_path: $!"; |