initial commit of file from CVS for e-smith-manager on Mon 7 Aug 11:32:16 BST 2023
This commit is contained in:
25
root/usr/lib/systemd/system/httpd-admin.service
Normal file
25
root/usr/lib/systemd/system/httpd-admin.service
Normal file
@@ -0,0 +1,25 @@
|
||||
[Unit]
|
||||
Description=httpd-admin The Koozali SME Server Server-Manager web service
|
||||
After=network.target remote-fs.target
|
||||
Documentation=man:httpd(8)
|
||||
Documentation=man:apachectl(8)
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
EnvironmentFile=/etc/sysconfig/httpd
|
||||
ExecStartPre=/sbin/e-smith/service-status httpd-admin
|
||||
ExecStartPre=/sbin/e-smith/expand-template /etc/httpd/admin-conf/httpd.conf
|
||||
ExecStart=/usr/sbin/httpd -f /etc/httpd/admin-conf/httpd.conf -DFOREGROUND
|
||||
ExecReload=/usr/sbin/httpd -f /etc/httpd/admin-conf/httpd.conf -k graceful
|
||||
ExecStop=/bin/kill -WINCH ${MAINPID}
|
||||
# We want systemd to give httpd some time to finish gracefully, but still want
|
||||
# it to kill httpd after TimeoutStopSec if something went wrong during the
|
||||
# graceful stop. Normally, Systemd sends SIGTERM signal right after the
|
||||
# ExecStop, which would kill httpd. We are sending useless SIGCONT here to give
|
||||
# httpd time to finish.
|
||||
KillSignal=SIGCONT
|
||||
PrivateTmp=true
|
||||
|
||||
[Install]
|
||||
WantedBy=sme-server.target
|
||||
|
@@ -0,0 +1,173 @@
|
||||
#!/usr/bin/perl -w
|
||||
package esmith::FormMagick::Panel::bugreport;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use esmith::ConfigDB;
|
||||
use esmith::FormMagick;
|
||||
use Text::Template;
|
||||
use File::Basename;
|
||||
|
||||
our @ISA = qw(esmith::FormMagick Exporter);
|
||||
|
||||
our @EXPORT = qw();
|
||||
|
||||
our $VERSION = sprintf '%d.%03d', q$Revision: 1.6 $ =~ /: (\d+).(\d+)/;
|
||||
|
||||
our $db = esmith::ConfigDB->open or die "Couldn't open ConfigDB\n";
|
||||
|
||||
# Get some basic info on the current SME install
|
||||
our $sysconfig = $db->get('sysconfig');
|
||||
our $systemmode = $db->get_value('SystemMode');
|
||||
our $previoussystemmode = $sysconfig->prop('PreviousSystemMode');
|
||||
our $releaseversion = $sysconfig->prop('ReleaseVersion');
|
||||
|
||||
# Prepare some filehandles for templates and reports
|
||||
our $templatefile = '/tmp/bugreport_template.txt';
|
||||
our $configreportfile = '/tmp/configreport.txt';
|
||||
|
||||
sub new {
|
||||
shift;
|
||||
my $self = esmith::FormMagick->new();
|
||||
$self->{calling_package} = (caller)[0];
|
||||
if (defined($self->cgi->param('action')) && $self->cgi->param('action') eq 'download_config_report') {
|
||||
download_config_report();
|
||||
return 0;
|
||||
}
|
||||
bless $self;
|
||||
return $self;
|
||||
}
|
||||
|
||||
sub create_template
|
||||
{
|
||||
# TBD
|
||||
}
|
||||
|
||||
sub display_page
|
||||
{
|
||||
my $self = shift;
|
||||
print "<tr><td colspan=\"2\"><p><p><b>". $self->localise('DO_NOT_PANIC') ."</b></p>\n";
|
||||
print "\t<p>". $self->localise('SME_EXPERIENCE') ."</p>\n";
|
||||
print "\t<p>". $self->localise('USE_TEMPLATE') .": <a href=\"https://wiki.koozali.org/Bugzilla_Help#Reporting_Bugs\" target=\"_blank\">https://wiki.koozali.org/Bugzilla_Help#Reporting_Bugs</a>. </p>\n";
|
||||
print "\t<p>". $self->localise('PLEASE_REPORT_HERE') .": <a href=\"https://bugs.koozali.org\" target=\"_blank\">https://bugs.koozali.org</a>.</p>";
|
||||
print "</p></td>";
|
||||
print "</tr>\n ";
|
||||
print "<tr><td colspan=\"2\"><p><p>". $self->localise('FOLLOWING_REPORT_MIGHT_HELP') ."</p>\n";
|
||||
print "\t<p>". $self->localise('REPORT_CONTENT') .":</p>\n";
|
||||
print "\t<ul>\n";
|
||||
print "\t\t<li>". $self->localise('SME_VERSION') ."</li>\n";
|
||||
print "\t\t<li>". $self->localise('SERVER_MODE') ."</li>\n";
|
||||
print "\t\t<li>". $self->localise('PREVIOUS_SERVER_MODE') ."</li>\n";
|
||||
print "\t\t<li>". $self->localise('KERNEL_AND_ARCH') ."</li>\n";
|
||||
print "\t\t<li>". $self->localise('INSTALLED_RPMS') ."</li>\n";
|
||||
print "\t\t<li>". $self->localise('ALTERED_TEMPLATES') ."</li>\n";
|
||||
print "\t\t<li>". $self->localise('ALTERED_EVENTS') ."</li>\n";
|
||||
print "\t\t<li>". $self->localise('YUM_REPOS') ."</li>\n";
|
||||
print "</ul>\n";
|
||||
print "\t<p>". $self->localise('PRIVACY') ."</p>\n";
|
||||
print "</p></td>";
|
||||
print "</tr>\n";
|
||||
return '';
|
||||
}
|
||||
|
||||
sub display_donation
|
||||
{
|
||||
my $self = shift;
|
||||
print "<tr><td colspan=\"2\"><p><p><b>". $self->localise('DONATING') ."</b></p>\n";
|
||||
print "\t<p>". $self->localise('AWARE_SME') ."</p>\n";
|
||||
print "\t<p><b>". $self->localise('YOUR_HELP') ."</b></p>\n";
|
||||
print "\t<p>". $self->localise('CONSIDER_DONATING') ."</p>\n";
|
||||
print '<p>
|
||||
<a href="https://wiki.koozali.org/Donate" target="_blank">
|
||||
<img src="/server-common/btn_donateCC_LG.gif" alt="https://wiki.koozali.org/Donate"
|
||||
align="middle"></a>
|
||||
</p>';
|
||||
|
||||
print "\t<p>". $self->localise('THANK_YOU') ."</p>\n";
|
||||
print "</p></td>";
|
||||
print "</tr>\n ";
|
||||
return '';
|
||||
|
||||
}
|
||||
|
||||
|
||||
sub create_configuration_report
|
||||
{
|
||||
my $fm = shift;
|
||||
my $q = $fm->{'cgi'};
|
||||
|
||||
# TBD: possibly check $q for a boolean value eg. from a checkbox
|
||||
# indicating the user has read privacy warning etc.
|
||||
|
||||
# create the reporting template
|
||||
my $configreport_template = Text::Template->new(TYPE => 'FILE', SOURCE => '/etc/e-smith/web/common/configuration_report.tmpl', UNTAINT => 1);
|
||||
my $report_creation_time = $fm->gen_locale_date_string;
|
||||
|
||||
# curent kernel
|
||||
my $curkernel = `uname -r`;
|
||||
|
||||
# get additional RPMs
|
||||
my @newrpms = `/sbin/e-smith/audittools/newrpms`;
|
||||
|
||||
# get additional Repositories
|
||||
my @repositories = `/sbin/e-smith/audittools/repositories`;
|
||||
#print @repositories;
|
||||
|
||||
# get templates
|
||||
my @templates = `/sbin/e-smith/audittools/templates`;
|
||||
|
||||
# get events
|
||||
my @events = `/sbin/e-smith/audittools/events`;
|
||||
|
||||
|
||||
# set template variables
|
||||
my %vars = (report_creation_time => \$report_creation_time,
|
||||
releaseversion => \$releaseversion,
|
||||
curkernel => \$curkernel,
|
||||
systemmode => \$systemmode,
|
||||
previoussystemmode => \$previoussystemmode,
|
||||
newrpms => \@newrpms,
|
||||
templates => \@templates,
|
||||
events => \@events,
|
||||
repositories => \@repositories,
|
||||
);
|
||||
|
||||
# prcess template
|
||||
my $result = $configreport_template->fill_in(HASH => \%vars);
|
||||
|
||||
# write processed template to file
|
||||
open (my $cfgrep, '>', $configreportfile) or die "Could not create temporary file for config report!";
|
||||
print $cfgrep $result;
|
||||
close $cfgrep;
|
||||
}
|
||||
|
||||
sub show_config_report {
|
||||
my $fm = shift;
|
||||
my $q = $fm->{'cgi'};
|
||||
print "<PRE>";
|
||||
open (my $cfgrep, '<', $configreportfile) or die "Could not find temporary config report file!";
|
||||
print while <$cfgrep>;
|
||||
close $cfgrep;
|
||||
print "</PRE>";
|
||||
# that would be too easy!?
|
||||
print "<a href=\"bugreport?action=download_config_report\">".$fm->localise('Download this report')."</a>";
|
||||
return "";
|
||||
|
||||
|
||||
}
|
||||
|
||||
sub download_config_report {
|
||||
my $fm = shift;
|
||||
my $q = $fm->{'cgi'};
|
||||
open (DLFILE, "<$configreportfile") or die "Could not access temporary file for config report!";
|
||||
my @fileholder = <DLFILE>;
|
||||
close (DLFILE) || Error ('close', 'file');
|
||||
print "Content-Type:text/plain\n";#application/x-downloadn";
|
||||
print "Content-Disposition:attachment;filename=" . basename($configreportfile);
|
||||
print "\n\n";
|
||||
print @fileholder ;
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
1;
|
Reference in New Issue
Block a user