Skip to content

Commit

Permalink
Revert write file permision
Browse files Browse the repository at this point in the history
Signed-off-by: z1cheng <imchench@gmail.com>
  • Loading branch information
z1cheng committed Aug 31, 2023
1 parent 131099f commit fe3dae9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions internal/net/ssl/ssl.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ func ConfigureCACertWithCertAndKey(_ string, ca []byte, sslCert *ingress.SSLCert
return fmt.Errorf("could not write ca data to cert file %v: %v", sslCert.CAFileName, err)
}

return os.WriteFile(sslCert.CAFileName, buffer.Bytes(), 0o600)
//nolint:gosec // Not change permission to avoid possible issues
return os.WriteFile(sslCert.CAFileName, buffer.Bytes(), 0o644)
}

// ConfigureCRL creates a CRL file and append it into the SSLCert
Expand All @@ -230,7 +231,8 @@ func ConfigureCRL(name string, crl []byte, sslCert *ingress.SSLCert) error {
return err
}

err = os.WriteFile(crlFileName, crl, 0o600)
//nolint:gosec // Not change permission to avoid possible issues
err = os.WriteFile(crlFileName, crl, 0o644)
if err != nil {
return fmt.Errorf("could not write CRL file %v: %v", crlFileName, err)
}
Expand All @@ -247,7 +249,8 @@ func ConfigureCACert(name string, ca []byte, sslCert *ingress.SSLCert) error {
caName := fmt.Sprintf("ca-%v.pem", name)
fileName := fmt.Sprintf("%v/%v", file.DefaultSSLDirectory, caName)

err := os.WriteFile(fileName, ca, 0o600)
//nolint:gosec // Not change permission to avoid possible issues
err := os.WriteFile(fileName, ca, 0o644)
if err != nil {
return fmt.Errorf("could not write CA file %v: %v", fileName, err)
}
Expand Down
3 changes: 2 additions & 1 deletion test/e2e/settings/ocsp/ocsp.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,8 @@ const configTemplate = `

func prepareCertificates(namespace string) error {
config := fmt.Sprintf(configTemplate, namespace)
err := os.WriteFile("cfssl_config.json", []byte(config), 0o600)
//nolint:gosec // Not change permission to avoid possible issues
err := os.WriteFile("cfssl_config.json", []byte(config), 0o644)
if err != nil {
return fmt.Errorf("creating cfssl_config.json file: %v", err)
}
Expand Down

0 comments on commit fe3dae9

Please sign in to comment.