diff --git a/lynis_report.pl b/lynis_report.pl index 1e61f1c..9b69e33 100755 --- a/lynis_report.pl +++ b/lynis_report.pl @@ -52,9 +52,12 @@ print "format. \n"; # but it is not our job to draw conclusions here, just present the findings of the tool. open RPT, "<$lynis_report" or die colored("There was a problem opening the lynis report: $! \n", "bold red"); while (my $line = ) { - next if ($line =~ /^#/); # skip commented lines + next if ($line =~ /^#/); # skip commented lines + next if ($line =~ /Result.*allow\_url\_fopen.*/); # This looks like a bug in the report output. Skip it. chomp($line); my ($k, $v) = split(/=/, $line); + if ((!defined($k)) or ($k eq "")) { next; } # something went wonky -- we didn't get a valid key. so skip + if ((!defined($v)) or ($v eq "")) { $v = " "; } # fill with a blank(ish) value if nothing print "k=$k\n" if (($verbose) and ($verbose > 1)); print "v=$v\n" if (($verbose) and ($verbose > 1)); # if the key already exists, assume it's supposed to be an array value. Array values are handled a couple @@ -238,7 +241,10 @@ if ((ref($lynis_report_data{'suggestion[]'}) eq 'ARRAY') and if ($sug_desc eq 'Consider hardening SSH configuration') { $sug_desc .= ": $sug_sev"; $sug_sev = '-'; } - print OUT "\t\t\t\t\t$sug_id$sug_desc$sug_sev$sug_f4\n"; + print OUT "\t\t\t\t\t$sug_id"; + print OUT "$sug_desc"; + print OUT "".($sug_sev ? $sug_sev : " ").""; + print OUT "".($sug_f4 ? $sug_f4 : " ")."\n"; } } print OUT <network info:
- - - @@ -363,6 +366,7 @@ END print OUT "\t\t\t\t\t\n"; print OUT "\t\t\t\t\t\n"; print OUT "\t\t\t\t\t\n"; +print OUT "\t\t\t\t\t\n"; print OUT < END @@ -582,7 +586,7 @@ if (($arrlen % 4) == 0) { } elsif (($arrlen % 2) == 0) { print "ARRLEN divisible by 2. \n"; } else { - die "ARRLEN appears to be number with a divisor larger than 5 or 1 ($arrlen) \n"; + die "ARRLEN appears to be number with a divisor larger than 4 or 1 ($arrlen) \n"; } print OUT <
Default Gateway$lynis_report_data{'default_gateway[]'}
IPv6 Mode:$lynis_report_data{'ipv6_mode'} IPv6 Only:$to_bool{$lynis_report_data{'ipv6_only'}}
network interfaces:".join("
\n", @{$lynis_report_data{'network_interface[]'}})."
ipv4 addresses:".join("
\n", @{$lynis_report_data{'network_ipv4_address[]'}})."
ipv6 addresses:".join("
\n", @{$lynis_report_data{'network_ipv6_address[]'}})."
Default Gateway$lynis_report_data{'default_gateway[]'}