Prevent AzureFile from logging senstive options

This commit is contained in:
saad-ali 2020-02-28 19:03:48 -08:00
parent 727582311f
commit 548b297a00

View File

@ -272,18 +272,20 @@ func (b *azureFileMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs) e
}
var mountOptions []string
var sensitiveMountOptions []string
source := ""
osSeparator := string(os.PathSeparator)
source = fmt.Sprintf("%s%s%s.file.%s%s%s", osSeparator, osSeparator, accountName, getStorageEndpointSuffix(b.plugin.host.GetCloudProvider()), osSeparator, b.shareName)
if runtime.GOOS == "windows" {
mountOptions = []string{fmt.Sprintf("AZURE\\%s", accountName), accountKey}
sensitiveMountOptions = []string{fmt.Sprintf("AZURE\\%s", accountName), accountKey}
} else {
if err := os.MkdirAll(dir, 0700); err != nil {
return err
}
// parameters suggested by https://azure.microsoft.com/en-us/documentation/articles/storage-how-to-use-files-linux/
options := []string{fmt.Sprintf("username=%s,password=%s", accountName, accountKey)}
options := []string{}
sensitiveMountOptions = []string{fmt.Sprintf("username=%s,password=%s", accountName, accountKey)}
if b.readOnly {
options = append(options, "ro")
}
@ -293,7 +295,7 @@ func (b *azureFileMounter) SetUpAt(dir string, mounterArgs volume.MounterArgs) e
mountComplete := false
err = wait.Poll(5*time.Second, 10*time.Minute, func() (bool, error) {
err := b.mounter.Mount(source, dir, "cifs", mountOptions)
err := b.mounter.MountSensitive(source, dir, "cifs", mountOptions, sensitiveMountOptions)
mountComplete = true
return true, err
})