X-Git-Url: https://git.rapsys.eu/acme/blobdiff_plain/d9077b1e3155078c7819629176f65a7720fa1cb6:/letscron..1b0a15d0b5348777515f8424f6f6fde1d7bb7822:/acmecron?ds=inline
diff --git a/letscron b/acmecron
similarity index 87%
rename from letscron
rename to acmecron
index 9a96355..0ffeaad 100755
--- a/letscron
+++ b/acmecron
@@ -13,7 +13,7 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see .
#
-# Copyright (C) 2016 - 2017 Raphaël Gertz
+# Copyright (C) 2016 - 2017 Raphaël Gertz
# Best practice
use strict;
@@ -31,7 +31,7 @@ use File::Spec;
use File::Slurp qw(read_file write_file);
use JSON qw(decode_json);
use IPC::System::Simple qw(capturex $EXITVAL);
-use Acme qw(CERT_DIR CONFIG DS KEY_DIR SERVER_CRT SERVER_KEY);
+use Acme qw(CERT_DIR CONFIG DS KEY_DIR SERVER_CRT SERVER_KEY ACCOUNT_KEY);
# Load POSIX
use POSIX qw(strftime EXIT_SUCCESS EXIT_FAILURE);
@@ -119,6 +119,20 @@ foreach (@{$config->{certificates}}) {
next;
}
+ # Unlink if is a symlink
+ if (-l KEY_DIR.DS.ACCOUNT_KEY) {
+ unless(unlink(KEY_DIR.DS.ACCOUNT_KEY)) {
+ carp('unlink '.KEY_DIR.DS.ACCOUNT_KEY.' failed: '.$!);
+ next;
+ }
+ }
+
+ # Symlink to key
+ unless(symlink($_->{account}, KEY_DIR.DS.ACCOUNT_KEY)) {
+ carp('symlink '.$_->{account}.' to '.KEY_DIR.DS.ACCOUNT_KEY.' failed: '.$!);
+ next;
+ }
+
# Init args
my @args = @{$_->{domains}};
@@ -135,13 +149,13 @@ foreach (@{$config->{certificates}}) {
unshift(@args, '-d');
}
- # Run letscert with args
- my @out = capturex([0..1], 'letscert', @args);
+ # Run acmecert with args
+ my @out = capturex([0..1], 'acmecert', @args);
# Deal with error
if ($EXITVAL != 0) {
print join("\n", @out) if ($debug);
- carp('letscert '.join(', ', @args).' failed: '.$!);
+ carp('acmecert '.join(', ', @args).' failed: '.$!);
next;
}