1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

seedfile: removed deletion, and changed file permissions to 600

This commit is contained in:
postmannen 2024-12-02 07:29:29 +01:00
parent fc2d1da165
commit 66c3307dd5

View file

@ -116,7 +116,7 @@ func NewServer(configuration *Configuration, version string) (*server, error) {
// return nil, fmt.Errorf("error: failed to create tmp seed file: %v", err) // return nil, fmt.Errorf("error: failed to create tmp seed file: %v", err)
// } // }
err = os.WriteFile(pth, []byte(configuration.NkeySeed), 0700) err = os.WriteFile(pth, []byte(configuration.NkeySeed), 0600)
if err != nil { if err != nil {
cancel() cancel()
return nil, fmt.Errorf("error: failed to write temp seed file: %v", err) return nil, fmt.Errorf("error: failed to write temp seed file: %v", err)
@ -128,13 +128,14 @@ func NewServer(configuration *Configuration, version string) (*server, error) {
return nil, fmt.Errorf("error: failed to read temp nkey seed file: %v", err) return nil, fmt.Errorf("error: failed to read temp nkey seed file: %v", err)
} }
defer func() { // // TODO: REMOVED for testing
err = os.Remove(pth) //defer func() {
if err != nil { // err = os.Remove(pth)
cancel() // if err != nil {
log.Fatalf("error: failed to remove temp seed file: %v\n", err) // cancel()
} // log.Fatalf("error: failed to remove temp seed file: %v\n", err)
}() // }
//}()
case configuration.NkeySeedFile != "" && configuration.NkeyFromED25519SSHKeyFile == "": case configuration.NkeySeedFile != "" && configuration.NkeyFromED25519SSHKeyFile == "":
var err error var err error