From bae34ca9f1f8d2624b514802519e47f49785d7bb Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Fri, 29 Jan 2016 16:46:31 +0100 Subject: [PATCH] Better AltName selection and deduplication --- root/etc/e-smith/templates/etc/letsencrypt.sh/domains.txt/10domains | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/root/etc/e-smith/templates/etc/letsencrypt.sh/domains.txt/10domains b/root/etc/e-smith/templates/etc/letsencrypt.sh/domains.txt/10domains index 22a8edb..9f2669e 100644 --- a/root/etc/e-smith/templates/etc/letsencrypt.sh/domains.txt/10domains +++ b/root/etc/e-smith/templates/etc/letsencrypt.sh/domains.txt/10domains @@ -2,6 +2,7 @@ use esmith::DomainsDB; use esmith::HostsDB; +use List::MoreUtils qw(uniq); my $d = esmith::DomainsDB->open_ro || die "Couldn't open DomainsDB\n"; my $h = esmith::HostsDB->open_ro || die "Couldn't open HostsDB\n"; @@ -22,12 +23,12 @@ foreach my $host ($h->hosts){ } my $type = $host->prop('HostType') || 'Self'; my $le = $host->prop('Letsencrypt') || 'default'; - if ($le =~ m/^enabled|yes|1|on$/i || + if ((($le =~ m/^enabled|yes|1|on$/i) && (($d->get_prop($d, 'Letsencrypt') || 'enabled') eq 'enabled')) || ($type eq 'Self' && $dom eq $DomainName) && ($le !~ m/^disabled|no|0|off$/)){ push @names, $host->key; } } -$OUT .= join(" ", @names); +$OUT .= join(" ", uniq(@names)); }