1
0
mirror of https://github.com/rancher/rke.git synced 2025-09-02 07:24:20 +00:00

Write kubeconfig/state with stricter permission

This commit is contained in:
Sebastiaan van Steenis
2021-03-07 11:29:02 +01:00
parent c636431923
commit 05e002bc08
2 changed files with 2 additions and 2 deletions

View File

@@ -205,7 +205,7 @@ func (s *FullState) WriteStateFile(ctx context.Context, statePath string) error
return fmt.Errorf("Failed to Marshal state object: %v", err) return fmt.Errorf("Failed to Marshal state object: %v", err)
} }
logrus.Tracef("Writing state file: %s", stateFile) logrus.Tracef("Writing state file: %s", stateFile)
if err := ioutil.WriteFile(statePath, stateFile, 0640); err != nil { if err := ioutil.WriteFile(statePath, stateFile, 0600); err != nil {
return fmt.Errorf("Failed to write state file: %v", err) return fmt.Errorf("Failed to write state file: %v", err)
} }
log.Infof(ctx, "Successfully Deployed state file at [%s]", statePath) log.Infof(ctx, "Successfully Deployed state file at [%s]", statePath)

View File

@@ -188,7 +188,7 @@ func DeployAdminConfig(ctx context.Context, kubeConfig, localConfigPath string)
} }
logrus.Debugf("Deploying admin Kubeconfig locally at [%s]", localConfigPath) logrus.Debugf("Deploying admin Kubeconfig locally at [%s]", localConfigPath)
logrus.Tracef("Deploying admin Kubeconfig locally: %s", kubeConfig) logrus.Tracef("Deploying admin Kubeconfig locally: %s", kubeConfig)
err := ioutil.WriteFile(localConfigPath, []byte(kubeConfig), 0640) err := ioutil.WriteFile(localConfigPath, []byte(kubeConfig), 0600)
if err != nil { if err != nil {
return fmt.Errorf("Failed to create local admin kubeconfig file: %v", err) return fmt.Errorf("Failed to create local admin kubeconfig file: %v", err)
} }