Add in custom changes for letsencrypt

This commit is contained in:
Brian Read 2024-11-04 18:42:10 +00:00
parent f238fcfa70
commit 3577f5aad0

View File

@ -12,6 +12,7 @@ use esmith::NetworksDB;
use esmith::HostsDB;
use esmith::DomainsDB;
#use Net::SSLeay;
#The most common ones
our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
@ -56,23 +57,20 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
sub get_data_for_panel_LIST {
# Return a hash with the fields required which will be loaded into the shared data
my $c = shift;
# my ($reply, $err, $server_cert) = Net::SSLeay::sslcat('localhost', 443, '/');
# my $issuer = Net::SSLeay::X509_NAME_oneline(Net::SSLeay::X509_get_issuer_name($server_cert));
# my $before = Net::SSLeay::P_ASN1_TIME_get_isotime(Net::SSLeay::X509_get_notBefore($server_cert));
# my $expiry = Net::SSLeay::P_ASN1_TIME_get_isotime(Net::SSLeay::X509_get_notAfter($server_cert));
my %ret = (
'Data1'=>'Data for LIST', #Example
# fields from Inputs in LIST $fields['LIST']
'InternalIP'=>'InternalIP contents',
'ExternalIP'=>'ExternalIP contents',
'InternetIP'=>'InternetIP contents',
'Issuer'=>'Issuer contents',
'Expiry'=>'Expiry contents',
'NotBefore'=>'NotBefore contents',
'InternalIP'=>$cdb->get_prop('InternalInterface','IPAddress'),
'ExternalIP'=>$cdb->get_prop('ExternalInterface','IPAddress'),
'InternetIP'=>"ext ip", #get_my_ip()
'Issuer'=>$issuer,
'Expiry'=>$expiry,
'NotBefore'=>$before,
);
return %ret;
}
@ -123,6 +121,14 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
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;
}
# foreach my $colHead (@$control_data) {
# my ret{$colHead} = "$colhead-1";
# };