aboutsummaryrefslogtreecommitdiffstats
path: root/lacme
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2017-02-19 13:36:11 +0100
committerGuilhem Moulin <guilhem@fripost.org>2017-02-19 13:46:41 +0100
commit84f6363da57ccc3a58fc72f60cf51ca70cea34f6 (patch)
tree9337920e96b91e25195e9e8fa759ec50e0af4ad5 /lacme
parentde585094c458a36a387277544bda5f4004bbb03c (diff)
new-cert: new CLI option "min-days"
Diffstat (limited to 'lacme')
-rwxr-xr-xlacme6
1 files changed, 3 insertions, 3 deletions
diff --git a/lacme b/lacme
index f9b3530..75c1465 100755
--- a/lacme
+++ b/lacme
@@ -60,7 +60,7 @@ sub usage(;$$) {
}
exit $rv;
}
-usage(1) unless GetOptions(\%OPTS, qw/config=s config-certs=s@ socket=s agreement-uri=s quiet|q debug help|h/);
+usage(1) unless GetOptions(\%OPTS, qw/config=s config-certs=s@ socket=s agreement-uri=s min-days=i quiet|q debug help|h/);
usage(0) if $OPTS{help};
$COMMAND = shift(@ARGV) // usage(1, "Missing command");
@@ -619,8 +619,8 @@ elsif ($COMMAND eq 'new-cert') {
# skip certificates that expire at least $conf->{'min-days'} days in the future
if (-f $conf->{$certtype} and defined (my $t = x509_enddate($conf->{$certtype}))) {
- my $d = $conf->{'min-days'} // 10;
- if ($d > 0 and $t - time > $d*86400) {
+ my $d = $OPTS{'min-days'} // $conf->{'min-days'} // 10;
+ if ($d >= 0 and $t - time > $d*86400) {
my $d = POSIX::strftime('%Y-%m-%d %H:%M:%S UTC', gmtime($t));
print STDERR "[$s] Valid until $d, skipping\n" unless $OPTS{quiet};
next;