2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2025-09-10 20:28:44 +00:00

Change to redact rather than omit arguments

This commit is contained in:
Jarrod Johnson
2018-04-17 20:52:52 -04:00
parent 42f6e9f74a
commit 3c927fba0f
2 changed files with 19 additions and 13 deletions

View File

@@ -251,8 +251,10 @@ sub validate {
$restcommand =~ s/^\S+\s*//;
$saveArglist = "$first$restcommand";
}
}
#if ($arglist) { $logst .= $saveArglist; }
} elsif ($arglist =~ /password/i) {
$saveArglist =~ s/password.*/*REDACTED*/;
}
if ($arglist) { $logst .= $saveArglist; }
if ($peername) { $logst .= " for " . $request->{username}->[0] }
if ($peerhost) { $logst .= " from " . $peerhost }

View File

@@ -2752,17 +2752,21 @@ sub service_connection {
$cmdlog_alllog .= "$tmpstr ";
}
#if (exists($req->{arg})) {
# foreach my $arg (@{ $req->{arg} }) {
# if ($arg =~ /[^A-Za-z0-9.-]/) {
# my $tmparg = $arg;
# $tmparg =~ s/'/'\\''/g;
# $cmdlog_alllog .= "'" . $tmparg . "' ";
# } else {
# $cmdlog_alllog .= $arg . " ";
# }
# }
#}
if (exists($req->{arg})) {
foreach my $arg (@{ $req->{arg} }) {
if ($arg =~ /password/i) {
$cmdlog_alllog .= "'*REDACTED*' ";
last;
}
if ($arg =~ /[^A-Za-z0-9.-]/) {
my $tmparg = $arg;
$tmparg =~ s/'/'\\''/g;
$cmdlog_alllog .= "'" . $tmparg . "' ";
} else {
$cmdlog_alllog .= $arg . " ";
}
}
}
$cmdlog_alllog .= "\n[Response]\n";
# ----used for command log end----------