Skip to content

Commit 5bae182

Browse files
fix that log sensitive infomation in cmd of script
1 parent e90e436 commit 5bae182

File tree

4 files changed

+213
-39
lines changed

4 files changed

+213
-39
lines changed

plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/wrapper/LibvirtUpdateHostPasswordCommandWrapper.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public Answer execute(final UpdateHostPasswordCommand command, final LibvirtComp
3737
final String newPassword = command.getNewPassword();
3838

3939
final Script script = libvirtUtilitiesHelper.buildScript(libvirtComputingResource.getUpdateHostPasswdPath());
40-
script.add(username, newPassword);
40+
script.add(username);
41+
script.addSensitive(newPassword);
4142
final String result = script.execute();
4243

4344
if (result != null) {

plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixUpdateHostPasswordCommandWrapper.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,10 @@ public Answer execute(final UpdateHostPasswordCommand command, final CitrixResou
4545

4646
Pair<Boolean, String> result;
4747
try {
48-
logger.debug("Executing command in Host: " + cmdLine);
48+
logger.debug("Executing command in Host: " + xenServerUtilitiesHelper.buildCommandLine(SCRIPT_CMD_PATH,
49+
VRScripts.UPDATE_HOST_PASSWD, username, "******"));
4950
final String hostPassword = citrixResourceBase.getPwdFromQueue();
50-
result = xenServerUtilitiesHelper.executeSshWrapper(hostIp, 22, username, null, hostPassword, cmdLine.toString());
51+
result = xenServerUtilitiesHelper.executeSshWrapper(hostIp, 22, username, null, hostPassword, cmdLine);
5152
} catch (final Exception e) {
5253
return new Answer(command, false, e.getMessage());
5354
}

0 commit comments

Comments
 (0)