-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Mask vncPasswd being logged in agent.log #12404
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sudo87
wants to merge
1
commit into
apache:4.20
Choose a base branch
from
shapeblue:maskVncPwd
base: 4.20
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+42
−10
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,7 +158,7 @@ Use VIR_DOMAIN_XML_SECURE (value = 1) prior to v1.0.0. | |
| final String target = command.getDestinationIp(); | ||
| xmlDesc = dm.getXMLDesc(xmlFlag); | ||
| if (logger.isDebugEnabled()) { | ||
| logger.debug(String.format("VM [%s] with XML configuration [%s] will be migrated to host [%s].", vmName, xmlDesc, target)); | ||
| logger.debug("VM {} with XML configuration {} will be migrated to host {}.", vmName, maskSensitiveInfoInXML(xmlDesc), target); | ||
| } | ||
|
|
||
| // Limit the VNC password in case the length is greater than 8 characters | ||
|
|
@@ -173,7 +173,7 @@ Use VIR_DOMAIN_XML_SECURE (value = 1) prior to v1.0.0. | |
| logger.debug(String.format("Editing mount path of ISO from %s to %s", oldIsoVolumePath, newIsoVolumePath)); | ||
| xmlDesc = replaceDiskSourceFile(xmlDesc, newIsoVolumePath, vmName); | ||
| if (logger.isDebugEnabled()) { | ||
| logger.debug(String.format("Replaced disk mount point [%s] with [%s] in Instance [%s] XML configuration. New XML configuration is [%s].", oldIsoVolumePath, newIsoVolumePath, vmName, xmlDesc)); | ||
| logger.debug("Replaced disk mount point {} with {} in Instance {} XML configuration. New XML configuration is {}.", oldIsoVolumePath, newIsoVolumePath, vmName, maskSensitiveInfoInXML(xmlDesc)); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -204,23 +204,23 @@ Use VIR_DOMAIN_XML_SECURE (value = 1) prior to v1.0.0. | |
|
|
||
| if (migrateStorage) { | ||
| if (logger.isDebugEnabled()) { | ||
| logger.debug(String.format("Changing VM [%s] volumes during migration to host: [%s].", vmName, target)); | ||
| logger.debug("Changing VM {} volumes during migration to host: {}.", vmName, target); | ||
| } | ||
| xmlDesc = replaceStorage(xmlDesc, mapMigrateStorage, migrateStorageManaged); | ||
| if (logger.isDebugEnabled()) { | ||
| logger.debug(String.format("Changed VM [%s] XML configuration of used storage. New XML configuration is [%s].", vmName, xmlDesc)); | ||
| logger.debug("Changed VM {} XML configuration of used storage. New XML configuration is {}.", vmName, maskSensitiveInfoInXML(xmlDesc)); | ||
| } | ||
| migrateDiskLabels = getMigrateStorageDeviceLabels(disks, mapMigrateStorage); | ||
| } | ||
|
|
||
| Map<String, DpdkTO> dpdkPortsMapping = command.getDpdkInterfaceMapping(); | ||
| if (MapUtils.isNotEmpty(dpdkPortsMapping)) { | ||
| if (logger.isTraceEnabled()) { | ||
| logger.trace(String.format("Changing VM [%s] DPDK interfaces during migration to host: [%s].", vmName, target)); | ||
| logger.trace("Changing VM {} DPDK interfaces during migration to host: {}.", vmName, target); | ||
| } | ||
| xmlDesc = replaceDpdkInterfaces(xmlDesc, dpdkPortsMapping); | ||
| if (logger.isDebugEnabled()) { | ||
| logger.debug(String.format("Changed VM [%s] XML configuration of DPDK interfaces. New XML configuration is [%s].", vmName, xmlDesc)); | ||
| logger.debug("Changed VM {} XML configuration of DPDK interfaces. New XML configuration is {}.", vmName, maskSensitiveInfoInXML(xmlDesc)); | ||
| } | ||
| } | ||
|
|
||
|
|
@@ -233,7 +233,7 @@ Use VIR_DOMAIN_XML_SECURE (value = 1) prior to v1.0.0. | |
| } | ||
|
|
||
| //run migration in thread so we can monitor it | ||
| logger.info(String.format("Starting live migration of instance [%s] to destination host [%s] having the final XML configuration: [%s].", vmName, dconn.getURI(), xmlDesc)); | ||
| logger.info("Starting live migration of instance {} to destination host {} having the final XML configuration: {}.", vmName, dconn.getURI(), maskSensitiveInfoInXML(xmlDesc)); | ||
| final ExecutorService executor = Executors.newFixedThreadPool(1); | ||
| boolean migrateNonSharedInc = command.isMigrateNonSharedInc() && !migrateStorageManaged; | ||
|
|
||
|
|
@@ -910,4 +910,11 @@ private boolean findSourceNode(Document doc, Node diskNode, String vmName, Strin | |
| } | ||
| return false; | ||
| } | ||
|
|
||
| public static String maskSensitiveInfoInXML(String xmlDesc) { | ||
| if (xmlDesc == null) return null; | ||
| // Mask VNC password in XML for logging | ||
| return xmlDesc.replaceAll("(graphics\\s+[^>]*type=['\"]vnc['\"][^>]*passwd=['\"])([^'\"]*)(['\"])", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can also just remove it, btw |
||
| "$1*****$3"); | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a suggestion, (may apply below as well)