X-Git-Url: https://git.rapsys.eu/acme/blobdiff_plain/e714f0566d12b8ad35c9e3768ed6a6f0f5236a9f:/letscron..707fca91ce64b098f3bc55721f630b6822d48bd8:/acmecron?ds=sidebyside
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;
}