client-go: make generating certificate/key permissions more secure (600)

Kubernetes-commit: 5f81c3005f6d3aeb652a0626c3632ff68b036577
This commit is contained in:
Khachatur Ashotyan
2023-02-02 14:52:45 +04:00
committed by Kubernetes Publisher
parent d0008d188f
commit 03568a1821
4 changed files with 9 additions and 9 deletions

View File

@@ -188,10 +188,10 @@ func GenerateSelfSignedCertKeyWithFixtures(host string, alternateIPs []net.IP, a
}
if len(fixtureDirectory) > 0 {
if err := os.WriteFile(certFixturePath, certBuffer.Bytes(), 0644); err != nil {
if err := os.WriteFile(certFixturePath, certBuffer.Bytes(), 0600); err != nil {
return nil, nil, fmt.Errorf("failed to write cert fixture to %s: %v", certFixturePath, err)
}
if err := os.WriteFile(keyFixturePath, keyBuffer.Bytes(), 0644); err != nil {
if err := os.WriteFile(keyFixturePath, keyBuffer.Bytes(), 0600); err != nil {
return nil, nil, fmt.Errorf("failed to write key fixture to %s: %v", certFixturePath, err)
}
}