aboutsummaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'cmd')
-rw-r--r--cmd/eno/cobra.go8
-rw-r--r--cmd/eno/config.go4
2 files changed, 6 insertions, 6 deletions
diff --git a/cmd/eno/cobra.go b/cmd/eno/cobra.go
index 1a58681..4a7443e 100644
--- a/cmd/eno/cobra.go
+++ b/cmd/eno/cobra.go
@@ -74,7 +74,7 @@ var encryptCmd = &cobra.Command{
os.Exit(1)
}
- if err := os.WriteFile(output, encrypted, 0644); err != nil {
+ if err := os.WriteFile(output, encrypted, 0600); err != nil {
return fmt.Errorf("failed to write output file: %v", err)
}
@@ -95,7 +95,7 @@ var encryptCmd = &cobra.Command{
os.Exit(1)
}
- if err := os.WriteFile(output, encrypted, 0644); err != nil {
+ if err := os.WriteFile(output, encrypted, 0600); err != nil {
return fmt.Errorf("failed to write output file: %v", err)
}
@@ -149,7 +149,7 @@ var decryptCmd = &cobra.Command{
crypt.TryMlock(plaintext)
defer clear(plaintext)
- if err := os.WriteFile(output, plaintext, 0644); err != nil {
+ if err := os.WriteFile(output, plaintext, 0600); err != nil {
return fmt.Errorf("failed to write output file: %v", err)
}
@@ -172,7 +172,7 @@ var decryptCmd = &cobra.Command{
crypt.TryMlock(plaintext)
defer clear(plaintext)
- if err := os.WriteFile(output, plaintext, 0644); err != nil {
+ if err := os.WriteFile(output, plaintext, 0600); err != nil {
return fmt.Errorf("failed to write output file: %v", err)
}
diff --git a/cmd/eno/config.go b/cmd/eno/config.go
index 6725e84..90bdf1b 100644
--- a/cmd/eno/config.go
+++ b/cmd/eno/config.go
@@ -109,7 +109,7 @@ func handlerInit() error {
if err := os.MkdirAll(filepath.Dir(Conf.ConfPath), 0755); err != nil {
return fmt.Errorf("creating config dir: %w", err)
}
- f, err := os.Create(Conf.ConfPath)
+ f, err := os.OpenFile(Conf.ConfPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
if err != nil {
return fmt.Errorf("creating config file: %w", err)
}
@@ -187,7 +187,7 @@ func updateConfig(key string, val any) error {
lines = append(lines, newLine)
}
- err = os.WriteFile(Conf.ConfPath, []byte(strings.Join(lines, "\n")), 0644)
+ err = os.WriteFile(Conf.ConfPath, []byte(strings.Join(lines, "\n")), 0600)
if err != nil {
return err
}