More changes to Custom for letsencrypt

This commit is contained in:
Brian Read 2024-11-04 20:52:06 +00:00
parent 3577f5aad0
commit 4fdc86ecec

View File

@ -68,9 +68,9 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
'InternalIP'=>$cdb->get_prop('InternalInterface','IPAddress'), 'InternalIP'=>$cdb->get_prop('InternalInterface','IPAddress'),
'ExternalIP'=>$cdb->get_prop('ExternalInterface','IPAddress'), 'ExternalIP'=>$cdb->get_prop('ExternalInterface','IPAddress'),
'InternetIP'=>"ext ip", #get_my_ip() 'InternetIP'=>"ext ip", #get_my_ip()
'Issuer'=>$issuer, 'Issuer'=>'$issuer',
'Expiry'=>$expiry, 'Expiry'=>'$expiry',
'NotBefore'=>$before, 'NotBefore'=>'$before',
); );
return %ret; return %ret;
} }
@ -120,19 +120,56 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
# default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc" # default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc"
my $c = shift; my $c = shift;
my $control_data = $c->stash('DomainList'); my $control_data = $c->stash('DomainList');
my @ret = {}; #my @ret = {};
my @list;
my @rv = Net::SSLeay::X509_get_subjectAltNames($server_cert);
foreach my $element (@rv) {
next if $element =~ /^\d+$/; ;
#print $element . "\n";
push @list, $element;
}
# foreach my $colHead (@$control_data) { my @list = ();
# my ret{$colHead} = "$colhead-1"; # my @rv = Net::SSLeay::X509_get_subjectAltNames($server_cert);
# }; # foreach my $element (@rv) {
return \@ret; # next if $element =~ /^\d+$/; ;
# #print $element . "\n";
# push @list, $element;
# }
my @data = ();
my $check = $c->l('CHECK');
for ($ddb->domains)
{
my $ns = $_->prop('Nameservers') || 'internet';
my $le = $_->prop('letsencryptSSLcert') || 'disabled';#letsencrypt configure all
my $dname= $_->key;
my $isincert = "N";
my $check = $c->l('lets_CHECK');
$isincert = "Y" if ( $dname ~~ @list);
# domain
push @data,
{ Domain => $_->key,
$_->props,
letsencryptSSLcert => $le,
isincert => $isincert,
Check => $check,
Nameservers => $ns,
};
#and hosts
for my $h ($hdb->get_hosts_by_domain($dname))
{
next if $ddb->get($h->key);
next unless ($h->prop('HostType') eq "Self" || $h->prop('HostType') eq "Local");
$le = $h->prop('letsencryptSSLcert') || 'disabled';#letsencrypt configure all
$isincert = "N";
$isincert = "Y" if ( $h->key ~~ @list);
push @data,
{ Domain => "--> ". $h->key,
$h->props,
Description=>$h->prop('ExternalIP')|| $h->prop('InternalIP')||"",
Content => $h->prop('HostType'),
isincert => $isincert,
Check => $check,
Nameservers => $c->l($ns),
}
}
}
return \@data;
} }