mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-09-01 14:55:10 +00:00
Fixes (#310454) to support new audit log format and new libapparmor1.
This commit is contained in:
@@ -197,8 +197,6 @@ sub exportReports {
|
|||||||
my $repName = getReportName($expDir);
|
my $repName = getReportName($expDir);
|
||||||
my $header = getHeader($args,$filts);
|
my $header = getHeader($args,$filts);
|
||||||
|
|
||||||
#$rawLog = $expDir . $repName;
|
|
||||||
|
|
||||||
if ( $args->{'exporttext'} && $args->{'exporttext'} eq '1') {
|
if ( $args->{'exporttext'} && $args->{'exporttext'} eq '1') {
|
||||||
$expLog = "$repName.csv";
|
$expLog = "$repName.csv";
|
||||||
Immunix::Reports::exportLog($expLog,$db,$header->{'csv'});
|
Immunix::Reports::exportLog($expLog,$db,$header->{'csv'});
|
||||||
@@ -226,6 +224,11 @@ while ( <STDIN> ) {
|
|||||||
my $numEvents = '1000'; # Number of event records to return
|
my $numEvents = '1000'; # Number of event records to return
|
||||||
|
|
||||||
if ( $command && $path && $args ) {
|
if ( $command && $path && $args ) {
|
||||||
|
# Arbitrary workaround until all the new code becomes active
|
||||||
|
if ( $args->{'mode'} ) {
|
||||||
|
$args->{'mode_req'} = $args->{'mode'};
|
||||||
|
delete($args->{'mode'});
|
||||||
|
}
|
||||||
|
|
||||||
# yast slows down horribly when passing large number of records
|
# yast slows down horribly when passing large number of records
|
||||||
if ( $args->{'numEvents'} && $args->{'numEvents'} > 0 && $args->{'numEvents'} < 10001 ) {
|
if ( $args->{'numEvents'} && $args->{'numEvents'} > 0 && $args->{'numEvents'} < 10001 ) {
|
||||||
@@ -284,13 +287,15 @@ while ( <STDIN> ) {
|
|||||||
$args->{'sdmode'} =~ s/AccessType//g;
|
$args->{'sdmode'} =~ s/AccessType//g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( $args->{'mode'} ) {
|
|
||||||
if ($args->{'mode'} eq "All") {
|
# Only mode_req is used now
|
||||||
$args->{'mode'} = "-";
|
for ('mode_req', 'mode_deny' ) {
|
||||||
|
if ( $args->{$_} && $args->{$_} eq "All" ) {
|
||||||
|
$args->{$_} = "-";
|
||||||
} else {
|
} else {
|
||||||
$args->{'mode'} =~ s/\&//g;
|
$args->{$_} =~ s/\&//g;
|
||||||
$args->{'mode'} =~ s/Mode\://g;
|
$args->{$_} =~ s/Mode\://g;
|
||||||
$args->{'mode'} =~ s/\s//g;
|
$args->{$_} =~ s/\s//g;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -301,15 +306,6 @@ while ( <STDIN> ) {
|
|||||||
my $sortKey = 'time';
|
my $sortKey = 'time';
|
||||||
if ( $args->{'sortKey'} ) { $sortKey = $args->{'sortKey'}; }
|
if ( $args->{'sortKey'} ) { $sortKey = $args->{'sortKey'}; }
|
||||||
|
|
||||||
# debug
|
|
||||||
########################################
|
|
||||||
#if ($args) {
|
|
||||||
# my $argList = "";
|
|
||||||
# for (sort keys(%$args) ) { $argList .= "$_ is $args->{$_}, "; }
|
|
||||||
# ycp::y2milestone("Today's Available Args: $argList");
|
|
||||||
#}
|
|
||||||
########################################
|
|
||||||
|
|
||||||
if ( $args->{'sort'} && $args->{'sort'} == 1 ) {
|
if ( $args->{'sort'} && $args->{'sort'} == 1 ) {
|
||||||
|
|
||||||
my $filts = Immunix::Reports::setFormFilters($args);
|
my $filts = Immunix::Reports::setFormFilters($args);
|
||||||
@@ -326,10 +322,6 @@ while ( <STDIN> ) {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
# commented lines below work
|
|
||||||
#my $query = getSavedQuery($page);
|
|
||||||
#$db = Immunix::Reports::getEvents($query);
|
|
||||||
#############################################
|
|
||||||
my $filts = Immunix::Reports::setFormFilters($args);
|
my $filts = Immunix::Reports::setFormFilters($args);
|
||||||
$filts = Immunix::Reports::rewriteFilters($filts);
|
$filts = Immunix::Reports::rewriteFilters($filts);
|
||||||
my $query = Immunix::Reports::getQuery($filts,$page,$sortKey,$numEvents);
|
my $query = Immunix::Reports::getQuery($filts,$page,$sortKey,$numEvents);
|
||||||
@@ -351,7 +343,6 @@ while ( <STDIN> ) {
|
|||||||
if ( ! $error || ($error && ($error eq '0')) ) {
|
if ( ! $error || ($error && ($error eq '0')) ) {
|
||||||
$error = Immunix::Reports::parseLog($args);
|
$error = Immunix::Reports::parseLog($args);
|
||||||
delete($args->{'logFile'});
|
delete($args->{'logFile'});
|
||||||
#$db = Immunix::Reports::getArchReport($args);
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ycp::y2error("ag_logparse - Unable to run archived reports: $error");
|
ycp::y2error("ag_logparse - Unable to run archived reports: $error");
|
||||||
@@ -361,7 +352,6 @@ while ( <STDIN> ) {
|
|||||||
|
|
||||||
# Parse Events (On-Demand report from events db)
|
# Parse Events (On-Demand report from events db)
|
||||||
##################################################
|
##################################################
|
||||||
#my $filts = Immunix::Reports::getSirFilters($args);
|
|
||||||
my $filts = Immunix::Reports::setFormFilters($args);
|
my $filts = Immunix::Reports::setFormFilters($args);
|
||||||
$filts = Immunix::Reports::rewriteFilters($filts);
|
$filts = Immunix::Reports::rewriteFilters($filts);
|
||||||
my $query = Immunix::Reports::getQuery($filts,$page,$sortKey,$numEvents);
|
my $query = Immunix::Reports::getQuery($filts,$page,$sortKey,$numEvents);
|
||||||
@@ -369,9 +359,6 @@ while ( <STDIN> ) {
|
|||||||
|
|
||||||
exportReports($args,$db,$filts);
|
exportReports($args,$db,$filts);
|
||||||
|
|
||||||
# New - write out query for later use in page-turning
|
|
||||||
#saveQuery($query);
|
|
||||||
|
|
||||||
} elsif ($args->{'getSirFilters'} && $args->{'getSirFilters'} == 1) {
|
} elsif ($args->{'getSirFilters'} && $args->{'getSirFilters'} == 1) {
|
||||||
|
|
||||||
if ( ref($args) && $args->{'name'} ) {
|
if ( ref($args) && $args->{'name'} ) {
|
||||||
@@ -392,7 +379,6 @@ while ( <STDIN> ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#my $error = sprintf( gettext("ag_logparse: Unknown instruction %s or argument: %s"), ycpGetCommand, ycpGetArgType);
|
|
||||||
my $error = "ag_logparse: Missing instruction or argument!";
|
my $error = "ag_logparse: Missing instruction or argument!";
|
||||||
ycp::y2error($error);
|
ycp::y2error($error);
|
||||||
ycp::Return($error);
|
ycp::Return($error);
|
||||||
|
@@ -161,6 +161,11 @@ while ( <STDIN> ) {
|
|||||||
|
|
||||||
if ( $command && $path && $args ) {
|
if ( $command && $path && $args ) {
|
||||||
|
|
||||||
|
if ( $args->{'mode'} ) {
|
||||||
|
$args->{'mode_req'} = $args->{'mode'};
|
||||||
|
delete($args->{'mode'});
|
||||||
|
}
|
||||||
|
|
||||||
my $error = undef;
|
my $error = undef;
|
||||||
|
|
||||||
if ( $args->{'checkDb'} && $args->{'checkDb'} == 1 ) {
|
if ( $args->{'checkDb'} && $args->{'checkDb'} == 1 ) {
|
||||||
|
@@ -25,17 +25,17 @@
|
|||||||
# -Profile Name 'profile'
|
# -Profile Name 'profile'
|
||||||
# -PID 'pid'
|
# -PID 'pid'
|
||||||
# -Severity 'sevLevel'
|
# -Severity 'sevLevel'
|
||||||
# -Denied Resources 'denyRes'
|
# -Denied Resources 'resource'
|
||||||
# -SD Mode 'sdmode'
|
# -SD Mode 'sdmode'
|
||||||
# -Mode 'mode'
|
# -Mode 'mode'
|
||||||
#
|
#
|
||||||
################################################################################
|
################################################################################
|
||||||
use strict;
|
use strict;
|
||||||
use Immunix::Reports;
|
use Immunix::Reports;
|
||||||
use POSIX;
|
#use POSIX; # causes locale error w/ Exporter
|
||||||
use Locale::gettext;
|
use Locale::gettext;
|
||||||
|
|
||||||
setlocale(LC_MESSAGES, "");
|
#setlocale(LC_MESSAGES, ""); # causes locale error w/ Exporter
|
||||||
textdomain("yast2-apparmor");
|
textdomain("yast2-apparmor");
|
||||||
|
|
||||||
# Sloppy Global
|
# Sloppy Global
|
||||||
@@ -63,7 +63,7 @@ sub logMessage {
|
|||||||
|
|
||||||
sub makeHeader {
|
sub makeHeader {
|
||||||
|
|
||||||
my ($repType,$repConf,$filts) = @_; # Filters & Time are only for SIR
|
my ($repType,$repConf,$filts) = @_; # Filters & Time are only for SIR
|
||||||
|
|
||||||
my $header = undef;
|
my $header = undef;
|
||||||
my $date = localtime;
|
my $date = localtime;
|
||||||
@@ -77,18 +77,21 @@ sub makeHeader {
|
|||||||
|
|
||||||
# Write ESS Header in html format
|
# Write ESS Header in html format
|
||||||
$header->{'html'} = "<table border='1' cellpadding='2'>\n";
|
$header->{'html'} = "<table border='1' cellpadding='2'>\n";
|
||||||
$header->{'html'} .= gettext("<tr><th colspan='7'>Executive Security Summary - Generated by AppArmor</th></tr>");
|
$header->{'html'} .= gettext("<tr><th colspan='7'>Executive Security
|
||||||
$header->{'html'} .= sprintf(gettext("<tr><th colspan='7'>Period: %s to %s</th></tr>\n"), $start, $date);
|
Summary - Generated by AppArmor</th></tr>");
|
||||||
|
$header->{'html'} .= sprintf(gettext("<tr><th colspan='7'>Period: %s to
|
||||||
|
%s</th></tr>\n"), $start, $date);
|
||||||
|
|
||||||
} elsif ( $repType eq 'aud' ) {
|
} elsif ( $repType eq 'aud' ) {
|
||||||
|
|
||||||
# Write AUD Header in csv format
|
# Write AUD Header in csv format
|
||||||
$header->{'csv'} = gettext("# Application Audit Report - Generated by AppArmor\n");
|
$header->{'csv'} = gettext("# Application Audit Report - Generated
|
||||||
|
by AppArmor\n");
|
||||||
$header->{'csv'} .= sprintf(gettext("# Date Run: %s\n\n"), $date);
|
$header->{'csv'} .= sprintf(gettext("# Date Run: %s\n\n"), $date);
|
||||||
|
|
||||||
# Write AUD Header in html format
|
# Write AUD Header in html format
|
||||||
$header->{'html'} = gettext("<table border='1' cellpadding='2'><tr><th colspan='7'>Applications Audit Report - Generated by AppArmor</th></tr>\n");
|
$header->{'html'} = gettext("<table border='1' cellpadding='2'><tr><th
|
||||||
#$header->{'html'} .= sprintf(gettext("<tr><th colspan='7'>Date Run: %s</th></tr>\n"), $date);
|
colspan='7'>Applications Audit Report - Generated by AppArmor</th></tr>\n");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -115,7 +118,6 @@ sub makeHeader {
|
|||||||
$header->{'csv'} .= gettext("# The following filters were used for report generation:\n");
|
$header->{'csv'} .= gettext("# The following filters were used for report generation:\n");
|
||||||
for (sort keys(%$filts)) {
|
for (sort keys(%$filts)) {
|
||||||
unless ( $filts->{'startdate'} || $filts->{'enddate'} ) {
|
unless ( $filts->{'startdate'} || $filts->{'enddate'} ) {
|
||||||
#$header->{'csv'} .= "# Filter: $_, Value: $filts->{$_}\n\n";
|
|
||||||
$header->{'csv'} .= sprintf(gettext("# Filter: %s, Value: %s\n\n"), $_, $filts->{$_});
|
$header->{'csv'} .= sprintf(gettext("# Filter: %s, Value: %s\n\n"), $_, $filts->{$_});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -123,17 +125,6 @@ sub makeHeader {
|
|||||||
$header->{'csv'} .= gettext("# No filters were used for report generation:\n\n\n");
|
$header->{'csv'} .= gettext("# No filters were used for report generation:\n\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ( $count > 0 ) {
|
|
||||||
# print SIR gettext("# The following filters were used for report generation:\n");
|
|
||||||
# for (sort keys(%$filts)) {
|
|
||||||
##print SIR "# Filter: $_, Value: $filts->{$_}\n\n";
|
|
||||||
# my $entry = sprintf(gettext("# Filter: %s, Value: %s\n\n"), $_, $filts->{$_});
|
|
||||||
# print SIR "$entry";
|
|
||||||
# }
|
|
||||||
#} else {
|
|
||||||
# print SIR "# No filters were used for report generation:\n\n\n";
|
|
||||||
#}
|
|
||||||
|
|
||||||
# Write SIR Header in html format
|
# Write SIR Header in html format
|
||||||
$header->{'html'} = gettext("<h3>Security Incident Report - Generated by AppArmor</h3>\n");
|
$header->{'html'} = gettext("<h3>Security Incident Report - Generated by AppArmor</h3>\n");
|
||||||
$header->{'html'} .= sprintf(gettext("<h4>Period: %s - %s</h4>\n"), $start, $date);
|
$header->{'html'} .= sprintf(gettext("<h4>Period: %s - %s</h4>\n"), $start, $date);
|
||||||
@@ -143,7 +134,6 @@ sub makeHeader {
|
|||||||
$header->{'html'} .= gettext("<h4>The following filters were used for report generation:</h4>");
|
$header->{'html'} .= gettext("<h4>The following filters were used for report generation:</h4>");
|
||||||
|
|
||||||
for (sort keys(%$filts)) {
|
for (sort keys(%$filts)) {
|
||||||
#$header->{'html'} .= "<p>Filter: $_, Value: $filts->{$_}</p>";
|
|
||||||
$header->{'html'} .= sprintf(gettext("<p>Filter: %s, Value: %s</p>"), $_, $filts->{$_});
|
$header->{'html'} .= sprintf(gettext("<p>Filter: %s, Value: %s</p>"), $_, $filts->{$_});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -221,48 +211,18 @@ sub getRepConf {
|
|||||||
exit 1;
|
exit 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
# remove default filters
|
# Clear unnecessary filters
|
||||||
if ( $rep->{'prog'} && ( $rep->{'prog'} eq '-' || $rep->{'prog'} eq 'All' ) ) {
|
for my $filt (keys %$rep) {
|
||||||
delete $rep->{'prog'};
|
#$rep->{$filt} =~ s/\s+//g; # repname won't be in here, so no spaces
|
||||||
} else {
|
if ( $rep->{$filt} eq "-" || $rep->{$filt} eq 'All' ||
|
||||||
$filts{'prog'} = $rep->{'prog'};
|
$rep->{$filt} eq '*' )
|
||||||
}
|
{
|
||||||
|
delete($rep->{$filt});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( $rep->{'profile'} && ( $rep->{'profile'} eq '-' || $rep->{'profile'} eq 'All' ) ) {
|
#mark
|
||||||
delete $rep->{'profile'};
|
my $filts = Immunix::Reports::getFilterList($rep);
|
||||||
} else {
|
|
||||||
$filts{'profile'} = $rep->{'profile'};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $rep->{'pid'} && ( $rep->{'pid'} eq '-' || $rep->{'pid'} eq 'All' ) ) {
|
|
||||||
delete $rep->{'pid'};
|
|
||||||
} else {
|
|
||||||
$filts{'pid'} = $rep->{'pid'};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $rep->{'resource'} && ( $rep->{'resource'} eq '-' || $rep->{'resource'} eq 'All' ) ) {
|
|
||||||
delete $rep->{'resource'};
|
|
||||||
} else {
|
|
||||||
$filts{'resource'} = $rep->{'resource'};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $rep->{'severity'} && ( $rep->{'severity'} eq '-' || $rep->{'severity'} eq 'All' ) ) {
|
|
||||||
delete $rep->{'severity'};
|
|
||||||
} else {
|
|
||||||
$filts{'severity'} = $rep->{'severity'};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $rep->{'sdmode'} && ( $rep->{'sdmode'} eq '-' || $rep->{'sdmode'} eq 'All' ) ) {
|
|
||||||
delete $rep->{'sdmode'};
|
|
||||||
} else {
|
|
||||||
$filts{'sdmode'} = $rep->{'sdmode'};
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( $rep->{'mode'} && ( $rep->{'mode'} eq '-' || $rep->{'mode'} eq 'All' ) ) {
|
|
||||||
delete $rep->{'mode'};
|
|
||||||
} else {
|
|
||||||
$filts{'mode'} = $rep->{'mode'};
|
|
||||||
}
|
|
||||||
|
|
||||||
# Mail Type - csv, html, or both
|
# Mail Type - csv, html, or both
|
||||||
if ( $rep->{'csv'} eq '1' && $rep->{'html'} eq '1' ) {
|
if ( $rep->{'csv'} eq '1' && $rep->{'html'} eq '1' ) {
|
||||||
@@ -283,7 +243,7 @@ sub getRepConf {
|
|||||||
|
|
||||||
$rep->{'startTime'} = $rep->{'time'};
|
$rep->{'startTime'} = $rep->{'time'};
|
||||||
$rep->{'endTime'} = time;
|
$rep->{'endTime'} = time;
|
||||||
$rep->{'filters'} = %filts;
|
$rep->{'filters'} = %$filts; # mark ($filts needs to be hash, not hash ref
|
||||||
$rep->{'mailList'} = \@mailList;
|
$rep->{'mailList'} = \@mailList;
|
||||||
|
|
||||||
return $rep;
|
return $rep;
|
||||||
@@ -529,7 +489,6 @@ sub runSir {
|
|||||||
my ($repName,$repFile,$repConf) = @_;
|
my ($repName,$repFile,$repConf) = @_;
|
||||||
|
|
||||||
my $filts = Immunix::Reports::setFormFilters($repConf);
|
my $filts = Immunix::Reports::setFormFilters($repConf);
|
||||||
#my $filts = $repConf->{'filters'};
|
|
||||||
$filts = Immunix::Reports::rewriteFilters($filts);
|
$filts = Immunix::Reports::rewriteFilters($filts);
|
||||||
|
|
||||||
my $start = '1104566401'; # default start, Jan 1, 2005
|
my $start = '1104566401'; # default start, Jan 1, 2005
|
||||||
@@ -561,8 +520,15 @@ sub runSir {
|
|||||||
#Immunix::Reports::exportFormattedText($repName,$repFile,$db); # Replaced stuff below
|
#Immunix::Reports::exportFormattedText($repName,$repFile,$db); # Replaced stuff below
|
||||||
|
|
||||||
for (@$db) {
|
for (@$db) {
|
||||||
print SIR "$_->{'host'},$_->{'date'},$_->{'prog'},$_->{'profile'},$_->{'pid'},";
|
print SIR "$_->{'host'},$_->{'time'},$_->{'prog'},$_->{'profile'},";
|
||||||
print SIR "$_->{'severity'},$_->{'mode'},$_->{'resource'},$_->{'sdmode'}\n";
|
print SIR "$_->{'pid'},$_->{'severity'},$_->{'mode_deny'},$_->{'mode_req'},";
|
||||||
|
print SIR "$_->{'resource'},$_->{'sdmode'},$_->{'op'},$_->{'attr'},";
|
||||||
|
print SIR "$_->{'name_alt'},$_->{'parent'},$_->{'active_hat'},";
|
||||||
|
print SIR "$_->{'net_family'},$_->{'net_proto'},$_->{'net_socktype'}\n";
|
||||||
|
|
||||||
|
# old aa-eventd
|
||||||
|
#print SIR "$_->{'host'},$_->{'date'},$_->{'prog'},$_->{'profile'},$_->{'pid'},";
|
||||||
|
#print SIR "$_->{'severity'},$_->{'mode'},$_->{'resource'},$_->{'sdmode'}\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
close SIR;
|
close SIR;
|
||||||
|
@@ -31,16 +31,7 @@ define term turnArchReportPage (integer curPage, integer lastPage) {
|
|||||||
Settings["turnArch"] = "1";
|
Settings["turnArch"] = "1";
|
||||||
Settings["turnPage"] = "1";
|
Settings["turnPage"] = "1";
|
||||||
|
|
||||||
integer key = 1;
|
reportList = getReportList("sir",Settings);
|
||||||
|
|
||||||
list <map> db = (list <map>) SCR::Read (.logparse, Settings);
|
|
||||||
|
|
||||||
// New map is a list, not a hash
|
|
||||||
foreach ( map record, db, {
|
|
||||||
reportList = add( reportList, `item( `id(key), record["host"]:nil, record["date"]:nil, record["prog"]:nil,
|
|
||||||
record["profile"]:nil, record["pid"]:nil, record["severity"]:nil, record["mode"]:nil, record["resource"]:nil, record["sdmode"]:nil ));
|
|
||||||
key = key + 1;
|
|
||||||
});
|
|
||||||
|
|
||||||
// poor i18n
|
// poor i18n
|
||||||
string myLabel = _("Archived Security Incident Report - Page ") + currentPage + _(" of ") + slastPage;
|
string myLabel = _("Archived Security Incident Report - Page ") + currentPage + _(" of ") + slastPage;
|
||||||
@@ -50,10 +41,9 @@ define term turnArchReportPage (integer curPage, integer lastPage) {
|
|||||||
`Frame( `id(`odframe), myLabel,
|
`Frame( `id(`odframe), myLabel,
|
||||||
|
|
||||||
`VBox(
|
`VBox(
|
||||||
//`Label("Archived Security Incident Report - Page " + currentPage + " of " + slastPage ),
|
|
||||||
`HBox(
|
`HBox(
|
||||||
`VSpacing(10),
|
`VSpacing(10),
|
||||||
`Table(`id(`table), `opt(`keepSorting, `immediate ), `header(_("Host"), _("Date"), _("Program"), _("Profile"), _("PID"), _("Severity"), _("Mode"), _("Detail"), _("Access Type") ), reportList),
|
makeSirTable(reportList),
|
||||||
`VSpacing(0.5)
|
`VSpacing(0.5)
|
||||||
),
|
),
|
||||||
`HSpacing(`opt(`hstretch), 1.0),
|
`HSpacing(`opt(`hstretch), 1.0),
|
||||||
@@ -68,13 +58,10 @@ define term turnArchReportPage (integer curPage, integer lastPage) {
|
|||||||
`VSpacing(1)
|
`VSpacing(1)
|
||||||
));
|
));
|
||||||
|
|
||||||
//UI::ReplaceWidget(`tabContents, odForm);
|
|
||||||
//UI::ReplaceWidget(`tabContents, onDemandForm(list reportList) );
|
|
||||||
|
|
||||||
return odForm;
|
return odForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
define term filterArchForm() { //was reportConfigForm in 1.1
|
define term filterArchForm() {
|
||||||
|
|
||||||
string expPath = "/var/log/apparmor/reports-exported";
|
string expPath = "/var/log/apparmor/reports-exported";
|
||||||
|
|
||||||
@@ -133,25 +120,18 @@ define term filterArchForm() { //was reportConfigForm in 1.1
|
|||||||
`Bottom( `VWeight( 1, `PushButton(`id(`accept), _("&Accept")) )),
|
`Bottom( `VWeight( 1, `PushButton(`id(`accept), _("&Accept")) )),
|
||||||
`Bottom( `VWeight( 1, `PushButton(`id(`browse), _("&Browse")) ))
|
`Bottom( `VWeight( 1, `PushButton(`id(`browse), _("&Browse")) ))
|
||||||
)
|
)
|
||||||
/*
|
|
||||||
`HBox(
|
|
||||||
`Label( _("Select Export Format") ),
|
|
||||||
`Left(`CheckBox(`id(`exportText), _("CSV"), false)),
|
|
||||||
`Left(`CheckBox(`id(`exportHtml), _("HTML"), false))
|
|
||||||
)
|
|
||||||
*/
|
|
||||||
));
|
));
|
||||||
|
|
||||||
return arForm;
|
return arForm;
|
||||||
}
|
}
|
||||||
|
|
||||||
define map<any,any> setArchFilter() { //was reportConfigForm in 1.1
|
define map<any,any> setArchFilter() {
|
||||||
|
|
||||||
map<any,any> Settings = $[];
|
map<any,any> Settings = $[];
|
||||||
|
|
||||||
//term contents_report_config_form =
|
|
||||||
term archForm = filterArchForm();
|
term archForm = filterArchForm();
|
||||||
Wizard::SetContentsButtons( _("Report Configuration Dialog"), archForm, setArchHelp, _("Back"), _("&Next") );
|
Wizard::SetContentsButtons( _("Report Configuration Dialog"), archForm,
|
||||||
|
setArchHelp, _("Back"), _("&Next") );
|
||||||
|
|
||||||
UI::ChangeWidget(`id(`bydate_frame), `Enabled, false);
|
UI::ChangeWidget(`id(`bydate_frame), `Enabled, false);
|
||||||
|
|
||||||
@@ -175,6 +155,7 @@ define map<any,any> setArchFilter() { //was reportConfigForm in 1.1
|
|||||||
boolean bydate = (boolean) UI::QueryWidget(`id(`bydate), `Value);
|
boolean bydate = (boolean) UI::QueryWidget(`id(`bydate), `Value);
|
||||||
|
|
||||||
if ( bydate == true ) {
|
if ( bydate == true ) {
|
||||||
|
|
||||||
integer startDay = (integer) UI::QueryWidget(`id(`startDay), `Value);
|
integer startDay = (integer) UI::QueryWidget(`id(`startDay), `Value);
|
||||||
integer startMonth = (integer) UI::QueryWidget(`id(`startMonth), `Value);
|
integer startMonth = (integer) UI::QueryWidget(`id(`startMonth), `Value);
|
||||||
integer startYear = (integer) UI::QueryWidget(`id(`startYear), `Value);
|
integer startYear = (integer) UI::QueryWidget(`id(`startYear), `Value);
|
||||||
@@ -200,37 +181,14 @@ define map<any,any> setArchFilter() { //was reportConfigForm in 1.1
|
|||||||
UI::ChangeWidget(`id(`endDay), `Value, 0);
|
UI::ChangeWidget(`id(`endDay), `Value, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that start date values are reasonable
|
if ( CheckDate(startDay,startMonth,startYear) == false ) {
|
||||||
if (startDay > 28 && startMonth == 2 && startYear != 2008 && startYear != 2012) {
|
Popup::Error( _("Illegal start date entered. Please retry.") );
|
||||||
Popup::Error(_("February only has 28 days! Fixing."));
|
continue;
|
||||||
UI::ChangeWidget(`id(`startDay), `Value, 28);
|
|
||||||
} else if (startDay > 29 && startMonth == 2 && (startYear==2008 || startYear==2012|| startYear==2016)) {
|
|
||||||
Popup::Error(_("February only has 29 days! Fixing."));
|
|
||||||
UI::ChangeWidget(`id(`startDay), `Value, 29);
|
|
||||||
} else if ( startDay == 31 ) {
|
|
||||||
if (startMonth==4|| startMonth==6 || startMonth==8||startMonth==10||startMonth==12) {
|
|
||||||
Popup::Error(_("Month only has 30 days! Fixing."));
|
|
||||||
UI::ChangeWidget(`id(`startDay), `Value, 30);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check that end date values are reasonable
|
if ( CheckDate(endDay,endMonth,endYear) == false ) {
|
||||||
if (endDay > 28 && endMonth == 2 && endYear != 2008 && endYear != 2012) {
|
Popup::Error( _("Illegal end date entered. Please retry.") );
|
||||||
|
continue;
|
||||||
Popup::Error(_("February only has 28 days! Fixing."));
|
|
||||||
UI::ChangeWidget(`id(`endDay), `Value, 28);
|
|
||||||
|
|
||||||
} else if (endDay > 29 && endMonth == 2 && (endYear==2008 || endYear==2012|| endYear==2016)) {
|
|
||||||
|
|
||||||
Popup::Error(_("February only has 29 days!"));
|
|
||||||
UI::ChangeWidget(`id(`endDay), `Value, 29);
|
|
||||||
|
|
||||||
} else if ( endDay == 31 ) {
|
|
||||||
|
|
||||||
if (endMonth==4|| endMonth==6 || endMonth==8||endMonth==10||endMonth==12) {
|
|
||||||
Popup::Error(_("Month only has 30 days! Fixing."));
|
|
||||||
UI::ChangeWidget(`id(`endDay), `Value, 30);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -321,10 +279,7 @@ define term viewArchForm(string tab, string logFile, map<any,any> Settings) {
|
|||||||
|
|
||||||
Settings["archRep"] = "1";
|
Settings["archRep"] = "1";
|
||||||
Settings["logFile"] = logFile;
|
Settings["logFile"] = logFile;
|
||||||
|
|
||||||
//Settings["type"] = tab; // Changed 04-12-2005
|
|
||||||
Settings["type"] = "archRep";
|
Settings["type"] = "archRep";
|
||||||
// Settings["repPath"] = repPath;
|
|
||||||
|
|
||||||
integer curPage = 1;
|
integer curPage = 1;
|
||||||
string currentPage = "1";
|
string currentPage = "1";
|
||||||
@@ -337,11 +292,10 @@ define term viewArchForm(string tab, string logFile, map<any,any> Settings) {
|
|||||||
}
|
}
|
||||||
Settings["single"] = single;
|
Settings["single"] = single;
|
||||||
|
|
||||||
//any junk = SCR::Read (.logparse,Settings);
|
// mark - new
|
||||||
|
any junk = SCR::Read(.logparse,Settings);
|
||||||
|
|
||||||
// debug -- make sure 'sirRep' is what we want here
|
|
||||||
integer lastPage = getLastPage("sirRep",Settings,"");
|
integer lastPage = getLastPage("sirRep",Settings,"");
|
||||||
|
|
||||||
term myPage = turnArchReportPage(curPage,lastPage);
|
term myPage = turnArchReportPage(curPage,lastPage);
|
||||||
|
|
||||||
return myPage;
|
return myPage;
|
||||||
|
@@ -169,62 +169,6 @@ define list<term> getArrayList(string type, string repPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* For On Demand Reports
|
|
||||||
- Returns list of terms corresponding to the type of report
|
|
||||||
***********************************************************************/
|
|
||||||
define list<term> getReportList(string type, map Settings) {
|
|
||||||
|
|
||||||
list<term> reportList = [];
|
|
||||||
|
|
||||||
if ( type == "aud" ) {
|
|
||||||
|
|
||||||
list <map> db = (list <map>) SCR::Read (.reports_confined, Settings);
|
|
||||||
integer key = 1;
|
|
||||||
|
|
||||||
foreach ( map repdata, db, {
|
|
||||||
reportList = add( reportList, `item( `id(key), repdata["host"]:nil, repdata["date"]:nil,
|
|
||||||
repdata["prog"]:nil, repdata["prof"]:nil, repdata["pid"]:nil, repdata["state"]:nil,
|
|
||||||
repdata["type"]:nil ));
|
|
||||||
key = key + 1;
|
|
||||||
});
|
|
||||||
|
|
||||||
} else if ( type == "ess" ) {
|
|
||||||
|
|
||||||
list <map> db = (list <map>) SCR::Read (.reports_ess, Settings);
|
|
||||||
integer key = 1;
|
|
||||||
|
|
||||||
foreach ( map repdata, db, {
|
|
||||||
reportList = add( reportList, `item( `id(key), repdata["host"]:nil,
|
|
||||||
repdata["startdate"]:nil, repdata["enddate"]:nil, repdata["numRejects"]:nil,
|
|
||||||
repdata["numEvents"]:nil, repdata["sevMean"]:nil, repdata["sevHi"]:nil ));
|
|
||||||
key = key + 1;
|
|
||||||
});
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
list <map> db = (list <map>) SCR::Read (.logparse, Settings);
|
|
||||||
integer key = 1;
|
|
||||||
|
|
||||||
foreach ( map repdata, db, {
|
|
||||||
reportList = add( reportList, `item( `id(key), repdata["host"]:nil,
|
|
||||||
repdata["date"]:nil, repdata["prog"]:nil, repdata["profile"]:nil,
|
|
||||||
repdata["pid"]:nil,repdata["severity"]:nil, repdata["mode"]:nil,
|
|
||||||
repdata["resource"]:nil, repdata["sdmode"]:nil ));
|
|
||||||
key = key + 1;
|
|
||||||
});
|
|
||||||
|
|
||||||
/* Original Stuff
|
|
||||||
term fwdForm = turnReportPage(name,curPage,slastPage,Settings);
|
|
||||||
Wizard::SetContentsButtons( _("AppArmor - Run Reports"), fwdForm,
|
|
||||||
formHelp, _("Back"), _("&Done") );
|
|
||||||
setPageButtons(curPage,lastPage);
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
return reportList;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Filter form for editing scheduled reports
|
// Filter form for editing scheduled reports
|
||||||
define term editFilterForm (map Settings) {
|
define term editFilterForm (map Settings) {
|
||||||
|
|
||||||
@@ -453,10 +397,8 @@ define term filterForm2(string name, map<any,any> preFilters) {
|
|||||||
`HSpacing( `opt(`hstretch), 5)
|
`HSpacing( `opt(`hstretch), 5)
|
||||||
),
|
),
|
||||||
`HBox(
|
`HBox(
|
||||||
//`HWeight( 4, `TextEntry(`id(`res), "Detail", res) ),
|
|
||||||
`VSpacing(0.5),
|
`VSpacing(0.5),
|
||||||
`TextEntry(`id(`res), _("Detail"), res),
|
`TextEntry(`id(`res), _("Detail"), res),
|
||||||
// `Bottom(`ReplacePoint(`id(`replace_sdmode), `PushButton(`id(`sdmode), _("Access Type: ") + sdmode ))),
|
|
||||||
`VBox(
|
`VBox(
|
||||||
`Label( _("Access Type: ") ),
|
`Label( _("Access Type: ") ),
|
||||||
`ReplacePoint(`id(`replace_sdmode), `PushButton(`id(`sdmode), sdmode ))
|
`ReplacePoint(`id(`replace_sdmode), `PushButton(`id(`sdmode), sdmode ))
|
||||||
@@ -465,17 +407,11 @@ define term filterForm2(string name, map<any,any> preFilters) {
|
|||||||
`Label( _("Mode: ") ),
|
`Label( _("Mode: ") ),
|
||||||
`ReplacePoint(`id(`replace_mode), `PushButton(`id(`mode), mode ))
|
`ReplacePoint(`id(`replace_mode), `PushButton(`id(`mode), mode ))
|
||||||
)
|
)
|
||||||
/* `HWeight( 3, `ReplacePoint(`id(`replace_sdmode), `PushButton(`id(`sdmode), "Access Type: " + sdmode ))),
|
|
||||||
`HWeight( 3, `ReplacePoint(`id(`replace_mode), `PushButton(`id(`mode), "Mode: " + mode ))),
|
|
||||||
*/
|
|
||||||
// `HSpacing( `opt(`hstretch), 5)
|
|
||||||
),
|
),
|
||||||
`VSpacing( 0.5 ),
|
`VSpacing( 0.5 ),
|
||||||
|
|
||||||
// mark
|
|
||||||
`HBox(
|
`HBox(
|
||||||
`VSpacing(0.5),
|
`VSpacing(0.5),
|
||||||
// DWR MOD `ComboBox(`id(`expType), `opt(`notify, `immediate), _("Export Type"), [
|
|
||||||
`ComboBox(`id(`expType), `opt(`notify), _("Export Type"), [
|
`ComboBox(`id(`expType), `opt(`notify), _("Export Type"), [
|
||||||
_("None"), _("csv"), _("html"), _("Both")
|
_("None"), _("csv"), _("html"), _("Both")
|
||||||
]),
|
]),
|
||||||
@@ -499,16 +435,21 @@ define term turnReportPage (string name, integer curPage, string slastPage, map
|
|||||||
Settings["page"] = currentPage;
|
Settings["page"] = currentPage;
|
||||||
Settings["turnPage"] = "1";
|
Settings["turnPage"] = "1";
|
||||||
|
|
||||||
integer key = 1;
|
reportList = getReportList("sir", Settings);
|
||||||
|
|
||||||
list <map> db = (list <map>) SCR::Read (.logparse, Settings);
|
|
||||||
|
|
||||||
// New map is a list, not a hash
|
// New map is a list, not a hash
|
||||||
|
|
||||||
|
/* Old aa-eventd
|
||||||
|
list <map> db = (list <map>) SCR::Read (.logparse, Settings);
|
||||||
|
integer key = 1;
|
||||||
foreach ( map record, db, {
|
foreach ( map record, db, {
|
||||||
reportList = add( reportList, `item( `id(key), record["host"]:nil, record["date"]:nil, record["prog"]:nil,
|
reportList = add( reportList, `item( `id(key), record["host"]:nil,
|
||||||
record["profile"]:nil, record["pid"]:nil, record["severity"]:nil, record["mode"]:nil, record["resource"]:nil, record["sdmode"]:nil ));
|
record["date"]:nil, record["prog"]:nil, record["profile"]:nil,
|
||||||
|
record["pid"]:nil, record["severity"]:nil, record["mode"]:nil,
|
||||||
|
record["resource"]:nil, record["sdmode"]:nil ));
|
||||||
key = key + 1;
|
key = key + 1;
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
|
|
||||||
string myLabel = _("On Demand Event Report - Page ") + currentPage + _(" of ") + slastPage;
|
string myLabel = _("On Demand Event Report - Page ") + currentPage + _(" of ") + slastPage;
|
||||||
|
|
||||||
@@ -522,8 +463,12 @@ define term turnReportPage (string name, integer curPage, string slastPage, map
|
|||||||
|
|
||||||
`HBox(
|
`HBox(
|
||||||
`VSpacing(10),
|
`VSpacing(10),
|
||||||
|
// New aa-eventd
|
||||||
|
makeSirTable(reportList),
|
||||||
|
/* Old aa-eventd
|
||||||
`Table(`id(`table), `opt(`keepSorting, `immediate ), `header( _("Host"), _("Date"), _("Program"),
|
`Table(`id(`table), `opt(`keepSorting, `immediate ), `header( _("Host"), _("Date"), _("Program"),
|
||||||
_("Profile"), _("PID"), _("Severity"), _("Mode"), _("Detail"), _("Access Type") ), reportList),
|
_("Profile"), _("PID"), _("Severity"), _("Mode"), _("Detail"), _("Access Type") ), reportList),
|
||||||
|
*/
|
||||||
|
|
||||||
`VSpacing(0.5)
|
`VSpacing(0.5)
|
||||||
),
|
),
|
||||||
@@ -604,7 +549,6 @@ define symbol reportConfigForm() {
|
|||||||
UI::ChangeWidget(`id(`exportName), `Value, "/tmp/export.log");
|
UI::ChangeWidget(`id(`exportName), `Value, "/tmp/export.log");
|
||||||
|
|
||||||
while( true ) {
|
while( true ) {
|
||||||
|
|
||||||
event = UI::WaitForEvent( timeout_millisec );
|
event = UI::WaitForEvent( timeout_millisec );
|
||||||
id = event["ID"]:nil; // We'll need this often - cache it
|
id = event["ID"]:nil; // We'll need this often - cache it
|
||||||
|
|
||||||
@@ -615,56 +559,6 @@ define symbol reportConfigForm() {
|
|||||||
integer end_month = (integer) UI::QueryWidget(`id(`end_month), `Value);
|
integer end_month = (integer) UI::QueryWidget(`id(`end_month), `Value);
|
||||||
integer end_year = (integer) UI::QueryWidget(`id(`end_year), `Value);
|
integer end_year = (integer) UI::QueryWidget(`id(`end_year), `Value);
|
||||||
|
|
||||||
// start_day & start_month are mutually exclusive
|
|
||||||
if ( id == `start_day ) {
|
|
||||||
UI::ChangeWidget(`id(`start_month), `Value, 0);
|
|
||||||
} else if ( id == `start_month ) {
|
|
||||||
UI::ChangeWidget(`id(`start_day), `Value, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// start_day & start_month are mutually exclusive
|
|
||||||
if ( id == `end_day ) {
|
|
||||||
UI::ChangeWidget(`id(`end_month), `Value, 0);
|
|
||||||
} else if ( id == `end_month ) {
|
|
||||||
UI::ChangeWidget(`id(`end_day), `Value, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
// check for reasonable date values
|
|
||||||
// Check that start date values are reasonable
|
|
||||||
if (start_day > 28 && start_month == 2 && start_year != 2008 && start_year != 2012) {
|
|
||||||
Popup::Error( _("February only has 28 days! Fixing.") );
|
|
||||||
UI::ChangeWidget(`id(`startDay), `Value, 28);
|
|
||||||
} else if (start_day > 29 && start_month == 2 && (start_year==2008 || start_year==2012|| start_year==2016)) {
|
|
||||||
Popup::Error( _("February only has 29 days! Fixing.") );
|
|
||||||
UI::ChangeWidget(`id(`start_day), `Value, 29);
|
|
||||||
} else if ( start_day == 31 ) {
|
|
||||||
if (start_month==4|| start_month==6 || start_month==8||start_month==10||start_month==12) {
|
|
||||||
Popup::Error( _("Month only has 30 days! Fixing.") );
|
|
||||||
UI::ChangeWidget(`id(`start_day), `Value, 30);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check that end date values are reasonable
|
|
||||||
if (end_day > 28 && end_month == 2 && end_year != 2008 && end_year != 2012) {
|
|
||||||
|
|
||||||
Popup::Error( _("February only has 28 days! Fixing.") );
|
|
||||||
UI::ChangeWidget(`id(`end_day), `Value, 28);
|
|
||||||
|
|
||||||
} else if (end_day > 29 && end_month == 2 && (end_year==2008 || end_year==2012|| end_year==2016)) {
|
|
||||||
|
|
||||||
Popup::Error( _("February only has 29 days!") );
|
|
||||||
UI::ChangeWidget(`id(`end_day), `Value, 29);
|
|
||||||
|
|
||||||
} else if ( end_day == 31 ) {
|
|
||||||
|
|
||||||
if (end_month==4|| end_month==6 || end_month==8||end_month==10||end_month==12) {
|
|
||||||
Popup::Error( _("Month only has 30 days! Fixing.") );
|
|
||||||
UI::ChangeWidget(`id(`end_day), `Value, 30);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
if ( id == `byprog ) {
|
if ( id == `byprog ) {
|
||||||
boolean val = (boolean) UI::QueryWidget(`id(`byprog), `Value);
|
boolean val = (boolean) UI::QueryWidget(`id(`byprog), `Value);
|
||||||
if ( val == true ) {
|
if ( val == true ) {
|
||||||
@@ -712,28 +606,38 @@ define symbol reportConfigForm() {
|
|||||||
string program_name = (string) UI::QueryWidget(`id(`prog), `Value);
|
string program_name = (string) UI::QueryWidget(`id(`prog), `Value);
|
||||||
Settings["prog"] = program_name;
|
Settings["prog"] = program_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bydate ) {
|
if ( bydate ) {
|
||||||
|
|
||||||
integer start_hour = (integer) UI::QueryWidget(`id(`startHour), `Value);
|
integer start_hour = (integer) UI::QueryWidget(`id(`startHour), `Value);
|
||||||
integer start_min = (integer) UI::QueryWidget(`id(`startMin), `Value);
|
integer start_min = (integer) UI::QueryWidget(`id(`startMin), `Value);
|
||||||
string start_day = (string) UI::QueryWidget(`id(`startDay), `Value);
|
integer startDay = (integer) UI::QueryWidget(`id(`startDay), `Value);
|
||||||
string start_month = (string) UI::QueryWidget(`id(`startMonth), `Value);
|
integer startMonth = (integer) UI::QueryWidget(`id(`startMonth), `Value);
|
||||||
integer start_year = (integer) UI::QueryWidget(`id(`startYear), `Value);
|
integer startYear = (integer) UI::QueryWidget(`id(`startYear), `Value);
|
||||||
integer end_hour = (integer) UI::QueryWidget(`id(`endHour), `Value);
|
integer end_hour = (integer) UI::QueryWidget(`id(`endHour), `Value);
|
||||||
integer end_min = (integer) UI::QueryWidget(`id(`endMin), `Value);
|
integer end_min = (integer) UI::QueryWidget(`id(`endMin), `Value);
|
||||||
string end_day = (string) UI::QueryWidget(`id(`endDay), `Value);
|
integer endDay = (integer) UI::QueryWidget(`id(`endDay), `Value);
|
||||||
string end_month = (string) UI::QueryWidget(`id(`endMonth), `Value);
|
integer endMonth = (integer) UI::QueryWidget(`id(`endMonth), `Value);
|
||||||
integer end_year = (integer) UI::QueryWidget(`id(`endYear), `Value);
|
integer endYear = (integer) UI::QueryWidget(`id(`endYear), `Value);
|
||||||
|
|
||||||
string start_time = tostring(start_hour) + ":" + tostring(start_min);
|
string start_time = tostring(start_hour) + ":" + tostring(start_min);
|
||||||
string end_time = tostring(end_hour) + ":" + tostring(end_min);
|
string end_time = tostring(end_hour) + ":" + tostring(end_min);
|
||||||
|
|
||||||
Settings["startday"] = tostring(start_day);
|
if ( CheckDate(startDay,startMonth,startYear) == false ) {
|
||||||
Settings["startmonth"] = tostring(start_month);
|
Popup::Error( _("Illegal start date entered. Please retry.") );
|
||||||
Settings["startyear"] = tostring(start_year);
|
continue;
|
||||||
Settings["endday"] = tostring(end_day);
|
}
|
||||||
Settings["endmonth"] = tostring(end_month);
|
|
||||||
Settings["endyear"] = tostring(end_year);
|
if ( CheckDate(endDay,endMonth,endYear) == false ) {
|
||||||
|
Popup::Error( _("Illegal end date entered. Please retry.") );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
Settings["startday"] = tostring(startDay);
|
||||||
|
Settings["startmonth"] = tostring(startMonth);
|
||||||
|
Settings["startyear"] = tostring(startYear);
|
||||||
|
Settings["endday"] = tostring(endDay);
|
||||||
|
Settings["endmonth"] = tostring(endMonth);
|
||||||
|
Settings["endyear"] = tostring(endYear);
|
||||||
Settings["starttime"] = start_time;
|
Settings["starttime"] = start_time;
|
||||||
Settings["endtime"] = end_time;
|
Settings["endtime"] = end_time;
|
||||||
}
|
}
|
||||||
@@ -769,7 +673,8 @@ define symbol mainArchivedReportForm() {
|
|||||||
`Label( _("AppArmor Event Report Data") ),
|
`Label( _("AppArmor Event Report Data") ),
|
||||||
`HBox(
|
`HBox(
|
||||||
`VSpacing(10),
|
`VSpacing(10),
|
||||||
`Table(`id(`table), `opt(`notify, `immediate ), `header(_("Date"), _("Profile"), _("PID"), _("AppArmor Message") ), reportlist),
|
`Table(`id(`table), `opt(`notify, `immediate ), `header(_("Date"),
|
||||||
|
_("Profile"), _("PID"), _("AppArmor Message") ), reportlist),
|
||||||
`VSpacing(0.5)
|
`VSpacing(0.5)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
@@ -908,7 +813,8 @@ define term viewForm(map archType, list itemList, string repPath) {
|
|||||||
`VSpacing(0.5),
|
`VSpacing(0.5),
|
||||||
`VWeight( 10, `HBox(
|
`VWeight( 10, `HBox(
|
||||||
`VSpacing(1),
|
`VSpacing(1),
|
||||||
`Table(`id(`table), `opt(`notify, `immediate), `header(_("Report"), _("Date") ), itemList ) )
|
`Table(`id(`table), `opt(`notify, `immediate), `header(_("Report"),
|
||||||
|
_("Date") ), itemList ) )
|
||||||
),
|
),
|
||||||
`VSpacing(1),
|
`VSpacing(1),
|
||||||
`HBox(
|
`HBox(
|
||||||
@@ -1013,8 +919,13 @@ define map<any,any> filterConfigForm(string name) {
|
|||||||
|
|
||||||
// Setup the data structures.
|
// Setup the data structures.
|
||||||
boolean bydate = (boolean) UI::QueryWidget(`id(`bydate), `Value);
|
boolean bydate = (boolean) UI::QueryWidget(`id(`bydate), `Value);
|
||||||
boolean expText = (boolean) UI::QueryWidget(`id(`exportText), `Value);
|
boolean expText = false;
|
||||||
boolean expHtml = (boolean) UI::QueryWidget(`id(`exportHtml), `Value);
|
boolean expHtml = false;
|
||||||
|
|
||||||
|
if ( UI::QueryWidget(`id(`expLog), `Enabled) == true ) {
|
||||||
|
expText = (boolean) UI::QueryWidget(`id(`exportText), `Value);
|
||||||
|
expHtml = (boolean) UI::QueryWidget(`id(`exportHtml), `Value);
|
||||||
|
}
|
||||||
|
|
||||||
if ( expText == true ) {
|
if ( expText == true ) {
|
||||||
Settings["exporttext"] = "true";
|
Settings["exporttext"] = "true";
|
||||||
@@ -1049,19 +960,36 @@ define map<any,any> filterConfigForm(string name) {
|
|||||||
|
|
||||||
if ( bydate == true ) {
|
if ( bydate == true ) {
|
||||||
|
|
||||||
integer start_hour = (integer) UI::QueryWidget(`id(`startHour), `Value);
|
integer start_hour = (integer) UI::QueryWidget(`id(`startHour), `Value);
|
||||||
integer start_min = (integer) UI::QueryWidget(`id(`startMin), `Value);
|
integer start_min = (integer) UI::QueryWidget(`id(`startMin), `Value);
|
||||||
string start_day = (string) UI::QueryWidget(`id(`startDay), `Value);
|
integer startDay = (integer) UI::QueryWidget(`id(`startDay), `Value);
|
||||||
string start_month = (string) UI::QueryWidget(`id(`startMonth), `Value);
|
integer startMonth = (integer) UI::QueryWidget(`id(`startMonth), `Value);
|
||||||
integer start_year = (integer) UI::QueryWidget(`id(`startYear), `Value);
|
integer startYear = (integer) UI::QueryWidget(`id(`startYear), `Value);
|
||||||
integer end_hour = (integer) UI::QueryWidget(`id(`endHour), `Value);
|
integer end_hour = (integer) UI::QueryWidget(`id(`endHour), `Value);
|
||||||
integer end_min = (integer) UI::QueryWidget(`id(`endMin), `Value);
|
integer end_min = (integer) UI::QueryWidget(`id(`endMin), `Value);
|
||||||
string end_day = (string) UI::QueryWidget(`id(`endDay), `Value);
|
integer endDay = (integer) UI::QueryWidget(`id(`endDay), `Value);
|
||||||
string end_month = (string) UI::QueryWidget(`id(`endMonth), `Value);
|
integer endMonth = (integer) UI::QueryWidget(`id(`endMonth), `Value);
|
||||||
integer end_year = (integer) UI::QueryWidget(`id(`endYear), `Value);
|
integer endYear = (integer) UI::QueryWidget(`id(`endYear), `Value);
|
||||||
|
|
||||||
string start_time = tostring(start_hour) + ":" + tostring(start_min);
|
string start_time = tostring(start_hour) + ":" + tostring(start_min);
|
||||||
string end_time = tostring(end_hour) + ":" + tostring(end_min);
|
string end_time = tostring(end_hour) + ":" + tostring(end_min);
|
||||||
|
|
||||||
|
if ( CheckDate(startDay,startMonth,startYear) == false ) {
|
||||||
|
Popup::Error( _("Illegal start date entered. Please retry.") );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( CheckDate(endDay,endMonth,endYear) == false ) {
|
||||||
|
Popup::Error( _("Illegal end date entered. Please retry.") );
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
string start_day = tostring(startDay);
|
||||||
|
string start_month = tostring(startMonth);
|
||||||
|
string start_year = tostring(startYear);
|
||||||
|
string end_day = tostring(endDay);
|
||||||
|
string end_month = tostring(endMonth);
|
||||||
|
string end_year = tostring(endYear);
|
||||||
|
|
||||||
Settings["startday"] = tostring(start_day);
|
Settings["startday"] = tostring(start_day);
|
||||||
Settings["startmonth"] = tostring(start_month);
|
Settings["startmonth"] = tostring(start_month);
|
||||||
@@ -1095,9 +1023,18 @@ define map<any,any> filterConfigForm(string name) {
|
|||||||
return Settings;
|
return Settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
define term displayEmptyRep() {
|
define term displayEmptyRep(string type) {
|
||||||
|
|
||||||
string myLabel = _("Events DB Not Initialized.");
|
string myLabel = "";
|
||||||
|
string myInfo = "";
|
||||||
|
|
||||||
|
if ( type == "noDb" ) {
|
||||||
|
myLabel = _("Events DB Not Initialized.");
|
||||||
|
myInfo = _("The events database has not been populated. No records exist.");
|
||||||
|
} else if ( type == "noList" ) {
|
||||||
|
myLabel = _("Query Returned Empty List.");
|
||||||
|
myInfo = _("The events database has no records that match the search query.");
|
||||||
|
}
|
||||||
|
|
||||||
term newPage =
|
term newPage =
|
||||||
|
|
||||||
@@ -1107,7 +1044,7 @@ define term displayEmptyRep() {
|
|||||||
//`Label(myLabel),
|
//`Label(myLabel),
|
||||||
`HBox(
|
`HBox(
|
||||||
`VSpacing(10),
|
`VSpacing(10),
|
||||||
`Label( _("The events database has not been populated. No records exist.")),
|
`Label( myInfo ),
|
||||||
`VSpacing(0.5)
|
`VSpacing(0.5)
|
||||||
),
|
),
|
||||||
`HSpacing(`opt(`hstretch), 1.0),
|
`HSpacing(`opt(`hstretch), 1.0),
|
||||||
@@ -1127,24 +1064,31 @@ define term displayRep(string type, integer curPage, string slastPage, list repo
|
|||||||
if (type == "onDemand" || type == "sir") {
|
if (type == "onDemand" || type == "sir") {
|
||||||
// Very poor i18n here
|
// Very poor i18n here
|
||||||
myLabel = _("On Demand Event Report - Page ") + currentPage + _(" of ") + slastPage;
|
myLabel = _("On Demand Event Report - Page ") + currentPage + _(" of ") + slastPage;
|
||||||
myTable = `Table(`id(`table), `opt(`keepSorting, `immediate ), `header(_("Host"), _("Date"), _("Program"), _("Profile"), _("PID"), _("Severity"), _("Mode"), _("Detail"), _("Access Type")), reportList);
|
myTable = makeSirTable(reportList);
|
||||||
|
|
||||||
} else if (type == "archRep") {
|
} else if (type == "archRep") {
|
||||||
|
|
||||||
myLabel = _("Archived Event Report - Page ") + currentPage + _(" of ") + slastPage;
|
myLabel = _("Archived Event Report - Page ") + currentPage + _(" of ") + slastPage;
|
||||||
myTable = `Table(`id(`table), `opt(`keepSorting, `immediate ), `header(_("Host"), _("Date"), _("Program"), _("Profile"), _("PID"), _("Severity"), _("Mode"), _("Detail"), _("Access Type")), reportList);
|
myTable = makeSirTable(reportList);
|
||||||
|
|
||||||
} else if (type == "aud" || type == "audRep" ) {
|
} else if (type == "aud" || type == "audRep" ) {
|
||||||
|
|
||||||
myLabel = _("Applications Audit Report");
|
myLabel = _("Applications Audit Report");
|
||||||
myTable = `Table(`id(`table), `opt(`notify, `immediate ), `header(_("Host"), _("Date"), _("Program"),
|
myTable = `Table(`id(`table), `opt(`notify, `immediate ),
|
||||||
_("Profile"), _("PID"), _("State"), _("Type") ), reportList);
|
`header(_("Host"), _("Date"), _("Program"),
|
||||||
|
_("Profile"), _("PID"), _("State"), _("Type") ), reportList);
|
||||||
|
|
||||||
} else if (type == "ess" || type == "essRep" ) {
|
} else if (type == "ess" || type == "essRep" ) {
|
||||||
if (reportList == nil) {
|
if (reportList == nil) {
|
||||||
myLabel = _("Executive Security Summary");
|
myLabel = _("Executive Security Summary");
|
||||||
myTable = `Table(`id(`table), `opt(`notify), `header(_("Query Results")), _("No event information exists."));
|
myTable = `Table(`id(`table), `opt(`notify),
|
||||||
|
`header(_("Query Results")), _("No event information exists."));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
myLabel = _("Executive Security Summary");
|
myLabel = _("Executive Security Summary");
|
||||||
myTable = `Table(`id(`table), `opt(`notify, `immediate ), `header(_("Host"), _("Start Date"),
|
myTable = `Table(`id(`table), `opt(`notify, `immediate ),
|
||||||
_("End Date"), _("Num Rejects"), _("Num Events"), _("Ave. Sev"), _("High Sev") ), reportList);
|
`header(_("Host"), _("Start Date"),_("End Date"), _("Num Rejects"),
|
||||||
|
_("Num Events"), _("Ave. Sev"), _("High Sev") ), reportList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1153,7 +1097,6 @@ define term displayRep(string type, integer curPage, string slastPage, list repo
|
|||||||
`Frame( `id(`newpage), myLabel,
|
`Frame( `id(`newpage), myLabel,
|
||||||
|
|
||||||
`VBox(
|
`VBox(
|
||||||
//`Label(myLabel),
|
|
||||||
`HBox(
|
`HBox(
|
||||||
`VSpacing(10),
|
`VSpacing(10),
|
||||||
myTable,
|
myTable,
|
||||||
@@ -1194,7 +1137,8 @@ define symbol displayArchForm() {
|
|||||||
list<term> itemList = [];
|
list<term> itemList = [];
|
||||||
itemList = getArrayList(type,"");
|
itemList = getArrayList(type,"");
|
||||||
|
|
||||||
Wizard::SetContentsButtons( _("AppArmor Security Event Report"), viewForm(archType, itemList, ""), archHelpText, _("Back"), _("&Done") );
|
Wizard::SetContentsButtons( _("AppArmor Security Event Report"),
|
||||||
|
viewForm(archType, itemList, ""), archHelpText, _("Back"), _("&Done") );
|
||||||
|
|
||||||
map event = $[];
|
map event = $[];
|
||||||
any archId = nil;
|
any archId = nil;
|
||||||
@@ -1208,7 +1152,6 @@ define symbol displayArchForm() {
|
|||||||
|
|
||||||
while( true ) {
|
while( true ) {
|
||||||
|
|
||||||
//event = UI::WaitForEvent( timeout_millisec );
|
|
||||||
event = UI::WaitForEvent( );
|
event = UI::WaitForEvent( );
|
||||||
|
|
||||||
archId = event["ID"]:nil; // We'll need this often - cache it
|
archId = event["ID"]:nil; // We'll need this often - cache it
|
||||||
@@ -1240,7 +1183,8 @@ define symbol displayArchForm() {
|
|||||||
Settings["repPath"] = repPath;
|
Settings["repPath"] = repPath;
|
||||||
itemList = getArrayList(type,repPath);
|
itemList = getArrayList(type,repPath);
|
||||||
Wizard::SetContentsButtons( _("AppArmor Security Event Report"),
|
Wizard::SetContentsButtons( _("AppArmor Security Event Report"),
|
||||||
viewForm(archType, itemList, repPath), archHelpText, _("Back"), _("&Done") );
|
viewForm(archType, itemList, repPath), archHelpText, _("Back"),
|
||||||
|
_("&Done") );
|
||||||
|
|
||||||
} else if ( archId == `sirRep ) {
|
} else if ( archId == `sirRep ) {
|
||||||
formHelp = sirHelp;
|
formHelp = sirHelp;
|
||||||
@@ -1252,7 +1196,8 @@ define symbol displayArchForm() {
|
|||||||
|
|
||||||
itemList = getArrayList(type,repPath);
|
itemList = getArrayList(type,repPath);
|
||||||
|
|
||||||
Wizard::SetContentsButtons( _("View Archived SIR Report"), viewForm(archType,itemList,""), formHelp, _("Back"), _("&Done") );
|
Wizard::SetContentsButtons( _("View Archived SIR Report"),
|
||||||
|
viewForm(archType,itemList,""), formHelp, _("Back"), _("&Done"));
|
||||||
|
|
||||||
} else if ( archId == `audRep ) {
|
} else if ( archId == `audRep ) {
|
||||||
formHelp = audHelp;
|
formHelp = audHelp;
|
||||||
@@ -1263,7 +1208,8 @@ define symbol displayArchForm() {
|
|||||||
type = Settings["type"]:nil;
|
type = Settings["type"]:nil;
|
||||||
|
|
||||||
itemList= getArrayList(type,"");
|
itemList= getArrayList(type,"");
|
||||||
Wizard::SetContentsButtons( _("View Archived AUD Report"), viewForm(archType,itemList,""), formHelp, _("Back"), _("&Done") );
|
Wizard::SetContentsButtons( _("View Archived AUD Report"),
|
||||||
|
viewForm(archType,itemList,""), formHelp, _("Back"), _("&Done"));
|
||||||
|
|
||||||
} else if ( archId == `essRep ) {
|
} else if ( archId == `essRep ) {
|
||||||
formHelp = essHelp;
|
formHelp = essHelp;
|
||||||
@@ -1274,7 +1220,8 @@ define symbol displayArchForm() {
|
|||||||
type = Settings["type"]:nil;
|
type = Settings["type"]:nil;
|
||||||
|
|
||||||
itemList= getArrayList(type,"");
|
itemList= getArrayList(type,"");
|
||||||
Wizard::SetContentsButtons( _("View Archived AUD Report"), viewForm(archType,itemList,""), formHelp, _("Back"), _("&Done") );
|
Wizard::SetContentsButtons( _("View Archived AUD Report"),
|
||||||
|
viewForm(archType,itemList,""), formHelp, _("Back"), _("&Done"));
|
||||||
|
|
||||||
|
|
||||||
} else if ( archId == `view || archId == `viewall || archId == `table) {
|
} else if ( archId == `view || archId == `viewall || archId == `table) {
|
||||||
@@ -1326,8 +1273,8 @@ define symbol displayArchForm() {
|
|||||||
sirSettings["repPath"] = repPath;
|
sirSettings["repPath"] = repPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Wizard::SetContentsButtons( _("Security Incident Report"), viewArchForm(type,logFile,lastPage,sirSettings), runHelp, _("Back"), _("&Done") );
|
Wizard::SetContentsButtons( _("Security Incident Report"),
|
||||||
Wizard::SetContentsButtons( _("Security Incident Report"), viewArchForm(type,logFile,sirSettings), sirHelp, _("Back"), _("&Done") );
|
viewArchForm(type,logFile,sirSettings), sirHelp, _("Back"), _("&Done"));
|
||||||
|
|
||||||
lastPage = getLastPage(type,Settings,""); // check 'name'
|
lastPage = getLastPage(type,Settings,""); // check 'name'
|
||||||
setPageButtons(curPage,lastPage);
|
setPageButtons(curPage,lastPage);
|
||||||
@@ -1345,15 +1292,18 @@ define symbol displayArchForm() {
|
|||||||
list <map> db = (list <map>) SCR::Read (.reports_confined, Settings);
|
list <map> db = (list <map>) SCR::Read (.reports_confined, Settings);
|
||||||
|
|
||||||
foreach ( map repdata, db, {
|
foreach ( map repdata, db, {
|
||||||
reportList = add( reportList, `item( `id(key), repdata["host"]:nil, repdata["date"]:nil, repdata["prog"]:nil,
|
reportList = add( reportList, `item( `id(key), repdata["host"]:nil,
|
||||||
repdata["prof"]:nil, repdata["pid"]:nil, repdata["state"]:nil, repdata["type"]:nil ));
|
repdata["date"]:nil, repdata["prog"]:nil, repdata["prof"]:nil,
|
||||||
|
repdata["pid"]:nil, repdata["state"]:nil, repdata["type"]:nil ));
|
||||||
key = key + 1;
|
key = key + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
lastPage = getLastPage(type,Settings,"");
|
lastPage = getLastPage(type,Settings,"");
|
||||||
string slastPage = tostring(lastPage);
|
string slastPage = tostring(lastPage);
|
||||||
|
|
||||||
Wizard::SetContentsButtons( _("Applications Audit Report"), displayRep(type,curPage,slastPage,reportList), formHelp, _("Back"), _("&Done") );
|
Wizard::SetContentsButtons( _("Applications Audit Report"),
|
||||||
|
displayRep(type,curPage,slastPage,reportList), formHelp, _("Back"),
|
||||||
|
_("&Done") );
|
||||||
setPageButtons(curPage,lastPage);
|
setPageButtons(curPage,lastPage);
|
||||||
|
|
||||||
} else if ( type == "essRep" ) {
|
} else if ( type == "essRep" ) {
|
||||||
@@ -1367,14 +1317,18 @@ define symbol displayArchForm() {
|
|||||||
list <map> db = (list <map>) SCR::Read (.reports_ess, Settings);
|
list <map> db = (list <map>) SCR::Read (.reports_ess, Settings);
|
||||||
|
|
||||||
foreach ( map repdata, db, {
|
foreach ( map repdata, db, {
|
||||||
reportList = add( reportList, `item( `id(key), repdata["host"]:nil, repdata["startdate"]:nil, repdata["enddate"]:nil, repdata["numRejects"]:nil, repdata["numEvents"]:nil, repdata["sevMean"]:nil, repdata["sevHi"]:nil ));
|
reportList = add( reportList, `item( `id(key), repdata["host"]:nil,
|
||||||
|
repdata["startdate"]:nil, repdata["enddate"]:nil, repdata["numRejects"]:nil,
|
||||||
|
repdata["numEvents"]:nil, repdata["sevMean"]:nil, repdata["sevHi"]:nil ));
|
||||||
key = key + 1;
|
key = key + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
lastPage = getLastPage(type,Settings,"");
|
lastPage = getLastPage(type,Settings,"");
|
||||||
string slastPage = tostring(lastPage);
|
string slastPage = tostring(lastPage);
|
||||||
|
|
||||||
Wizard::SetContentsButtons( _("Executive Security Summary Report"), displayRep(type,curPage,slastPage,reportList), formHelp, _("Back"), _("&Done") );
|
Wizard::SetContentsButtons( _("Executive Security Summary Report"),
|
||||||
|
displayRep(type,curPage,slastPage,reportList), formHelp, _("Back"),
|
||||||
|
_("&Done") );
|
||||||
setPageButtons(curPage,lastPage);
|
setPageButtons(curPage,lastPage);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1508,16 +1462,11 @@ define symbol displayRunForm() {
|
|||||||
Settings["type"] = "onDemand";
|
Settings["type"] = "onDemand";
|
||||||
Settings["turnPage"] = "0";
|
Settings["turnPage"] = "0";
|
||||||
|
|
||||||
list <map> db = (list <map>) SCR::Read (.logparse, Settings);
|
reportList = getReportList("sir",Settings);
|
||||||
|
integer listSize = size(reportList);
|
||||||
integer key = 1;
|
if ( listSize < 1 ) {
|
||||||
|
type = "noList";
|
||||||
foreach ( map repdata, db, {
|
}
|
||||||
reportList = add( reportList, `item( `id(key), repdata["host"]:nil, repdata["date"]:nil, repdata["prog"]:nil,
|
|
||||||
repdata["profile"]:nil, repdata["pid"]:nil, repdata["severity"]:nil, repdata["mode"]:nil, repdata["resource"]:nil,
|
|
||||||
repdata["sdmode"]:nil ));
|
|
||||||
key = key + 1;
|
|
||||||
});
|
|
||||||
|
|
||||||
} else if ( type == "aud" ) {
|
} else if ( type == "aud" ) {
|
||||||
|
|
||||||
@@ -1530,8 +1479,9 @@ define symbol displayRunForm() {
|
|||||||
integer key = 1;
|
integer key = 1;
|
||||||
|
|
||||||
foreach ( map repdata, db, {
|
foreach ( map repdata, db, {
|
||||||
reportList = add( reportList, `item( `id(key), repdata["host"]:nil, repdata["date"]:nil, repdata["prog"]:nil,
|
reportList = add( reportList, `item( `id(key), repdata["host"]:nil,
|
||||||
repdata["prof"]:nil, repdata["pid"]:nil, repdata["state"]:nil, repdata["type"]:nil ));
|
repdata["date"]:nil, repdata["prog"]:nil, repdata["prof"]:nil,
|
||||||
|
repdata["pid"]:nil, repdata["state"]:nil, repdata["type"]:nil ));
|
||||||
key = key + 1;
|
key = key + 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -1547,8 +1497,10 @@ define symbol displayRunForm() {
|
|||||||
integer key = 1;
|
integer key = 1;
|
||||||
|
|
||||||
foreach ( map repdata, db, {
|
foreach ( map repdata, db, {
|
||||||
reportList = add( reportList, `item( `id(key), repdata["host"]:nil, repdata["startdate"]:nil,
|
reportList = add( reportList, `item( `id(key), repdata["host"]:nil,
|
||||||
repdata["enddate"]:nil, repdata["numRejects"]:nil, repdata["numEvents"]:nil, repdata["sevMean"]:nil, repdata["sevHi"]:nil ));
|
repdata["startdate"]:nil, repdata["enddate"]:nil,
|
||||||
|
repdata["numRejects"]:nil, repdata["numEvents"]:nil, repdata["sevMean"]:nil,
|
||||||
|
repdata["sevHi"]:nil ));
|
||||||
key = key + 1;
|
key = key + 1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1556,15 +1508,19 @@ define symbol displayRunForm() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( type == "noDb" ) {
|
if ( type == "noDb" ) {
|
||||||
Wizard::SetContentsButtons( _("AppArmor On-Demand Report"), displayEmptyRep(), formHelp, _("Back"), _("&Done") );
|
Wizard::SetContentsButtons( _("AppArmor On-Demand Report"), displayEmptyRep(type),
|
||||||
|
formHelp, _("Back"), _("&Done") );
|
||||||
|
} else if ( type == "noList" ) {
|
||||||
|
Wizard::SetContentsButtons( _("AppArmor On-Demand Report"), displayEmptyRep(type),
|
||||||
|
formHelp, _("Back"), _("&Done") );
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
lastPage = getLastPage(type,Settings,name);
|
lastPage = getLastPage(type,Settings,name);
|
||||||
slastPage = tostring(lastPage);
|
slastPage = tostring(lastPage);
|
||||||
|
|
||||||
//UI::ReplaceWidget(`tabContents, displayRep(tab, curPage, reportList) );
|
Wizard::SetContentsButtons( _("AppArmor On-Demand Report"),
|
||||||
Wizard::SetContentsButtons( _("AppArmor On-Demand Report"), displayRep(type,curPage,slastPage,reportList),
|
displayRep(type,curPage,slastPage,reportList), formHelp,
|
||||||
formHelp, _("Back"), _("&Done") );
|
_("Back"), _("&Done") );
|
||||||
setPageButtons(curPage,lastPage);
|
setPageButtons(curPage,lastPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1616,7 +1572,6 @@ define symbol displayRunForm() {
|
|||||||
Settings["type"] = "onDemand";
|
Settings["type"] = "onDemand";
|
||||||
Settings["turnPage"] = "0";
|
Settings["turnPage"] = "0";
|
||||||
Settings["sortKey"] = sortKey;
|
Settings["sortKey"] = sortKey;
|
||||||
//map<any,any> sortCmd = $[]; sortCmd["sortKey"] = sortKey; sortCmd["sort"] = "1";
|
|
||||||
|
|
||||||
reportList = getReportList(type,Settings);
|
reportList = getReportList(type,Settings);
|
||||||
|
|
||||||
@@ -1646,7 +1601,8 @@ define symbol displayRunForm() {
|
|||||||
curPage = 1;
|
curPage = 1;
|
||||||
slastPage = tostring(lastPage);
|
slastPage = tostring(lastPage);
|
||||||
term firstForm = turnReportPage(name,curPage,slastPage,Settings);
|
term firstForm = turnReportPage(name,curPage,slastPage,Settings);
|
||||||
Wizard::SetContentsButtons( _("AppArmor - Run Reports"), firstForm, formHelp, _("Back"), _("&Done") );
|
Wizard::SetContentsButtons( _("AppArmor - Run Reports"), firstForm, formHelp,
|
||||||
|
_("Back"), _("&Done") );
|
||||||
setPageButtons(curPage,lastPage);
|
setPageButtons(curPage,lastPage);
|
||||||
|
|
||||||
} else if ( id == `last ) {
|
} else if ( id == `last ) {
|
||||||
@@ -1654,7 +1610,8 @@ define symbol displayRunForm() {
|
|||||||
curPage = lastPage;
|
curPage = lastPage;
|
||||||
slastPage = tostring(lastPage);
|
slastPage = tostring(lastPage);
|
||||||
term lastForm = turnReportPage(name,curPage,slastPage,Settings);
|
term lastForm = turnReportPage(name,curPage,slastPage,Settings);
|
||||||
Wizard::SetContentsButtons( _("AppArmor - Run Reports"), lastForm, formHelp, _("Back"), _("&Done") );
|
Wizard::SetContentsButtons( _("AppArmor - Run Reports"), lastForm, formHelp,
|
||||||
|
_("Back"), _("&Done") );
|
||||||
setPageButtons(curPage,lastPage);
|
setPageButtons(curPage,lastPage);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@@ -1685,23 +1642,7 @@ define void addSchedForm() {
|
|||||||
`VSpacing(1),
|
`VSpacing(1),
|
||||||
`TextEntry(`id(`name), _("Report Name")),
|
`TextEntry(`id(`name), _("Report Name")),
|
||||||
`VSpacing(1),
|
`VSpacing(1),
|
||||||
// DWR MOD
|
|
||||||
// `item(`id(`md_00)), _("All"),
|
|
||||||
//`item(`id(`md_01)), "1", `item(`id(`md_02)), "2", `item(`id(`md_03)), "3",
|
|
||||||
//`item(`id(`md_04)), "4", `item(`id(`md_05)), "5", `item(`id(`md_06)), "6",
|
|
||||||
//`item(`id(`md_07)), "7", `item(`id(`md_08)), "8", `item(`id(`md_09)), "9",
|
|
||||||
//`item(`id(`md_10)), "10", `item(`id(`md_11)), "11", `item(`id(`md_12)), "12",
|
|
||||||
//`item(`id(`md_13)), "13", `item(`id(`md_14)), "14", `item(`id(`md_15)), "15",
|
|
||||||
//`item(`id(`md_16)), "16", `item(`id(`md_17)), "17", `item(`id(`md_18)), "18",
|
|
||||||
//`item(`id(`md_19)), "19", `item(`id(`md_20)), "20", `item(`id(`md_21)), "21",
|
|
||||||
//`item(`id(`md_22)), "22", `item(`id(`md_23)), "23", `item(`id(`md_24)), "24",
|
|
||||||
//`item(`id(`md_25)), "25", `item(`id(`md_26)), "26", `item(`id(`md_27)), "27",
|
|
||||||
//`item(`id(`md_28)), "28", `item(`id(`md_29)), "29", `item(`id(`md_30)), "30",
|
|
||||||
//`item(`id(`md_31)), "31"
|
|
||||||
//
|
|
||||||
`HBox(
|
`HBox(
|
||||||
//`IntField(`id(`monthdate), `opt(`notify, `immediate), _("Day of Month"), 0, 31, 0),
|
|
||||||
// DWR MOD `ComboBox(`id(`monthdate), `opt(`notify, `immediate), _("Day of Month"), [
|
|
||||||
`ComboBox(`id(`monthdate), `opt(`notify), _("Day of Month"), [
|
`ComboBox(`id(`monthdate), `opt(`notify), _("Day of Month"), [
|
||||||
`item(`id(`md_00)), _("All"),
|
`item(`id(`md_00)), _("All"),
|
||||||
`item(`id(`md_01)), "1", `item(`id(`md_02)), "2", `item(`id(`md_03)), "3",
|
`item(`id(`md_01)), "1", `item(`id(`md_02)), "2", `item(`id(`md_03)), "3",
|
||||||
@@ -1715,21 +1656,6 @@ define void addSchedForm() {
|
|||||||
`item(`id(`md_25)), "25", `item(`id(`md_26)), "26", `item(`id(`md_27)), "27",
|
`item(`id(`md_25)), "25", `item(`id(`md_26)), "26", `item(`id(`md_27)), "27",
|
||||||
`item(`id(`md_28)), "28", `item(`id(`md_29)), "29", `item(`id(`md_30)), "30",
|
`item(`id(`md_28)), "28", `item(`id(`md_29)), "29", `item(`id(`md_30)), "30",
|
||||||
`item(`id(`md_31)), "31" ]),
|
`item(`id(`md_31)), "31" ]),
|
||||||
//`item(`id(`md_00), _("All")),
|
|
||||||
//`item(`id(`md_01), "1"), `item(`id(`md_02), "2"), `item(`id(`md_03), "3"),
|
|
||||||
//`item(`id(`md_04), "4"), `item(`id(`md_05), "5"), `item(`id(`md_06), "6"),
|
|
||||||
//`item(`id(`md_07), "7"), `item(`id(`md_08), "8"), `item(`id(`md_09), "9"),
|
|
||||||
//`item(`id(`md_10), "10"), `item(`id(`md_11), "11"), `item(`id(`md_12), "12"),
|
|
||||||
//`item(`id(`md_13), "13"), `item(`id(`md_14), "14"), `item(`id(`md_15), "15"),
|
|
||||||
//`item(`id(`md_16), "16"), `item(`id(`md_17), "17"), `item(`id(`md_18), "18"),
|
|
||||||
//`item(`id(`md_19), "19"), `item(`id(`md_20), "20"), `item(`id(`md_21), "21"),
|
|
||||||
//`item(`id(`md_22), "22"), `item(`id(`md_23), "23"), `item(`id(`md_24), "24"),
|
|
||||||
//`item(`id(`md_25), "25"), `item(`id(`md_26), "26"), `item(`id(`md_27), "27"),
|
|
||||||
//`item(`id(`md_28), "28"), `item(`id(`md_29), "29"), `item(`id(`md_30), "30"),
|
|
||||||
//`item(`id(`md_31), "31")
|
|
||||||
//]),
|
|
||||||
|
|
||||||
// DWR MOD `ComboBox(`id(`weekday), `opt(`notify, `immediate), _("Day of Week"), [
|
|
||||||
`ComboBox(`id(`weekday), `opt(`notify), _("Day of Week"), [
|
`ComboBox(`id(`weekday), `opt(`notify), _("Day of Week"), [
|
||||||
_("All"), _("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")
|
_("All"), _("Sun"), _("Mon"), _("Tue"), _("Wed"), _("Thu"), _("Fri"), _("Sat")
|
||||||
]),
|
]),
|
||||||
@@ -1746,16 +1672,11 @@ define void addSchedForm() {
|
|||||||
`VSpacing(1),
|
`VSpacing(1),
|
||||||
`HBox(
|
`HBox(
|
||||||
`VSpacing(0.5),
|
`VSpacing(0.5),
|
||||||
// DWR MOD `ComboBox(`id(`expType), `opt(`notify, `immediate), _("Export Type"), [
|
|
||||||
`ComboBox(`id(`expType), `opt(`notify), _("Export Type"), [
|
`ComboBox(`id(`expType), `opt(`notify), _("Export Type"), [
|
||||||
_("None"), _("csv"), _("html"), _("Both")
|
_("None"), _("csv"), _("html"), _("Both")
|
||||||
]),
|
]),
|
||||||
`TextEntry(`id(`expPath), _("Location to store log."), expPath ),
|
`TextEntry(`id(`expPath), _("Location to store log."), expPath ),
|
||||||
`Bottom( `VWeight( 1, `PushButton(`id(`browse), _("&Browse")) ))
|
`Bottom( `VWeight( 1, `PushButton(`id(`browse), _("&Browse")) ))
|
||||||
/*
|
|
||||||
`CheckBox(`id(`csv), _("Send reports in CSV Format"), true),
|
|
||||||
`CheckBox(`id(`html), _("Send reports in HTML Format"))
|
|
||||||
*/
|
|
||||||
),
|
),
|
||||||
`VSpacing(1),
|
`VSpacing(1),
|
||||||
`HBox(
|
`HBox(
|
||||||
@@ -1769,7 +1690,6 @@ define void addSchedForm() {
|
|||||||
integer timeout_millisec = 20 * 1000;
|
integer timeout_millisec = 20 * 1000;
|
||||||
map event = $[];
|
map event = $[];
|
||||||
any addInput = nil;
|
any addInput = nil;
|
||||||
//map<string,string> Settings = $[ ];
|
|
||||||
|
|
||||||
while( true ) {
|
while( true ) {
|
||||||
|
|
||||||
@@ -1852,13 +1772,12 @@ define void addSchedForm() {
|
|||||||
integer nameLength = size(name);
|
integer nameLength = size(name);
|
||||||
|
|
||||||
if ( regexpmatch(name, " ") == true ) {
|
if ( regexpmatch(name, " ") == true ) {
|
||||||
Popup::Error( _("Only one contiguous space allowed in report names.") );
|
Popup::Error( _("Only one contiguous space allowed in report names."));
|
||||||
} else if ( checkName != "" ) {
|
} else if ( checkName != "" ) {
|
||||||
Popup::Error( _("These characters are not allowed in report names: \"`~!@#$%^&*()[{]};:'\",<>?/\|\"") );
|
Popup::Error( _("These characters are not allowed in report names:
|
||||||
|
\"`~!@#$%^&*()[{]};:'\",<>?/\|\"") );
|
||||||
} else if ( nameLength > 128 ) {
|
} else if ( nameLength > 128 ) {
|
||||||
Popup::Error( _("Only 128 characters are allowed in report names.") );
|
Popup::Error( _("Only 128 characters are allowed in report names."));
|
||||||
//} else if ( name == nil || name == "") {
|
|
||||||
// Popup::Error( _("You must enter a name for the report.") );
|
|
||||||
} else {
|
} else {
|
||||||
boolean uniqueName = findDupe(name);
|
boolean uniqueName = findDupe(name);
|
||||||
if ( uniqueName == true ) {
|
if ( uniqueName == true ) {
|
||||||
@@ -1874,7 +1793,6 @@ define void addSchedForm() {
|
|||||||
|
|
||||||
if (sdmode != "") {
|
if (sdmode != "") {
|
||||||
Settings["sdmode"] = sdmode;
|
Settings["sdmode"] = sdmode;
|
||||||
//UI::ReplaceWidget(`id(`replace_sdmode), `PushButton(`id(`sdmode), _("Access Type: ") + sdmode) );
|
|
||||||
UI::ReplaceWidget(`id(`replace_sdmode), `PushButton(`id(`sdmode), sdmode) );
|
UI::ReplaceWidget(`id(`replace_sdmode), `PushButton(`id(`sdmode), sdmode) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1884,7 +1802,6 @@ define void addSchedForm() {
|
|||||||
|
|
||||||
if (mode != "") {
|
if (mode != "") {
|
||||||
Settings["mode"] = mode;
|
Settings["mode"] = mode;
|
||||||
//UI::ReplaceWidget(`id(`replace_mode), `PushButton(`id(`mode), _("Mode: ") + mode) );
|
|
||||||
UI::ReplaceWidget(`id(`replace_mode), `PushButton(`id(`mode), mode) );
|
UI::ReplaceWidget(`id(`replace_mode), `PushButton(`id(`mode), mode) );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1966,7 +1883,6 @@ define void addSchedForm() {
|
|||||||
|
|
||||||
UI::CloseDialog();
|
UI::CloseDialog();
|
||||||
|
|
||||||
//return (symbol) id;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2406,7 +2322,8 @@ define void updateSched() {
|
|||||||
`VSpacing(2),
|
`VSpacing(2),
|
||||||
`HBox(
|
`HBox(
|
||||||
`VSpacing(10),
|
`VSpacing(10),
|
||||||
`Table(`id(`table), `opt(`notify), `header(_("Report Name"), _("Day of Month"), _("Day of Week"), _("Hour"), _("Mins") ), itemList)
|
`Table(`id(`table), `opt(`notify), `header(_("Report Name"),
|
||||||
|
_("Day of Month"), _("Day of Week"), _("Hour"), _("Mins")), itemList)
|
||||||
),
|
),
|
||||||
`VSpacing(0.5),
|
`VSpacing(0.5),
|
||||||
`HBox(
|
`HBox(
|
||||||
@@ -2420,7 +2337,8 @@ define void updateSched() {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
Wizard::SetContentsButtons( _("AppArmor Security Event Report"), schedForm, mainHelp, _("Back"), _("&Next") );
|
Wizard::SetContentsButtons( _("AppArmor Security Event Report"), schedForm,
|
||||||
|
mainHelp, _("Back"), _("&Next") );
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@@ -88,6 +88,38 @@ define integer getLastPage(string type, map Settings, string name) {
|
|||||||
return lastPage;
|
return lastPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
define boolean CheckDate( integer day, integer month, integer year ) ``{
|
||||||
|
|
||||||
|
list mdays = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];
|
||||||
|
boolean ret = true;
|
||||||
|
|
||||||
|
if (year == nil || month == nil || day == nil)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
ret = ret && month>=1 && month<=12;
|
||||||
|
|
||||||
|
if( year%4==0 && (year%100!=0 || year%400==0)) {
|
||||||
|
mdays[1] = 29;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = ret && day>=1 && day<=mdays[month-1]:0;
|
||||||
|
ret = ret && year>=1970 && year<2032;
|
||||||
|
return( ret );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make the table for displaying report data
|
||||||
|
define term makeSirTable (list reportList) {
|
||||||
|
term myTable =
|
||||||
|
`Table(`id(`table), `opt(`keepSorting, `immediate ), `header(_("Host"),
|
||||||
|
_("Date"), _("Program"), _("Profile"), _("PID"), _("Severity"),
|
||||||
|
_("Mode Request"), _("Mode Deny"), _("Detail"), _("Event Type"),
|
||||||
|
_("Operation"), _("Attribute"), _("Additional Name"), _("Net Family"),
|
||||||
|
_("Net Protocol"), _("Net Socket Type")), reportList
|
||||||
|
);
|
||||||
|
return myTable;
|
||||||
|
}
|
||||||
|
|
||||||
define integer popUpGoto(integer lastPage) {
|
define integer popUpGoto(integer lastPage) {
|
||||||
|
|
||||||
UI::OpenDialog(
|
UI::OpenDialog(
|
||||||
@@ -520,4 +552,57 @@ define string popUpSdMode() {
|
|||||||
return sdMode;
|
return sdMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* For On Demand Reports
|
||||||
|
- Returns list of terms corresponding to the type of report
|
||||||
|
***********************************************************************/
|
||||||
|
define list<term> getReportList(string type, map Settings) {
|
||||||
|
|
||||||
|
list<term> reportList = [];
|
||||||
|
|
||||||
|
if ( type == "aud" ) {
|
||||||
|
|
||||||
|
list <map> db = (list <map>) SCR::Read (.reports_confined, Settings);
|
||||||
|
integer key = 1;
|
||||||
|
|
||||||
|
foreach ( map repdata, db, {
|
||||||
|
reportList = add( reportList, `item( `id(key), repdata["host"]:nil, repdata["date"]:nil,
|
||||||
|
repdata["prog"]:nil, repdata["prof"]:nil, repdata["pid"]:nil, repdata["state"]:nil,
|
||||||
|
repdata["type"]:nil ));
|
||||||
|
key = key + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
} else if ( type == "ess" ) {
|
||||||
|
|
||||||
|
list <map> db = (list <map>) SCR::Read (.reports_ess, Settings);
|
||||||
|
integer key = 1;
|
||||||
|
|
||||||
|
foreach ( map repdata, db, {
|
||||||
|
reportList = add( reportList, `item( `id(key), repdata["host"]:nil,
|
||||||
|
repdata["startdate"]:nil, repdata["enddate"]:nil, repdata["numRejects"]:nil,
|
||||||
|
repdata["numEvents"]:nil, repdata["sevMean"]:nil, repdata["sevHi"]:nil ));
|
||||||
|
key = key + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
list <map> db = (list <map>) SCR::Read (.logparse, Settings);
|
||||||
|
integer key = 0;
|
||||||
|
|
||||||
|
foreach ( map record, db, {
|
||||||
|
reportList = add( reportList, `item( `id(key),
|
||||||
|
record["host"]:nil, record["date"]:nil, record["prog"]:nil,
|
||||||
|
record["profile"]:nil, record["pid"]:nil, record["severity"]:nil,
|
||||||
|
record["mode_req"]:nil, record["mode_deny"]:nil,
|
||||||
|
record["resource"]:nil, record["sdmode"]:nil, record["op"]:nil,
|
||||||
|
record["attr"]:nil, record["name_alt"]:nil, record["net_family"]:nil,
|
||||||
|
record["net_proto"]:nil, record["net_socktype"]:nil
|
||||||
|
));
|
||||||
|
key = key + 1;
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return reportList;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user