A dehydrated (ACME client) integration on SME Server
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
867 B

{
use esmith::DomainsDB;
use esmith::HostsDB;
my $d = esmith::DomainsDB->open_ro || die "Couldn't open DomainsDB\n";
my $h = esmith::HostsDB->open_ro || die "Couldn't open HostsDB\n";
my @names = ( "$DomainName" );
foreach my $domain ($d->domains, $d->get_all_by_prop(type => 'vhost')){
next if ($domain->key eq $DomainName);
my $le = $domain->prop('Letsencrypt') || 'enabled';
push @names, $domain->key unless $le ne 'enabled';
}
foreach my $host ($h->hosts){
my $name = $host->key;
my $dom = $DomainName;
if ($name =~ m/[a-z0-9]*\.(.*)/i){
$dom = $1;
}
my $type = $host->prop('HostType') || 'Self';
my $le = $host->prop('Letsencrypt') || 'default';
if ($le =~ m/^enabled|yes|1|on$/i ||
($type eq 'Self' && $dom eq $DomainName) && ($le !~ m/^disabled|no|0|off$/)){
push @names, $host->key;
}
}
$OUT .= join(" ", @names);
}