mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-6326: fixed password visible in plain text in some of commands in Hyper-v Agent logs
This commit is contained in:
parent
e6e4fe4d26
commit
f40e8a835c
|
|
@ -173,7 +173,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.SetupCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.SetupCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
string details = null;
|
||||
bool result = false;
|
||||
|
|
@ -323,7 +323,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.RebootCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.RebootCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
string details = null;
|
||||
bool result = false;
|
||||
|
|
@ -367,7 +367,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.DestroyCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.DestroyCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
string details = null;
|
||||
bool result = false;
|
||||
|
|
@ -375,7 +375,7 @@ namespace HypervResource
|
|||
try
|
||||
{
|
||||
// Assert
|
||||
String errMsg = "No 'volume' details in " + CloudStackTypes.DestroyCommand + " " + cmd.ToString();
|
||||
String errMsg = "No 'volume' details in " + CloudStackTypes.DestroyCommand + " " + Utils.CleanString(cmd.ToString());
|
||||
if (cmd.volume == null)
|
||||
{
|
||||
logger.Error(errMsg);
|
||||
|
|
@ -430,7 +430,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.DestroyCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.DestroyCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
string details = null;
|
||||
bool result = false;
|
||||
|
|
@ -438,7 +438,7 @@ namespace HypervResource
|
|||
try
|
||||
{
|
||||
// Assert
|
||||
String errMsg = "No 'volume' details in " + CloudStackTypes.DestroyCommand + " " + cmd.ToString();
|
||||
String errMsg = "No 'volume' details in " + CloudStackTypes.DestroyCommand + " " + Utils.CleanString(cmd.ToString());
|
||||
VolumeObjectTO destVolumeObjectTO = VolumeObjectTO.ParseJson(cmd.data);
|
||||
|
||||
if (destVolumeObjectTO.name == null)
|
||||
|
|
@ -756,7 +756,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.CheckHealthCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.CheckHealthCommand + Utils.CleanString(cmd.ToString()));
|
||||
object ansContent = new
|
||||
{
|
||||
result = true,
|
||||
|
|
@ -774,7 +774,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.CheckOnHostCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.CheckOnHostCommand + Utils.CleanString(cmd.ToString()));
|
||||
object ansContent = new
|
||||
{
|
||||
result = true,
|
||||
|
|
@ -793,7 +793,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.CheckSshCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.CheckSshCommand + Utils.CleanString(cmd.ToString()));
|
||||
object ansContent = new
|
||||
{
|
||||
result = true,
|
||||
|
|
@ -811,7 +811,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.CheckVirtualMachineCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.CheckVirtualMachineCommand + Utils.CleanString(cmd.ToString()));
|
||||
string details = null;
|
||||
bool result = false;
|
||||
string vmName = cmd.vmName;
|
||||
|
|
@ -848,7 +848,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.DeleteStoragePoolCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.DeleteStoragePoolCommand + Utils.CleanString(cmd.ToString()));
|
||||
object ansContent = new
|
||||
{
|
||||
result = true,
|
||||
|
|
@ -991,7 +991,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.PlugNicCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.PlugNicCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
object ansContent = new
|
||||
{
|
||||
|
|
@ -1011,7 +1011,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.CleanupNetworkRulesCmd + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.CleanupNetworkRulesCmd + Utils.CleanString(cmd.ToString()));
|
||||
object ansContent = new
|
||||
{
|
||||
result = false,
|
||||
|
|
@ -1029,7 +1029,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.CheckNetworkCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.CheckNetworkCommand + Utils.CleanString(cmd.ToString()));
|
||||
object ansContent = new
|
||||
{
|
||||
result = true,
|
||||
|
|
@ -1047,7 +1047,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.ReadyCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.ReadyCommand + Utils.CleanString(cmd.ToString()));
|
||||
object ansContent = new
|
||||
{
|
||||
result = true,
|
||||
|
|
@ -1132,7 +1132,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.StopCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.StopCommand + Utils.CleanString(cmd.ToString()));
|
||||
string details = null;
|
||||
bool result = false;
|
||||
|
||||
|
|
@ -1228,7 +1228,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.MaintainCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.MaintainCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
object ansContent = new
|
||||
{
|
||||
|
|
@ -1251,7 +1251,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.PingRoutingCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.PingRoutingCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
object ansContent = new
|
||||
{
|
||||
|
|
@ -1273,7 +1273,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.PingCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.PingCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
object ansContent = new
|
||||
{
|
||||
|
|
@ -1295,7 +1295,7 @@ namespace HypervResource
|
|||
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.ModifyVmNicConfigCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.ModifyVmNicConfigCommand + Utils.CleanString(cmd.ToString()));
|
||||
bool result = false;
|
||||
String vmName = cmd.vmName;
|
||||
uint vlan = (uint)cmd.vlan;
|
||||
|
|
@ -1329,7 +1329,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.GetVmConfigCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.GetVmConfigCommand + Utils.CleanString(cmd.ToString()));
|
||||
bool result = false;
|
||||
String vmName = cmd.vmName;
|
||||
ComputerSystem vm = wmiCallsV2.GetComputerSystem(vmName);
|
||||
|
|
@ -1383,7 +1383,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.GetVmStatsCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.GetVmStatsCommand + Utils.CleanString(cmd.ToString()));
|
||||
bool result = false;
|
||||
JArray vmNamesJson = cmd.vmNames;
|
||||
string[] vmNames = vmNamesJson.ToObject<string[]>();
|
||||
|
|
@ -1894,7 +1894,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.GetHostStatsCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.GetHostStatsCommand + Utils.CleanString(cmd.ToString()));
|
||||
bool result = false;
|
||||
string details = null;
|
||||
object hostStats = null;
|
||||
|
|
@ -1956,7 +1956,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.PrepareForMigrationCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.PrepareForMigrationCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
string details = null;
|
||||
bool result = true;
|
||||
|
|
@ -1990,7 +1990,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.MigrateCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.MigrateCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
string details = null;
|
||||
bool result = false;
|
||||
|
|
@ -2026,7 +2026,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.MigrateVolumeCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.MigrateVolumeCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
string details = null;
|
||||
bool result = false;
|
||||
|
|
@ -2063,7 +2063,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.MigrateWithStorageCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.MigrateWithStorageCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
string details = null;
|
||||
bool result = false;
|
||||
|
|
@ -2249,7 +2249,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.GetVncPortCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.GetVncPortCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
string details = null;
|
||||
bool result = false;
|
||||
|
|
@ -2288,7 +2288,7 @@ namespace HypervResource
|
|||
{
|
||||
using (log4net.NDC.Push(Guid.NewGuid().ToString()))
|
||||
{
|
||||
logger.Info(CloudStackTypes.HostVmStateReportCommand + cmd.ToString());
|
||||
logger.Info(CloudStackTypes.HostVmStateReportCommand + Utils.CleanString(cmd.ToString()));
|
||||
|
||||
string details = null;
|
||||
Dictionary<string, string>[] hostVmStateReport = null;
|
||||
|
|
|
|||
|
|
@ -167,8 +167,8 @@ namespace HypervResource
|
|||
public static string CleanString(string stringToClean)
|
||||
{
|
||||
string cleanString = null;
|
||||
string regexQueryString = "(&|%26)?(password|accesskey|secretkey)(=|%3D).*?(?=(%26|[&'\"]))";
|
||||
string regexJson = "\"(password|accesskey|secretkey)\":\".*?\",?";
|
||||
string regexQueryString = "(&|%26)?(password|accesskey|secretkey|Password)(=|%3D).*?(?=(%26|[&'\"]))";
|
||||
string regexJson = "\"(password|accesskey|secretkey|Password)\":\\s?\".*?\",?";
|
||||
cleanString = System.Text.RegularExpressions.Regex.Replace(stringToClean, regexQueryString, "");
|
||||
cleanString = System.Text.RegularExpressions.Regex.Replace(cleanString, regexJson, "");
|
||||
return cleanString;
|
||||
|
|
|
|||
Loading…
Reference in New Issue