Compare commits

..

No commits in common. "master" and "11_0-2_el8_sme" have entirely different histories.

5 changed files with 43 additions and 77 deletions

View File

@ -7,15 +7,20 @@
# #
use esmith::util; use esmith::util;
use esmith::util::network; use esmith::util::network;
use esmith::ConfigDB::UTF8; use esmith::ConfigDB;
use esmith::HostsDB::UTF8; use esmith::HostsDB;
use esmith::AccountsDB::UTF8; use esmith::AccountsDB;
use esmith::NetworksDB::UTF8; use esmith::NetworksDB;
use esmith::DomainsDB::UTF8; use esmith::DomainsDB;
use constant FALSE => 0; use constant FALSE => 0;
use constant TRUE => 1; use constant TRUE => 1;
our ($cdb,$adb,$ndb,$hdb,$ddb); #The most common ones
our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
# Validation routines - parameters for each panel # Validation routines - parameters for each panel
sub validate_LIST { sub validate_LIST {
@ -156,7 +161,6 @@ sub validate_CHECKONEDOMAIN {
# Get singleton data for each panel # Get singleton data for each panel
sub get_data_for_panel_LIST { sub get_data_for_panel_LIST {
$cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
# 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;
@ -181,7 +185,6 @@ sub get_data_for_panel_PARAMS {
# 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;
$cdb = esmith::ConfigDB->open() || die("Couldn't open config 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']
@ -237,7 +240,6 @@ sub get_data_for_panel_CHECKONEDOMAIN {
# Get control data for table(s) # Get control data for table(s)
# 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-TYPE' => 'Type',
'Table1-Domain name / HOSTNAME' => 'Domain', 'Table1-Domain name / HOSTNAME' => 'Domain',
'Table1-Brief description' => 'Description', 'Table1-Brief description' => 'Description',
'Table1-Content' => 'Content', 'Table1-Content' => 'Content',
@ -247,7 +249,6 @@ use constant DomainList_FIELD_MAPPING => (
'Table1-IS_IN_CERT' => 'isincert', 'Table1-IS_IN_CERT' => 'isincert',
'Table1-CHECK' => 'Check' 'Table1-CHECK' => 'Check'
#'target_field2' => 'source_field2', #'target_field2' => 'source_field2',
# Add more mappings as needed # Add more mappings as needed
); );
@ -271,8 +272,6 @@ sub actual_DomainList {
# #print $element . "\n"; # #print $element . "\n";
# push @list, $element; # push @list, $element;
# } # }
$ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db");
$hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db");
my @data = (); my @data = ();
my $check = $c->l('Check Domain'); my $check = $c->l('Check Domain');
@ -282,15 +281,14 @@ sub actual_DomainList {
my $dname = $_->key; my $dname = $_->key;
my $isincert = "N"; my $isincert = "N";
my $link = $c->create_link("letsencryptd", "CHECKONEDOMAIN", ""); my $link = $c->create_link("letsencryptd", "CHECKONEDOMAIN", "");
my $checklink = $link . "&CHECKONEDOMAIN=" . $_->key; my $checklink = "<a href='" . $link . "&CHECKONEDOMAIN=" . $_->key . "'>" . $check . "</a>";
#my $checklink = "<a href=''>check</a>"; #my $checklink = "<a href=''>check</a>";
$isincert = "Y" if (grep(/^$dname$/, @list)); $isincert = "Y" if ($dname ~~ @list);
# domain # domain
push @data, push @data,
{ {
Type => "Domain",
Domain => $_->key, Domain => $_->key,
$_->props, $_->props,
letsencryptSSLcert => $le, letsencryptSSLcert => $le,
@ -301,15 +299,13 @@ sub actual_DomainList {
#and hosts #and hosts
for my $h ($hdb->get_hosts_by_domain($dname)) { for my $h ($hdb->get_hosts_by_domain($dname)) {
my $hname = $h->key; next if $ddb->get($h->key);
next if $ddb->get($hname);
next unless ($h->prop('HostType') eq "Self" || $h->prop('HostType') eq "Local"); next unless ($h->prop('HostType') eq "Self" || $h->prop('HostType') eq "Local");
$le = $h->prop('letsencryptSSLcert') || 'disabled'; #letsencrypt configure all $le = $h->prop('letsencryptSSLcert') || 'disabled'; #letsencrypt configure all
$isincert = "N"; $isincert = "N";
$isincert = "Y" if (grep(/^$hname$/, @list)); $isincert = "Y" if ($h->key ~~ @list);
push @data, { push @data, {
Type => "Host", Domain => "--> " . $h->key,
Domain => $hname,
$h->props, $h->props,
Description => $h->prop('ExternalIP') || $h->prop('InternalIP') || "", Description => $h->prop('ExternalIP') || $h->prop('InternalIP') || "",
Content => $h->prop('HostType'), Content => $h->prop('HostType'),
@ -444,7 +440,6 @@ sub perform_PARAMS {
my $c = shift; my $c = shift;
my $prefix_data = shift; #Data hash as parameter my $prefix_data = shift; #Data hash as parameter
my $ret = ""; my $ret = "";
$cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
my $db = $cdb; #maybe one of the others my $db = $cdb; #maybe one of the others
my $dbkey = 'letsencrypt'; my $dbkey = 'letsencrypt';
@ -485,7 +480,6 @@ 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
my $ret = ""; my $ret = "";
$cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
my $db = $cdb; #maybe one of the others my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis'; my $dbkey = 'ChangeThis';
@ -502,7 +496,6 @@ sub perform_CHECKALLENABLEDDOMAINS {
my $c = shift; my $c = shift;
my $prefix_data = shift; #Data hash as parameter my $prefix_data = shift; #Data hash as parameter
my $ret = ""; my $ret = "";
$cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db");
my $db = $cdb; #maybe one of the others my $db = $cdb; #maybe one of the others
my $dbkey = 'ChangeThis'; my $dbkey = 'ChangeThis';
@ -553,7 +546,6 @@ sub get_my_ip {
sub update_one_domain { sub update_one_domain {
my ($self, $domain) = @_; my ($self, $domain) = @_;
$ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db");
return "$domain not domain" unless ($ddb->get($domain) || $hdb->get($domain)); return "$domain not domain" unless ($ddb->get($domain) || $hdb->get($domain));
($domain) = ($domain =~ /([\w\p{L}.]+)/); ($domain) = ($domain =~ /([\w\p{L}.]+)/);
my $output = `/etc/e-smith/events/actions/letsencrypt-setdomains " " $domain `; my $output = `/etc/e-smith/events/actions/letsencrypt-setdomains " " $domain `;

View File

@ -30,11 +30,11 @@ use SrvMngr qw(theme_list init_session);
use Data::Dumper; use Data::Dumper;
use esmith::util; use esmith::util;
use esmith::util::network; use esmith::util::network;
use esmith::ConfigDB::UTF8; use esmith::ConfigDB;
use esmith::AccountsDB::UTF8; use esmith::AccountsDB;
use esmith::NetworksDB::UTF8; use esmith::NetworksDB;
use esmith::HostsDB::UTF8; use esmith::HostsDB;
use esmith::DomainsDB::UTF8; use esmith::DomainsDB;
require require
'/usr/share/smanager/lib/SrvMngr/Controller/Letsencrypt-Custom.pm'; #The code that is to be added by the developer '/usr/share/smanager/lib/SrvMngr/Controller/Letsencrypt-Custom.pm'; #The code that is to be added by the developer
@ -53,11 +53,11 @@ sub main {
$c->app->log->info($c->log_req); $c->app->log->info($c->log_req);
#The most common ones #The most common ones
my $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db"); my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
my $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db"); my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
my $ndb = esmith::NetworksDB::UTF8->open() || die("Couldn't open Network db"); my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
my $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db"); my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
my $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
my %lets_data = (); my %lets_data = ();
my $title = $c->l('lets_Letsencrypt_certificate'); my $title = $c->l('lets_Letsencrypt_certificate');
my $modul = ''; my $modul = '';
@ -98,11 +98,11 @@ sub do_update {
my $modul = ''; my $modul = '';
#The most common ones - you might want to comment out any not used. #The most common ones - you might want to comment out any not used.
my $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db"); my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
my $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db"); my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
my $ndb = esmith::NetworksDB::UTF8->open() || die("Couldn't open Network db"); my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
my $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db"); my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
my $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
my %lets_data = (); my %lets_data = ();
my $title = $c->l('lets_Letsencrypt_certificate'); my $title = $c->l('lets_Letsencrypt_certificate');
@ -295,11 +295,11 @@ sub do_display {
$c->app->log->info($c->log_req); $c->app->log->info($c->log_req);
#The most common ones - you might want to comment out any not used. #The most common ones - you might want to comment out any not used.
my $cdb = esmith::ConfigDB::UTF8->open() || die("Couldn't open config db"); my $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
my $adb = esmith::AccountsDB::UTF8->open() || die("Couldn't open Accounts db"); my $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
my $ndb = esmith::NetworksDB::UTF8->open() || die("Couldn't open Network db"); my $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
my $hdb = esmith::HostsDB::UTF8->open() || die("Couldn't open Hosts db"); my $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
my $ddb = esmith::DomainsDB::UTF8->open() || die("Couldn't open Domains db"); my $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
my %lets_data = (); my %lets_data = ();
my $title = $c->l('lets_Letsencrypt_certificate'); my $title = $c->l('lets_Letsencrypt_certificate');
my $modul = ""; my $modul = "";

View File

@ -90,8 +90,6 @@
<h2 class='subh4'><%=l('lets_List_of_Domains_and_Hosts')%></h2> <h2 class='subh4'><%=l('lets_List_of_Domains_and_Hosts')%></h2>
% my $linkbtn = l 'lets_CHECK';
<br /><table class="sme-border TableSort sme-table tabl1 "> <br /><table class="sme-border TableSort sme-table tabl1 ">
<thead class='tabl1'> <thead class='tabl1'>
<tr table-head-row> <tr table-head-row>
@ -108,7 +106,6 @@
<tbody class='tabl1'> <tbody class='tabl1'>
% my $control_data = $c->stash('DomainList'); % my $control_data = $c->stash('DomainList');
% foreach my $row (@$control_data) { % foreach my $row (@$control_data) {
% my $link = $c->render_to_string(inline=>$row->{'Table1-CHECK'});
<tr class='table-row'> <tr class='table-row'>
<td class='sme-border table-col table-col-Table1-Domain name / HOSTNAME'><%=$c->render_to_string(inline=>$row->{'Table1-Domain name / HOSTNAME'})%></td> <td class='sme-border table-col table-col-Table1-Domain name / HOSTNAME'><%=$c->render_to_string(inline=>$row->{'Table1-Domain name / HOSTNAME'})%></td>
<td class='sme-border table-col table-col-Table1-Brief description'><%=$c->render_to_string(inline=>$row->{'Table1-Brief description'})%></td> <td class='sme-border table-col table-col-Table1-Brief description'><%=$c->render_to_string(inline=>$row->{'Table1-Brief description'})%></td>
@ -117,11 +114,7 @@
<td class='sme-border table-col table-col-Table1-LABEL_POINT'><%=$c->render_to_string(inline=>$row->{'Table1-LABEL_POINT'})%></td> <td class='sme-border table-col table-col-Table1-LABEL_POINT'><%=$c->render_to_string(inline=>$row->{'Table1-LABEL_POINT'})%></td>
<td class='sme-border table-col table-col-Table1-LABEL_LECERT'><%=$c->render_to_string(inline=>$row->{'Table1-LABEL_LECERT'})%></td> <td class='sme-border table-col table-col-Table1-LABEL_LECERT'><%=$c->render_to_string(inline=>$row->{'Table1-LABEL_LECERT'})%></td>
<td class='sme-border table-col table-col-Table1-IS_IN_CERT'><%=$c->render_to_string(inline=>$row->{'Table1-IS_IN_CERT'})%></td> <td class='sme-border table-col table-col-Table1-IS_IN_CERT'><%=$c->render_to_string(inline=>$row->{'Table1-IS_IN_CERT'})%></td>
% if ($link ne "") { <td class='sme-border table-col table-col-Table1-CHECK'><%=$c->render_to_string(inline=>$row->{'Table1-CHECK'})%></td>
<td><a href= "<%= $link %>" class="btn btn-outline-primary btn-sm" role="button" > <%= $linkbtn %></a></td>
% } else {
<td>&nbsp</td>
% }
</tr> </tr>
%} %}
</tbody> </tbody>

View File

@ -27,9 +27,8 @@
<p><span class=label> <p><span class=label>
%=l('lets_SERVICE_STATUS') %=l('lets_SERVICE_STATUS')
</span><span class=data> </span><span class=data>
%# my @status_options = [['Disabled' => 'disabled'], ['Enabled' => 'enabled'], ['TEST' => 'test']]; % my @status_options = [['Disabled' => 'disabled'], ['Enabled' => 'enabled'], ['TEST' => 'test']];
% my @status_options = selected_field([['Disabled' => 'disabled'], ['Enabled' => 'enabled'], ['TEST' => 'test']], $lets_data->{status}); % param 'status' => $lets_data->{status} unless param 'status';
%# param 'status' => $lets_data->{status} unless param 'status';
%= select_field 'status' => @status_options, class => 'input' %= select_field 'status' => @status_options, class => 'input'
<br></span> </p> <br></span> </p>

View File

@ -1,6 +1,6 @@
%define name smeserver-certificates %define name smeserver-certificates
%define version 11.0 %define version 11.0
%define release 7 %define release 2
Summary: This is what smeserver-certificates does. Summary: This is what smeserver-certificates does.
Name: %{name} Name: %{name}
Version: %{version} Version: %{version}
@ -25,24 +25,6 @@ AutoReqProv: no
%changelog %changelog
* Fri Jun 27 2025 Brian Read <brianr@koozali.org> 11.0-7.sme
- Bring default theme into line with changes made for AdminLTE theme [SME: 13049]
* Tue Jun 17 2025 John Crisp <jcrisp@safeandsoundit.co.uk> 11.0-6.sme
- Remove formatting from controller file [SME: 13045]
- Add Domain/Host as Types for template checking [SME: 13045]
* Wed Jun 11 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0-5.sme
- open esmith using UTF8 [SME: 13036]
rewrite smartmatches to grep
* Thu Feb 20 2025 Brian Read <brianr@koozali.org> 11.0-4.sme
- Add local open DB in check on domain sub [SME: 12932]
* Mon Feb 17 2025 Brian Read <brianr@koozali.org> 11.0-3.sme
- Change status in template to use helper script to pre-set dropdown value [SME: 12923]
- Update Custom routines to openb DB when required, not relying on global open [SME: 12695]
* Wed Feb 12 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0-2.sme * Wed Feb 12 2025 Jean-Philippe Pialasse <jpp@koozali.org> 11.0-2.sme
- move smanager panel in package [SME: 12916] - move smanager panel in package [SME: 12916]
- add Requires - add Requires