From 3577f5aad07571869bacccc422541395d8c9e5c1 Mon Sep 17 00:00:00 2001 From: Brian Read Date: Mon, 4 Nov 2024 18:42:10 +0000 Subject: [PATCH] Add in custom changes for letsencrypt --- Targets/Letsencrypt/Letsencrypt-Custom.pm | 34 +++++++++++++---------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/Targets/Letsencrypt/Letsencrypt-Custom.pm b/Targets/Letsencrypt/Letsencrypt-Custom.pm index 810d17e..0045e1a 100644 --- a/Targets/Letsencrypt/Letsencrypt-Custom.pm +++ b/Targets/Letsencrypt/Letsencrypt-Custom.pm @@ -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"; # };