Read and write to DB from form finally workinggit status

This commit is contained in:
Brian Read 2024-12-01 13:49:42 +00:00
parent bae566758c
commit 918f49eaf2
13 changed files with 190 additions and 133 deletions

View File

@ -1,5 +1,5 @@
# #
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 10:58:16 # Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-11-16 10:30:16
# #
# #
# Routines to be edited by the developer to provide content and validation for parameters # Routines to be edited by the developer to provide content and validation for parameters
@ -53,7 +53,6 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
my $prefix_data = shift; #Data hash as parameter my $prefix_data = shift; #Data hash as parameter
# Validation for each field # Validation for each field
my $ret = ""; my $ret = "";
if (! TRUE) #validate $c->param('status') if (! TRUE) #validate $c->param('status')
{$ret .= 'Validation for status failed';} {$ret .= 'Validation for status failed';}
if (! TRUE) #validate $c->param('hookScript') if (! TRUE) #validate $c->param('hookScript')
@ -118,16 +117,20 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
sub get_data_for_panel_LIST { sub get_data_for_panel_LIST {
# Return a hash with the fields required which will be loaded into the shared data # Return a hash with the fields required which will be loaded into the shared data
my $c = shift; 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 = ( my %ret = (
'Data1'=>'Data for LIST', #Example 'Data1'=>'Data for LIST', #Example
# fields from Inputs in LIST $fields['LIST'] # fields from Inputs in LIST $fields['LIST']
'InternalIP'=>'InternalIP contents', 'InternalIP'=>$cdb->get_prop('InternalInterface','IPAddress'),
'ExternalIP'=>'ExternalIP contents', 'ExternalIP'=>$cdb->get_prop('ExternalInterface','IPAddress'),
'InternetIP'=>'InternetIP contents', 'InternetIP'=>$c->get_my_ip(),
'Issuer'=>'Issuer contents', 'Issuer'=>'$issuer',
'Expiry'=>'Expiry contents', 'Expiry'=>'$expiry',
'NotBefore'=>'NotBefore contents', 'NotBefore'=>'$before',
); );
return %ret; return %ret;
} }
@ -138,15 +141,14 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
my %ret = ( my %ret = (
'Data1'=>'Data for PARAMS', #Example 'Data1'=>'Data for PARAMS', #Example
# fields from Inputs in PARAMS $fields['PARAMS'] # fields from Inputs in PARAMS $fields['PARAMS']
'status'=>'status contents', 'status'=>$cdb->get_prop('letsencrypt', 'status', 'disabled'),
'hookScript'=>'hookScript contents', 'hookScript'=>$cdb->get_prop('letsencrypt', 'hookScript', 'disabled'),
'hostOverride'=>'hostOverride contents', 'hostOverride'=>$cdb->get_prop('letsencrypt', 'hostOverride', 'disabled'),
'ACCEPT_TERMS'=>'ACCEPT_TERMS contents', 'ACCEPT_TERMS'=>$cdb->get_prop('letsencrypt', 'ACCEPT_TERMS', ''),
'API'=>'API contents', 'API'=>$cdb->get_prop('letsencrypt', 'API', '2'),
'keysize'=>'keysize contents', 'keysize'=>$cdb->get_prop('letsencrypt', 'keysize', '4096'),
'configure'=>'configure contents', 'configure'=>$cdb->get_prop('letsencrypt', 'configure', 'none' ),
'Email'=>'Email contents', 'email'=>$cdb->get_prop('letsencrypt', 'email')
); );
return %ret; return %ret;
} }
@ -181,7 +183,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
my %ret = ( my %ret = (
'Data1'=>'Data for CHECKONEDOMAIN', #Example 'Data1'=>'Data for CHECKONEDOMAIN', #Example
# fields from Inputs in CHECKONEDOMAIN $fields['CHECKONEDOMAIN'] # fields from Inputs in CHECKONEDOMAIN $fields['CHECKONEDOMAIN']
'OneDomainToCheck'=>'OneDomainToCheck contents', 'OneDomainToCheck'=>$c->param("CHECKONEDOMAIN"),
'OneDomainsCheck'=>'OneDomainsCheck contents', 'OneDomainsCheck'=>'OneDomainsCheck contents',
); );
@ -194,32 +196,87 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
# Define a constant hash for field name mapping # Define a constant hash for field name mapping
use constant DomainList_FIELD_MAPPING => ( use constant DomainList_FIELD_MAPPING => (
'Table1-Domain name / HOSTNAME' => 'Source-for-Table1-Domain name / HOSTNAME', 'Table1-Domain name / HOSTNAME' => 'Domain',
'Table1-Brief description' => 'Source-for-Table1-Brief description', 'Table1-Brief description' => 'Description',
'Table1-Content' => 'Source-for-Table1-Content', 'Table1-Content' => 'Content',
'Table1-LABEL_NAMESERVERS' => 'Source-for-Table1-LABEL_NAMESERVERS', 'Table1-LABEL_NAMESERVERS' => 'Nameservers',
'Table1-LABEL_POINT' => 'Source-for-Table1-LABEL_POINT', 'Table1-LABEL_POINT' => 'Source-for-Table1-LABEL_POINT',
'Table1-LABEL_LECERT' => 'Source-for-Table1-LABEL_LECERT', 'Table1-LABEL_LECERT' => 'letsencryptSSLcert',
'Table1-IS_IN_CERT' => 'Source-for-Table1-IS_IN_CERT', 'Table1-IS_IN_CERT' => 'isincert',
'Table1-CHECK' => 'Source-for-Table1-CHECK' 'Table1-CHECK' => 'Check'
#'target_field2' => 'source_field2', #'target_field2' => 'source_field2',
# Add more mappings as needed # Add more mappings as needed
); );
use constant TEST_DOMAIN_LIST => (
{ "domain" => "Domain1","fred" => "fred1" , "description"=>"Description1"},
{ "domain" => "Domain2", "fred" => "fred2", "description"=>"Description2" },
{ "domain" => "Domain3", "fred" => "fred3", "description"=>"Description3" },
# Add more test entries as needed
);
sub actual_DomainList { sub actual_DomainList {
my @ret = (); my $c = shift;
# Actual code for extracting DomainList # Actual code for extracting DomainList
return @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 @data = ();
my $check = $c->l('Check Domain');
for ($ddb->domains)
{
my $ns = $_->prop('Nameservers') || 'internet';
my $le = $_->prop('letsencryptSSLcert') || 'disabled';#letsencrypt configure all
my $dname= $_->key;
my $isincert = "N";
my $link = $c->create_link("letsencryptd","CHECKONEDOMAIN","");
my $checklink = "<a href='".$link."&CHECKONEDOMAIN=".$_->key."'>".$check."</a>";
#my $checklink = "<a href=''>check</a>";
$isincert = "Y" if ( $dname ~~ @list);
# domain
push @data,
{ Domain => $_->key,
$_->props,
letsencryptSSLcert => $le,
isincert => $isincert,
Check => $checklink,
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 => "", #$checklink
Nameservers => $c->l($ns),
}
}
}
return @data;
} }
sub get_DomainList { sub get_DomainList {
# Return an array of hashes of the contents for each row and column for DomainList # Return an array of hashes of the contents for each row and column for DomainList
my $c = shift; my $c = shift;
my @source_records = $c->actual_DomainList(); my @source_records = $c->actual_DomainList(); #TEST_DOMAIN_LIST #Replace by code or call to produce contents of table;
my @transformed_records; my @transformed_records;
my %Field_Mapping = DomainList_FIELD_MAPPING; my %Field_Mapping = DomainList_FIELD_MAPPING;
# Iterate over each record in the source array # Iterate over each record in the source array
for my $source_record (@$source_records) { for my $source_record (@source_records) {
my %transformed_record; my %transformed_record;
# Iterate over each key-value pair in the $Field_Mapping constant # Iterate over each key-value pair in the $Field_Mapping constant
while (my ($target, $source) = each %Field_Mapping) { while (my ($target, $source) = each %Field_Mapping) {
@ -289,17 +346,17 @@ sub get_DomainList {
my $db = $cdb; #maybe one of the others my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis'; my $dbkey = 'ChangeThis';
if (! TRUE) #copy or perform with value: InternalIP e.g. $c->setprop($db,$dbkey,$c->param('InternalIP'))) if (! TRUE) #copy or perform with value: InternalIP e.g. $db->set_prop($dbkey,'InternalIP',$c->param('InternalIP'),type=>'service'))
{$ret .= 'Perform/save failed for InternalIP';} {$ret .= 'Perform/save failed for InternalIP';}
if (! TRUE) #copy or perform with value: ExternalIP e.g. $c->setprop($db,$dbkey,$c->param('ExternalIP'))) if (! TRUE) #copy or perform with value: ExternalIP e.g. $db->set_prop($dbkey,'ExternalIP',$c->param('ExternalIP'),type=>'service'))
{$ret .= 'Perform/save failed for ExternalIP';} {$ret .= 'Perform/save failed for ExternalIP';}
if (! TRUE) #copy or perform with value: InternetIP e.g. $c->setprop($db,$dbkey,$c->param('InternetIP'))) if (! TRUE) #copy or perform with value: InternetIP e.g. $db->set_prop($dbkey,'InternetIP',$c->param('InternetIP'),type=>'service'))
{$ret .= 'Perform/save failed for InternetIP';} {$ret .= 'Perform/save failed for InternetIP';}
if (! TRUE) #copy or perform with value: Issuer e.g. $c->setprop($db,$dbkey,$c->param('Issuer'))) if (! TRUE) #copy or perform with value: Issuer e.g. $db->set_prop($dbkey,'Issuer',$c->param('Issuer'),type=>'service'))
{$ret .= 'Perform/save failed for Issuer';} {$ret .= 'Perform/save failed for Issuer';}
if (! TRUE) #copy or perform with value: Expiry e.g. $c->setprop($db,$dbkey,$c->param('Expiry'))) if (! TRUE) #copy or perform with value: Expiry e.g. $db->set_prop($dbkey,'Expiry',$c->param('Expiry'),type=>'service'))
{$ret .= 'Perform/save failed for Expiry';} {$ret .= 'Perform/save failed for Expiry';}
if (! TRUE) #copy or perform with value: NotBefore e.g. $c->setprop($db,$dbkey,$c->param('NotBefore'))) if (! TRUE) #copy or perform with value: NotBefore e.g. $db->set_prop($dbkey,'NotBefore',$c->param('NotBefore'),type=>'service'))
{$ret .= 'Perform/save failed for NotBefore';} {$ret .= 'Perform/save failed for NotBefore';}
if ($ret eq "") {$ret = 'ok';} if ($ret eq "") {$ret = 'ok';}
return $ret; return $ret;
@ -310,28 +367,29 @@ sub get_DomainList {
my $prefix_data = shift; #Data hash as parameter my $prefix_data = shift; #Data hash as parameter
my $ret = ""; my $ret = "";
my $db = $cdb; #maybe one of the others my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis'; my $dbkey = 'letsencrypt';
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
if (! TRUE) #copy or perform with value: status e.g. $c->setprop($db,$dbkey,$c->param('status'))) if (! $db->set_prop($dbkey,'status',$c->param('status'),type=>'service'))
{$ret .= 'Perform/save failed for status';} {$ret .= 'Perform/save failed for status';}
if (! TRUE) #copy or perform with value: hookScript e.g. $c->setprop($db,$dbkey,$c->param('hookScript'))) if (! $db->set_prop($dbkey,'hookScript',$c->param('hookScript'),type=>'service'))
{$ret .= 'Perform/save failed for hookScript';} {$ret .= 'Perform/save failed for hookScript';}
if (! TRUE) #copy or perform with value: hostOverride e.g. $c->setprop($db,$dbkey,$c->param('hostOverride'))) if (! $db->set_prop($dbkey,'hostOverride',$c->param('hostOverride'),type=>'service'))
{$ret .= 'Perform/save failed for hostOverride';} {$ret .= 'Perform/save failed for hostOverride';}
if (! TRUE) #copy or perform with value: ACCEPT_TERMS e.g. $c->setprop($db,$dbkey,$c->param('ACCEPT_TERMS'))) if (! $db->set_prop($dbkey,'ACCEPT_TERMS',$c->param('ACCEPT_TERMS'),type=>'service'))
{$ret .= 'Perform/save failed for ACCEPT_TERMS';} {$ret .= 'Perform/save failed for ACCEPT_TERMS';}
if (! TRUE) #copy or perform with value: API e.g. $c->setprop($db,$dbkey,$c->param('API'))) if (! $db->set_prop($dbkey,'API',$c->param('API'),type=>'service'))
{$ret .= 'Perform/save failed for API';} {$ret .= 'Perform/save failed for API';}
if (! TRUE) #copy or perform with value: keysize e.g. $c->setprop($db,$dbkey,$c->param('keysize'))) if (! $db->set_prop($dbkey,'keysize',$c->param('keysize'),type=>'service'))
{$ret .= 'Perform/save failed for keysize';} {$ret .= 'Perform/save failed for keysize';}
if (! TRUE) #copy or perform with value: configure e.g. $c->setprop($db,$dbkey,$c->param('configure'))) if (! $db->set_prop($dbkey,'configure',$c->param('configure'),type=>'service'))
{$ret .= 'Perform/save failed for configure';} {$ret .= 'Perform/save failed for configure';}
if (! TRUE) #copy or perform with value: Email e.g. $c->setprop($db,$dbkey,$c->param('Email'))) if (! $db->set_prop($dbkey,'email',$c->param('email'),type=>'service'))
{$ret .= 'Perform/save failed for Email';} {$ret .= 'Perform/save failed for email';}
if ($ret eq "") {$ret = 'ok';} if ($ret eq "") {$ret = 'ok';}
return $ret; return $ret;
} }
sub perform_CHECKALLDOMAINS { sub perform_CHECKALLDOMAINS {
my $c = shift; my $c = shift;
my $prefix_data = shift; #Data hash as parameter my $prefix_data = shift; #Data hash as parameter
@ -339,7 +397,7 @@ sub get_DomainList {
my $db = $cdb; #maybe one of the others my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis'; my $dbkey = 'ChangeThis';
if (! TRUE) #copy or perform with value: AllDomainsCheck e.g. $c->setprop($db,$dbkey,$c->param('AllDomainsCheck'))) if (! TRUE) #copy or perform with value: AllDomainsCheck e.g. $db->set_prop($dbkey,'AllDomainsCheck',$c->param('AllDomainsCheck'),type=>'service'))
{$ret .= 'Perform/save failed for AllDomainsCheck';} {$ret .= 'Perform/save failed for AllDomainsCheck';}
if ($ret eq "") {$ret = 'ok';} if ($ret eq "") {$ret = 'ok';}
return $ret; return $ret;
@ -352,7 +410,7 @@ sub get_DomainList {
my $db = $cdb; #maybe one of the others my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis'; my $dbkey = 'ChangeThis';
if (! TRUE) #copy or perform with value: EnabledDomainsCheck e.g. $c->setprop($db,$dbkey,$c->param('EnabledDomainsCheck'))) if (! TRUE) #copy or perform with value: EnabledDomainsCheck e.g. $db->set_prop($dbkey,'EnabledDomainsCheck',$c->param('EnabledDomainsCheck'),type=>'service'))
{$ret .= 'Perform/save failed for EnabledDomainsCheck';} {$ret .= 'Perform/save failed for EnabledDomainsCheck';}
if ($ret eq "") {$ret = 'ok';} if ($ret eq "") {$ret = 'ok';}
return $ret; return $ret;
@ -365,9 +423,9 @@ sub get_DomainList {
my $db = $cdb; #maybe one of the others my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis'; my $dbkey = 'ChangeThis';
if (! TRUE) #copy or perform with value: OneDomainToCheck e.g. $c->setprop($db,$dbkey,$c->param('OneDomainToCheck'))) if (! TRUE) #copy or perform with value: OneDomainToCheck e.g. $db->set_prop($dbkey,'OneDomainToCheck',$c->param('OneDomainToCheck'),type=>'service'))
{$ret .= 'Perform/save failed for OneDomainToCheck';} {$ret .= 'Perform/save failed for OneDomainToCheck';}
if (! TRUE) #copy or perform with value: OneDomainsCheck e.g. $c->setprop($db,$dbkey,$c->param('OneDomainsCheck'))) if (! TRUE) #copy or perform with value: OneDomainsCheck e.g. $db->set_prop($dbkey,'OneDomainsCheck',$c->param('OneDomainsCheck'),type=>'service'))
{$ret .= 'Perform/save failed for OneDomainsCheck';} {$ret .= 'Perform/save failed for OneDomainsCheck';}
if ($ret eq "") {$ret = 'ok';} if ($ret eq "") {$ret = 'ok';}
return $ret; return $ret;
@ -380,4 +438,11 @@ sub create_link{
my $link = "$route?trt=$panel&Selected=$index"; my $link = "$route?trt=$panel&Selected=$index";
return $link; return $link;
} }
sub get_my_ip
{
my ($self, $item, $prop, $default) = @_;
my $output = `/usr/sbin/e-smith/getmyip`;
return $output || "IP";
}
1; 1;

View File

@ -1,6 +1,6 @@
package SrvMngr::Controller::Letsencrypt; package SrvMngr::Controller::Letsencrypt;
# #
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 10:58:16 # Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 13:34:33
# #
#---------------------------------------------------------------------- #----------------------------------------------------------------------
# heading : Network # heading : Network

View File

@ -1,5 +1,5 @@
%# %#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 10:58:16 %# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 13:34:33
%# %#
<div id="Letsencrypt-CHECKALLDOMAINS" class="partial Letsencrypt-CHECKALLDOMAINS"> <div id="Letsencrypt-CHECKALLDOMAINS" class="partial Letsencrypt-CHECKALLDOMAINS">
<script> <script>

View File

@ -1,5 +1,5 @@
%# %#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 10:58:16 %# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 13:34:33
%# %#
<div id="Letsencrypt-CHECKALLENABLEDDOMAINS" class="partial Letsencrypt-CHECKALLENABLEDDOMAINS"> <div id="Letsencrypt-CHECKALLENABLEDDOMAINS" class="partial Letsencrypt-CHECKALLENABLEDDOMAINS">
<script> <script>

View File

@ -1,5 +1,5 @@
%# %#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 10:58:16 %# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 13:34:33
%# %#
<div id="Letsencrypt-CHECKONEDOMAIN" class="partial Letsencrypt-CHECKONEDOMAIN"> <div id="Letsencrypt-CHECKONEDOMAIN" class="partial Letsencrypt-CHECKONEDOMAIN">
<script> <script>

View File

@ -1,5 +1,5 @@
%# %#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 10:58:16 %# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 13:34:33
%# %#
<div id="Letsencrypt-LIST" class="partial Letsencrypt-LIST"> <div id="Letsencrypt-LIST" class="partial Letsencrypt-LIST">
<script> <script>

View File

@ -1,5 +1,5 @@
%# %#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 10:58:16 %# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 13:34:33
%# %#
<div id="Letsencrypt-PARAMS" class="partial Letsencrypt-PARAMS"> <div id="Letsencrypt-PARAMS" class="partial Letsencrypt-PARAMS">
<script> <script>
@ -83,8 +83,8 @@
<p><span class=label> <p><span class=label>
%=l('lets_EMAIL') %=l('lets_EMAIL')
</span><span class=data> </span><span class=data>
% param 'Email' => $lets_data->{Email} unless param 'Email'; % param 'email' => $lets_data->{email} unless param 'email';
%=email_field 'Email', class => 'emai8' %=email_field 'email', class => 'emai8'
</span></p> </span></p>
@ -92,11 +92,6 @@
%= submit_button l('lets_Save'), class => 'action subm9' %= submit_button l('lets_Save'), class => 'action subm9'
</span> </span>
<span class='data'>
%= submit_button l('lets_Back'), class => 'action back', onclick =>'history.back()'
</span>
%# Probably finally by a submit. %# Probably finally by a submit.
%end %end
</div> </div>

View File

@ -1,5 +1,5 @@
/* /*
Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 10:58:16 Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 13:34:33
*/ */
.Letsencrypt-panel {} .Letsencrypt-panel {}
.name {} .name {}
@ -34,7 +34,6 @@ tbody .tabl1 {}
.sele7 {} .sele7 {}
.emai8 {} .emai8 {}
.subm9 {} .subm9 {}
.back10 {}
.name {} .name {}
.rout {} .rout {}
.head {} .head {}

View File

@ -1,5 +1,5 @@
%# %#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 10:58:16 %# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 13:34:33
%# %#
% layout 'default', title => "Sme server 2 - Letsencrypt certificate", share_dir => './'; % layout 'default', title => "Sme server 2 - Letsencrypt certificate", share_dir => './';
%# css specific to this panel: %# css specific to this panel:

View File

@ -1,54 +1,54 @@
# #
# Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 10:58:16 # Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 13:34:33
# #
'lets_API_STATUS' => 'ape Status',
'lets_Status_Report' => 'Status Report',
'lets_Check_all_enabled_domains' => 'Check all enabled domains',
'lets_One_domain_check_result' => 'One domain check result',
'lets_Expiry' => 'Expiry',
'lets_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful',
'lets_IS_IN_CERT' => 'Is In cart',
'lets_External_Interface_IP' => 'External Interface IP',
'lets_CHECKALLDOMAINS_panel_action_was_successful' => 'CHECKALLDOMAINS panel action was successful',
'lets_CHECK_ALL_ENABLED_DOMAINS' => 'Check All Enabled Domains',
'lets_EMAIL' => 'Email',
'lets_Check_just_one_domain' => 'Check just one domain',
'lets_Not_Before' => 'Not Before',
'lets_APPLY' => 'Apply',
'lets_CONFIG_LETSENCRYPT' => 'confirm Letsencrypt',
'lets_Back' => 'Back',
'lets_Content' => 'Content',
'lets_CHECKALLENABLEDDOMAINS_panel_action_was_successful' => 'CHECKALLENABLEDDOMAINS panel action was successful',
'lets_Loop_through_checking_the_letsencrypt' => 'Loop through checking the letsencrypt status for each configured domain which is enabled',
'lets_LABEL_NAMESERVERS' => 'Label timeservers',
'lets_Manage_letsencrypt-config_settings:' => 'Manage letsencrypt-config settings',
'lets_Loop_through_checking_the_letsencrypt' => 'Loop through checking the letsencrypt status for each configured domain',
'lets_CONFIG' => 'Config',
'lets_Domains_name' => 'Domains name',
'lets_Save' => 'Save',
'lets_All_domains_check_result' => 'All domains check result',
'lets_Current_certificate_details' => 'Current certificate details',
'lets_CONFIGUREMODE_STATUS' => 'Configuremode Status',
'lets_Internal_IP' => 'Internal IP',
'lets_HOOKSCRIPT_STATUS' => 'Hookscript Status',
'lets_Issuer' => 'Issuer',
'lets_SERVICE_STATUS' => 'Service Status',
'lets_Check_all_domains' => 'Check all domains',
'lets_Letsencrypt_certificate' => 'Letsencrypt certificate',
'lets_Error_Status_Report' => 'Error Status Report',
'lets_CHECKONEDOMAIN_panel_action_was_successful' => 'CHECKONEDOMAIN panel action was successful',
'lets_For_this_Server' => 'For this Server',
'lets_Loop_through_checking_the_letsencrypt' => 'Loop through checking the letsencrypt status for a specific domain',
'lets_CHECK_ALL_DOMAINS' => 'Check All Domains',
'lets_LIST_panel_action_was_successful' => 'LIST panel action was successful',
'lets_Domain_name_/_HOSTNAME' => 'Domain name / HOSTNAME',
'lets_CHECK' => 'Check', 'lets_CHECK' => 'Check',
'lets_LABEL_LECERT' => 'Label secret', 'lets_Letsencrypt_certificate' => 'Letsencrypt certificate',
'lets_LABEL_POINT' => 'Label Point', 'lets_Loop_through_checking_the_letsencrypt' => 'Loop through checking the letsencrypt status for each configured domain which is enabled',
'lets_List_of_Domains_and_Hosts' => 'List of Domains and Hosts', 'lets_APPLY' => 'Apply',
'lets_KEYSIZE_STATUS' => 'Keysize Status', 'lets_CHECK_ALL_ENABLED_DOMAINS' => 'Check All Enabled Domains',
'lets_Internet_IP' => 'Internet IP', 'lets_Internet_IP' => 'Internet IP',
'lets_Domain_name_/_HOSTNAME' => 'Domain name / HOSTNAME',
'lets_Not_Before' => 'Not Before',
'lets_CHECKONEDOMAIN_panel_action_was_successful' => 'CHECKONEDOMAIN panel action was successful',
'lets_Expiry' => 'Expiry',
'lets_Domains_name' => 'Domains name',
'lets_Loop_through_checking_the_letsencrypt' => 'Loop through checking the letsencrypt status for a specific domain',
'lets_Check_all_enabled_domains' => 'Check all enabled domains',
'lets_EMAIL' => 'Email',
'lets_KEYSIZE_STATUS' => 'Keysize Status',
'lets_Back' => 'Back',
'lets_Check_all_domains' => 'Check all domains',
'lets_LABEL_POINT' => 'Label Point',
'lets_Error_Status_Report' => 'Error Status Report',
'lets_CHECK_ALL_DOMAINS' => 'Check All Domains',
'lets_ACCEPT_TERMS_STATUS' => 'Accept Terms Status', 'lets_ACCEPT_TERMS_STATUS' => 'Accept Terms Status',
'lets_Enabled_domains_check_result' => 'Enabled domains check result', 'lets_All_domains_check_result' => 'All domains check result',
'lets_HOSTOVERRIDE_STATUS' => 'Hostoverride Status', 'lets_List_of_Domains_and_Hosts' => 'List of Domains and Hosts',
'lets_CONFIG_LETSENCRYPT' => 'confirm Letsencrypt',
'lets_Internal_IP' => 'Internal IP',
'lets_Status_Report' => 'Status Report',
'lets_For_this_Server' => 'For this Server',
'lets_CHECKALLENABLEDDOMAINS_panel_action_was_successful' => 'CHECKALLENABLEDDOMAINS panel action was successful',
'lets_LABEL_LECERT' => 'Label secret',
'lets_Content' => 'Content',
'lets_Brief_description' => 'Brief description', 'lets_Brief_description' => 'Brief description',
'lets_HOOKSCRIPT_STATUS' => 'Hookscript Status',
'lets_Enabled_domains_check_result' => 'Enabled domains check result',
'lets_API_STATUS' => 'ape Status',
'lets_Save' => 'Save',
'lets_Issuer' => 'Issuer',
'lets_Current_certificate_details' => 'Current certificate details',
'lets_Loop_through_checking_the_letsencrypt' => 'Loop through checking the letsencrypt status for each configured domain',
'lets_CONFIGUREMODE_STATUS' => 'Configuremode Status',
'lets_External_Interface_IP' => 'External Interface IP',
'lets_IS_IN_CERT' => 'Is In cart',
'lets_SERVICE_STATUS' => 'Service Status',
'lets_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful',
'lets_Manage_letsencrypt-config_settings:' => 'Manage letsencrypt-config settings',
'lets_LABEL_NAMESERVERS' => 'Label timeservers',
'lets_One_domain_check_result' => 'One domain check result',
'lets_CONFIG' => 'Config',
'lets_CHECKALLDOMAINS_panel_action_was_successful' => 'CHECKALLDOMAINS panel action was successful',
'lets_LIST_panel_action_was_successful' => 'LIST panel action was successful',
'lets_HOSTOVERRIDE_STATUS' => 'Hostoverride Status',
'lets_Check_just_one_domain' => 'Check just one domain',

View File

@ -115,8 +115,9 @@ sub get_${tablecontrol[0]} {
my $ret = ""; my $ret = "";
my $db = $cdb; #maybe one of the others my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis'; my $dbkey = 'ChangeThis';
# To make it write to DB as comment, delete this (regex) string in each if statement "TRUE\) \#copy or perform with value: .* e.g."
<tal:block tal:repeat="field fields[panel]"> <tal:block tal:repeat="field fields[panel]">
if (! TRUE) #copy or perform with value: ${field} e.g. $c->setprop($db,$dbkey,$c->param('${field}'))) if (! TRUE) #copy or perform with value: ${field} e.g. $db->set_prop($dbkey,'${field}',$c->param('${field}'),type=>'service'))
{$ret .= 'Perform/save failed for ${field}';}</tal:block> {$ret .= 'Perform/save failed for ${field}';}</tal:block>
if ($ret eq "") {$ret = 'ok';} if ($ret eq "") {$ret = 'ok';}
return $ret; return $ret;

View File

@ -227,7 +227,7 @@
'Input8': { 'Input8': {
'Type': 'Email', 'Type': 'Email',
'Value': '', 'Value': '',
'Name': 'Email', 'Name': 'email',
'Label': 'EMAIL' 'Label': 'EMAIL'
}, },
'Input9': { 'Input9': {
@ -235,11 +235,7 @@
'Value': 'Save', 'Value': 'Save',
'Name': 'Next', 'Name': 'Next',
'Label': null 'Label': null
}, }
'Input10': {
'Type': 'Back',
'Value': 'Back',
}
}, },
{ 'Name':'CheckAllDomains', { 'Name':'CheckAllDomains',
'route':'CHECKALLDOMAINS', 'route':'CHECKALLDOMAINS',

View File

@ -632,9 +632,9 @@ if __name__ == "__main__":
file.write(controller_perl) file.write(controller_perl)
logger.info(f"{controller_file} controller generated ok") logger.info(f"{controller_file} controller generated ok")
except Exception as e: except Exception as e:
logger.info(f"A Chameleon controller render error occurred: {e} {traceback.format_exc()}") logger.info(f"A Chameleon controller *render* error occurred: {e} {traceback.format_exc()}")
except Exception as e: except Exception as e:
logger.info(f"A Chameleon controller template error occurred: {e} {traceback.format_exc()}") logger.info(f"A Chameleon controller *template* error occurred: {e} {traceback.format_exc()}")
# Generate Custom controller file # Generate Custom controller file
try: try:
@ -656,9 +656,9 @@ if __name__ == "__main__":
file.write(custom_controller_perl) file.write(custom_controller_perl)
logger.info(f"{custom_controller_file} custom controller generated ok") logger.info(f"{custom_controller_file} custom controller generated ok")
except Exception as e: except Exception as e:
logger.info(f"A Chameleon custom controller render error occurred: {e} {traceback.format_exc()}") logger.info(f"A Chameleon custom controller *render* error occurred: {e} {traceback.format_exc()}")
except Exception as e: except Exception as e:
logger.info(f"A Chameleon custom controller template error occurred: {e} {traceback.format_exc()}") logger.info(f"A Chameleon custom controller *template* error occurred: {e} {traceback.format_exc()}")
# generate Layout file # generate Layout file
layout_template = PageTemplateFile("Templates/layout.html.ep.tem") layout_template = PageTemplateFile("Templates/layout.html.ep.tem")
@ -672,9 +672,9 @@ if __name__ == "__main__":
file.write(layout_mojo) file.write(layout_mojo)
logger.info(f"{layout_file} mojo template layout file generated ok") logger.info(f"{layout_file} mojo template layout file generated ok")
except Exception as e: except Exception as e:
logger.info(f"A Chameleon render on layout file error occurred: {e}") logger.info(f"A Chameleon *render* on layout file error occurred: {e}")
except Exception as e: except Exception as e:
logger.info(f"A Chameleon template layout file error occurred: {e}") logger.info(f"A Chameleon *template* layout file error occurred: {e}")
# Generate a partial file for each of the entries in the html list # Generate a partial file for each of the entries in the html list
@ -735,11 +735,11 @@ if __name__ == "__main__":
all_controls_html = all_controls_html + control_html all_controls_html = all_controls_html + control_html
except Exception as e: except Exception as e:
logger.info( logger.info(
f"A Chameleon render on partial file control {html_control} error occurred: {e}" f"A Chameleon *render* on partial file control {html_control} error occurred: {e}"
) )
except Exception as e: except Exception as e:
logger.info( logger.info(
f"A Chameleon render on partial file control {html_control} error occurred: {e}" f"A Chameleon *template* on partial file control {html_control} error occurred: {e}"
) )
else: else:
# just a simple entry - name less numerics is type # just a simple entry - name less numerics is type
@ -765,17 +765,18 @@ if __name__ == "__main__":
) )
except Exception as e: except Exception as e:
logger.warning( logger.warning(
f"A Chameleon render on partial file control {html_control} error occurred: {e}" f"A Chameleon *render* on partial file control {html_control} error occurred: {e}"
) )
except Exception as e: except Exception as e:
logger.warning( logger.warning(
f"A Chameleon template partial file control {html_control} error occurred: {e}" f"A Chameleon *template* partial file control {html_control} error occurred: {e}"
) )
else: else:
logger.debug(f"Skipping Chameleon expansion for {html_control}") logger.debug(f"Skipping Chameleon expansion for {html_control}")
simple_control_html = html_controls[html_Type] simple_control_html = html_controls[html_Type]
all_controls_html = all_controls_html + simple_control_html all_controls_html = all_controls_html + simple_control_html
else:
logger.debug(f"{html_Type} not found in html_controls xml")
# Now insert it into the partial file in the correct place. # Now insert it into the partial file in the correct place.
# Read in the text file and split at "%# Inputs etc in here." # Read in the text file and split at "%# Inputs etc in here."
with open(partial_files[i], "r") as file: with open(partial_files[i], "r") as file: