-
Notifications
You must be signed in to change notification settings - Fork 51
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
Modify parsing behavior of login credentials to handle Go escape characters #564
Modify parsing behavior of login credentials to handle Go escape characters #564
Conversation
b07e32a
to
a5a9e2b
Compare
Create common config and new function to parse config data
f0c0986
to
2276032
Compare
… port if config port value is empty Signed-off-by: Varun Srinivasan <varuns6@vmware.com>
Signed-off-by: Varun Srinivasan <varuns6@vmware.com>
Please add a release note. |
Signed-off-by: Varun Srinivasan <varuns6@vmware.com>
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.
Move the testing done to the PR description instead of a comment.
Signed-off-by: Varun Srinivasan <varuns6@vmware.com>
Can you give an example on what the user should set in the configmap? |
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.
lgtm
@varunsrinivasan2 Can you update the documentation? |
@xing-yang updated comment with example.
Will do. |
…acters (vmware-tanzu#564) * Signed-off-by: Varun Srinivasan <varuns6@vmware.com> Create common config and new function to parse config data * Always populate "port" key of parameters map after setting default VC port if config port value is empty Signed-off-by: Varun Srinivasan <varuns6@vmware.com> * Clean up test logging and unit tests Signed-off-by: Varun Srinivasan <varuns6@vmware.com> * Keep only necessary config values Signed-off-by: Varun Srinivasan <varuns6@vmware.com> * Refactor ParseConfig to return error for sanitized error handling Signed-off-by: Varun Srinivasan <varuns6@vmware.com> --------- Signed-off-by: Varun Srinivasan <varuns6@vmware.com>
…acters (vmware-tanzu#564) * Signed-off-by: Varun Srinivasan <varuns6@vmware.com> Create common config and new function to parse config data * Always populate "port" key of parameters map after setting default VC port if config port value is empty Signed-off-by: Varun Srinivasan <varuns6@vmware.com> * Clean up test logging and unit tests Signed-off-by: Varun Srinivasan <varuns6@vmware.com> * Keep only necessary config values Signed-off-by: Varun Srinivasan <varuns6@vmware.com> * Refactor ParseConfig to return error for sanitized error handling Signed-off-by: Varun Srinivasan <varuns6@vmware.com> --------- Signed-off-by: Varun Srinivasan <varuns6@vmware.com> Signed-off-by: Liping Xue <lipingx@vmware.com>
* Update support matrix for Vanilla, WCP and GC. (#559) Signed-off-by: Liping Xue <lipingx@vmware.com> * Document change to update known issue. (#560) * Document change. Signed-off-by: Liping Xue <lipingx@vmware.com> * Address comment from Xing. Signed-off-by: Liping Xue <lipingx@vmware.com> * Remove files that are not needed for this change. Signed-off-by: Liping Xue <lipingx@vmware.com> --------- Signed-off-by: Liping Xue <lipingx@vmware.com> * Bump golang.org/x/crypto from 0.14.0 to 0.17.0 (#562) Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.14.0 to 0.17.0. - [Commits](golang/crypto@v0.14.0...v0.17.0) --- updated-dependencies: - dependency-name: golang.org/x/crypto dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Signed-off-by: Liping Xue <lipingx@vmware.com> * Update document. (#566) Signed-off-by: Liping Xue <lipingx@vmware.com> * Modify parsing behavior of login credentials to handle Go escape characters (#564) * Signed-off-by: Varun Srinivasan <varuns6@vmware.com> Create common config and new function to parse config data * Always populate "port" key of parameters map after setting default VC port if config port value is empty Signed-off-by: Varun Srinivasan <varuns6@vmware.com> * Clean up test logging and unit tests Signed-off-by: Varun Srinivasan <varuns6@vmware.com> * Keep only necessary config values Signed-off-by: Varun Srinivasan <varuns6@vmware.com> * Refactor ParseConfig to return error for sanitized error handling Signed-off-by: Varun Srinivasan <varuns6@vmware.com> --------- Signed-off-by: Varun Srinivasan <varuns6@vmware.com> Signed-off-by: Liping Xue <lipingx@vmware.com> * Only skip PVC creation if --namespace-mapping flag is not used (#565) * Only skip PVC creation if --namespace-mapping flag is not used Signed-off-by: Varun Srinivasan <varuns6@vmware.com> * Refactor SkipPVCCreation function signature to add target namespace as a parameter Signed-off-by: Varun Srinivasan <varuns6@vmware.com> --------- Signed-off-by: Varun Srinivasan <varuns6@vmware.com> Signed-off-by: Liping Xue <lipingx@vmware.com> * Add doc that wffc is not supported (#567) Signed-off-by: xing-yang <xingyang105@gmail.com> Signed-off-by: Liping Xue <lipingx@vmware.com> * Fail the Restore if the StorageClass is associated with WaitForFirstConsumer volumeBindingMode (#568) Signed-off-by: Deepak Kinni <dkinni@vmware.com> Co-authored-by: Deepak Kinni <dkinni@vmware.com> Signed-off-by: Liping Xue <lipingx@vmware.com> --------- Signed-off-by: Liping Xue <lipingx@vmware.com> Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Varun Srinivasan <varuns6@vmware.com> Signed-off-by: xing-yang <xingyang105@gmail.com> Signed-off-by: Deepak Kinni <dkinni@vmware.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Varun Srinivasan <varun.srinivasan@broadcom.com> Co-authored-by: Xing Yang <xingyang105@gmail.com> Co-authored-by: Deepak Kinni <deepak.kinni@broadcom.com> Co-authored-by: Deepak Kinni <dkinni@vmware.com>
What this PR does / why we need it:
This PR addresses the issue when vSphere login credentials contain Go escape characters (e.g.
\
or\n
). The credentials are read from a configuration file where the keys, suchuser
andpassword
, are stored with values that are quoted. The values need to be read without quotes, but when the value contains a Go escape character, thestrconv.Unquote
method may fail in certain cases causing cascading errors due to login failures. In this change, theParseLines
function is removed and aParseConfig
function is introduced. TheParseConfig
function takes in the Kubernetes Secret and the empty map of params from the original caller. To be consistent with vSphere's CSI plugin, a newVCConfig struct
is introduced to hold the configuration data and the function will use thegcfg
package to read the configuration data which will handle unquoting the strings. It will then iterate over theVCConfig struct
to assign the values to the necessary keys to allow the plugin to connect to VC.Example:
If VC password is
}sso\d$2!UsO
Configuration file should escape with
\\
as such:Testing:
Pods are in running state when using password with escape character, tested with passwords escaped in conf file as described in this Github Issue from vSphere's CSI plugin: kubernetes-sigs/vsphere-csi-driver#121
Successful backup:
Succesful restore:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: