From f73f8ae5c960fabd612ef1384fefb4b1727627cc Mon Sep 17 00:00:00 2001 From: dataking Date: Fri, 29 Jul 2016 15:56:30 -0700 Subject: [PATCH] Added more data to HTML report. --- lynis_report.pl | 224 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 201 insertions(+), 23 deletions(-) diff --git a/lynis_report.pl b/lynis_report.pl index 04525eb..0b92e15 100755 --- a/lynis_report.pl +++ b/lynis_report.pl @@ -92,7 +92,9 @@ while (my $line = ) { } close RPT or die colored("There was a problem closing the lynis report: $! \n", "bold red"); -@{$lynis_report_data{'automation_tool_running[]'}} = &dedup_array(@{$lynis_report_data{'automation_tool_running[]'}}) if (ref($lynis_report_data{'automation_tool_running[]'}) eq 'ARRAY'); +@{$lynis_report_data{'automation_tool_running[]'}} = &dedup_array($lynis_report_data{'automation_tool_running[]'}) if (ref($lynis_report_data{'automation_tool_running[]'}) eq 'ARRAY'); +@{$lynis_report_data{'boot_service[]'}} = &dedup_array($lynis_report_data{'boot_service[]'}) if (ref($lynis_report_data{'boot_service[]'}) eq "ARRAY"); +@{$lynis_report_data{'cronjob[]'}} = &dedup_array($lynis_report_data{'cronjob[]'}) if (ref($lynis_report_data{'cronjob[]'}) eq 'ARRAY'); my $pass_score = &calc_password_complexity_score; @@ -108,7 +110,7 @@ my (%warnings, %suggestions); # process "string array" values delimited by a pipe (|) foreach my $key ( sort keys %lynis_report_data ) { - print "$key, ".ref($lynis_report_data{$key})." \n" if (($verbose) and ($verbose >= 1)); + print "$key, ".ref($lynis_report_data{$key})." \n" if (($verbose) and ($verbose > 1)); if (((ref($lynis_report_data{$key}) ne 'ARRAY') and (ref($lynis_report_data{$key}) ne 'HASH')) and ($lynis_report_data{$key} =~ /\|/)) { @@ -178,10 +180,11 @@ if ($excel) { html,body {color: #fff; background-color: #000;} div#content_section {margin: 0 10% 0 10%;} div.content_subsection {margin: 0 5% 0 5%;} - div.collapsable {display: none;} - table {border-collapse: collapse; border: 1px solid white;} + div.collapsable {display:none;} + table {border-collapse:collapse;border:1px solid white;} + table.list {border:0px;} table#lynis_plugins_table {width:100%;} - td {padding:2px 5px 2px 5px;} + td {padding:2px 5px 2px 5px;vertical-align:top;} td.good {background-color: #006400; color: #fff; font-weight: bold;} td.fair {background-color: #ffd700; color: #000; font-weight: bold;} td.poor {background-color: #ffa500; color: #000; font-weight: bold;} @@ -342,6 +345,10 @@ END report version:$lynis_report_data{'report_version_major'}.$lynis_report_data{'report_version_minor'} + + test category:$lynis_report_data{'test_category'} + test group:$lynis_report_data{'test_group'} + number of plugins enabled:$lynis_report_data{'plugins_enabled'} plugin directory:$lynis_report_data{'plugin_directory'} @@ -404,7 +411,7 @@ END uptime (days):$lynis_report_data{'uptime_in_days'} - vm:$lynis_report_data{'vm'} + vm:$to_bool{$lynis_report_data{'vm'}} END if ((defined($lynis_report_data{'vmtype'})) and ($lynis_report_data{'vmtype'} ne "")) { print OUT "\t\t\t\t\t\tvm_type:$lynis_report_data{'vmtype'}\n"; @@ -414,7 +421,45 @@ END print OUT <uptime (secs):$lynis_report_data{'uptime_in_seconds'} + + binary paths:$lynis_report_data{'binary_paths'} +END + print OUT "\t\t\t\t\t\tcertificates:".join("
\n",$lynis_report_data{'valid_certificate[]'})."\n"; + print OUT < + +

cron jobs:

+END + if (ref($lynis_report_data{'cronjob[]'}) eq "ARRAY") { + print OUT "\t\t\t\t\t
    \n"; + foreach my $c ( @{$lynis_report_data{'cronjob[]'}} ) { print OUT "\t\t\t\t\t\t
  • $c
  • \n"; } + print OUT "\t\t\t\t\t
\n"; + } + print OUT <logging info: + + + + + +
log rotation tool:$lynis_report_data{'log_rotation_tool'}log rotation config found:$to_bool{$lynis_report_data{'log_rotation_config_found'}}
+
+

log directories:

+END + if (ref($lynis_report_data{'log_directory[]'}) eq 'ARRAY') { + print OUT "\t\t\t\t\t
    \n"; + foreach my $ld ( @{$lynis_report_data{'log_directory[]'}} ) { print OUT "\t\t\t\t\t\t
  • $ld
  • \n"; } + print OUT "\t\t\t\t\t
\n"; + } + print OUT "\t\t\t\t\t

open log files:

\n"; + if (ref($lynis_report_data{'open_logfile[]'}) eq 'ARRAY') { + print OUT "\t\t\t\t\t
    \n"; + foreach my $lf ( @{$lynis_report_data{'open_logfile[]'}} ) { print OUT "\t\t\t\t\t\t
  • $lf
  • \n"; } + print OUT "\t\t\t\t\t
\n"; + } + print OUT <

network info:

@@ -452,12 +497,10 @@ END foreach my $obj ( sort @{$lynis_report_data{'network_listen_port[]'}} ) { my ($ipp,$proto,$daemon,$dunno) = split(/\|/, $obj); my ($ip,$port); - my $colon_count = grep(/\:/, split(//, $ipp)); - if ($colon_count > 1) { + if (grep(/\:/, split(//, $ipp)) > 1) { # must be an IPv6 address; - my @parts = split(/\:/, $ipp); - $port = pop(@parts); - $ip = join(":", @parts); + $port = substr($ipp, 0, index($ipp,":")); + $ip = substr($ipp,(index($ipp,":")+1)); } else { # must be IPv4 ($ip,$port) = split(/\:/, $ipp); @@ -526,13 +569,28 @@ END print OUT "\t\t\t\t\t\tIDS/IPS Tooling \n"; } print OUT < + compiler installed:$to_bool{$lynis_report_data{'compiler_installed'}} + + + +

real users:

home directories:

+ + +END + foreach my $u ( @{$lynis_report_data{'real_user[]'}} ) { + my ($name,$uid) = split(/,/, $u); + print OUT "\t\t\t\t\t\t\t\n"; + } + print OUT "\t\t\t\t\t\t
nameuid
$name$uid
    \n"; + foreach my $d ( @{$lynis_report_data{'home_directory[]'}} ) { print OUT "\t\t\t\t\t\t\t
  • $d
  • \n"; } + print OUT <

PAM Modules:

> show <