diff --git a/Targets/Letsencrypt/Letsencrypt-Custom.pm b/Targets/Letsencrypt/Letsencrypt-Custom.pm index 0045e1a..cfdad6e 100644 --- a/Targets/Letsencrypt/Letsencrypt-Custom.pm +++ b/Targets/Letsencrypt/Letsencrypt-Custom.pm @@ -68,9 +68,9 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); 'InternalIP'=>$cdb->get_prop('InternalInterface','IPAddress'), 'ExternalIP'=>$cdb->get_prop('ExternalInterface','IPAddress'), 'InternetIP'=>"ext ip", #get_my_ip() - 'Issuer'=>$issuer, - 'Expiry'=>$expiry, - 'NotBefore'=>$before, + 'Issuer'=>'$issuer', + 'Expiry'=>'$expiry', + 'NotBefore'=>'$before', ); 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" my $c = shift; my $control_data = $c->stash('DomainList'); - 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; - } + #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 ret{$colHead} = "$colhead-1"; -# }; - return \@ret; + 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; }