Bug 6479: Storing proxy certificate in a secure location to avoid unexpected deletion. (#7811)
This prevents proxy certificate used by --insecure mode from being deleted when stored in a user-writable location.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
* Orbit lost communication with Fleet server
|
||||
when the certificate used for insecure mode gets deleted.
|
||||
@@ -395,7 +395,13 @@ func main() {
|
||||
},
|
||||
)
|
||||
|
||||
certPath := filepath.Join(os.TempDir(), "fleet.crt")
|
||||
// Directory to store proxy related assets
|
||||
proxyDirectory := filepath.Join(c.String("root-dir"), "proxy")
|
||||
if err := secure.MkdirAll(proxyDirectory, constant.DefaultDirMode); err != nil {
|
||||
return fmt.Errorf("there was a problem creating the proxy directory: %w", err)
|
||||
}
|
||||
|
||||
certPath := filepath.Join(proxyDirectory, "fleet.crt")
|
||||
|
||||
// Write cert that proxy uses
|
||||
err = ioutil.WriteFile(certPath, []byte(insecure.ServerCert), os.ModePerm)
|
||||
|
||||
Reference in New Issue
Block a user