aboutsummaryrefslogtreecommitdiff
path: root/acmeman
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2019-03-15 12:12:43 +0200
committerSergey Poznyakoff <gray@gnu.org>2019-03-15 12:12:43 +0200
commit32ad59e0a9c7f74c7c094d5091bce435c145fe33 (patch)
treefd16d21eaaed41b3b6c58e8db4d36be854022af1 /acmeman
parent66972a8ed32f71ad5ef46bb54e443aa6d99b2723 (diff)
downloadacmeman-32ad59e0a9c7f74c7c094d5091bce435c145fe33.tar.gz
acmeman-32ad59e0a9c7f74c7c094d5091bce435c145fe33.tar.bz2
Multiple 'source' configuration statements.v1.10
* Changes: Version 1.10 * MANIFEST.SKIP: Update. * acmeman: Treat 'source' as multiple keyword. * lib/App/Acmeman/Source/File.pm (new): Append /* only to directory names.
Diffstat (limited to 'acmeman')
-rwxr-xr-xacmeman49
1 files changed, 27 insertions, 22 deletions
diff --git a/acmeman b/acmeman
index ec678d7..f4024f5 100755
--- a/acmeman
+++ b/acmeman
@@ -40,7 +40,7 @@ use App::Acmeman::Domain qw(:files);
use Data::Dumper;
use Text::ParseWords;
-our $VERSION = '1.09';
+our $VERSION = '1.10';
=head1 NAME
@@ -230,6 +230,9 @@ will be autodetected.
The B<file> source reads domain names from one or more disk files. A
mandatory argument specifies the name of the directory where the files
are located. This mode is suitable for use with B<haproxy> pattern files.
+
+Multiple B<source> statements can be defined. They will be processed
+sequentially.
=item B<files=>I<NAME>
@@ -496,11 +499,12 @@ will use the B<LetsEncryptSSL> macro to configure the correct certificate:
[core]
source = file PATTERN [--ignore=RX] [--host=HOST]
-Domain names will be read from files matching I<PATTERN>. This argument
-can be either a valid globbing pattern or a directory name. In the latter
-case, the source module will read all files from that directory, except
-those whose names match the following perl regexp: C<^\.|~$|\.bak$|^#.*#$>.
-The default regexp can be overridden using the B<--ignore> (B<-i>) option.
+Domain names will be read from files matching I<PATTERN>. The argument
+can be a single file or directory name, or a valid globbing pattern.
+If I<PATTERN> is a directory name, the module will read all files from
+that directory, except those matching the following perl regexp:
+C<^\.|~$|\.bak$|^#.*#$>. The default regexp can be overridden using the
+B<--ignore> (B<-i>) option.
The input files must contain exactly one domain name per line. No empty
lines or comments are allowed. The first domain name will become the B<CN>
@@ -902,17 +906,16 @@ sub get_root_cert {
sub initial_setup {
get_root_cert('/etc/ssl/acme/lets-encrypt-x3-cross-signed.pem');
- my $source = $config->get(qw(core source));
- unless (defined($source)) {
+ unless ($config->isset(qw(core source))) {
require App::Acmeman::Source::Apache;
- $source = new App::Acmeman::Source::Apache;
- $source->configure($config);
- $source = undef unless $config->success;
+ my $src = new App::Acmeman::Source::Apache;
+ $src->configure($config);
+ $config->set(qw(core source), $src) unless $config->success;
$config->clrerr;
}
- if ($source) {
- unless ($source->setup(dry_run => $dry_run, force => $force)) {
+ foreach my $src ($config->get(qw(core source))) {
+ unless ($src->setup(dry_run => $dry_run, force => $force)) {
exit(1);
}
}
@@ -1080,7 +1083,7 @@ my %syntax = (
rootdir => { default => '/var/www/acme' },
files => 1,
'time-delta' => { default => 86400 },
- source => { default => 'apache' },
+ source => { default => [ 'apache' ], array => 1 },
'check-alt-names' => { default => 0, parser => \&cb_parse_bool },
'check-dns' => { default => 1, parser => \&cb_parse_bool },
'my-ip' => { array => 1 },
@@ -1186,15 +1189,17 @@ $config = new App::Acmeman::Config($config_file,
});
if ($config->success) {
- if (my $source = $config->get(qw(core source))) {
- my ($name, @args) = quotewords('\s+', 0, $source);
- my $pack = 'App::Acmeman::Source::' . ucfirst($name);
- my $obj = eval "use $pack; new $pack(\@args);";
- if ($@) {
- abend(EX_CONFIG, $@);
+ if (my @source = $config->get(qw(core source))) {
+ foreach my $s (@source) {
+ my ($name, @args) = quotewords('\s+', 0, $s);
+ my $pack = 'App::Acmeman::Source::' . ucfirst($name);
+ my $obj = eval "use $pack; new $pack(\@args);";
+ if ($@) {
+ abend(EX_CONFIG, $@);
+ }
+ $obj->configure($config);
+ $config->set(qw(core source), $obj);
}
- $obj->configure($config);
- $config->set(qw(core source), $obj);
}
if ($time_delta) {
$config->set(qw(core time-delta), $time_delta);

Return to:

Send suggestions and report system problems to the System administrator.