aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Holst Swende <martin@swende.se>2018-09-14 14:38:13 +0800
committerGitHub <noreply@github.com>2018-09-14 14:38:13 +0800
commit7bb95a9a64c9d26bef4f15fdd9301bb0b5cdb668 (patch)
treeda8dc7f8bb52d9903b1c15a5155ebff7ffa8c743
parent72c820c49e231b9048b7b46ced109efc09396e8e (diff)
parentb040b750751cac7fd46893f4be3d2b30e741fb73 (diff)
downloadgo-tangerine-7bb95a9a64c9d26bef4f15fdd9301bb0b5cdb668.tar
go-tangerine-7bb95a9a64c9d26bef4f15fdd9301bb0b5cdb668.tar.gz
go-tangerine-7bb95a9a64c9d26bef4f15fdd9301bb0b5cdb668.tar.bz2
go-tangerine-7bb95a9a64c9d26bef4f15fdd9301bb0b5cdb668.tar.lz
go-tangerine-7bb95a9a64c9d26bef4f15fdd9301bb0b5cdb668.tar.xz
go-tangerine-7bb95a9a64c9d26bef4f15fdd9301bb0b5cdb668.tar.zst
go-tangerine-7bb95a9a64c9d26bef4f15fdd9301bb0b5cdb668.zip
Merge pull request #17652 from YaoZengzeng/file-permission
cmd/clef: fix incorrect file permissions for secrets.dat
-rw-r--r--cmd/clef/main.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/cmd/clef/main.go b/cmd/clef/main.go
index 85704754d..f363a86f2 100644
--- a/cmd/clef/main.go
+++ b/cmd/clef/main.go
@@ -225,7 +225,7 @@ func initializeSecrets(c *cli.Context) error {
if _, err := os.Stat(location); err == nil {
return fmt.Errorf("file %v already exists, will not overwrite", location)
}
- err = ioutil.WriteFile(location, masterSeed, 0700)
+ err = ioutil.WriteFile(location, masterSeed, 0400)
if err != nil {
return err
}
@@ -540,14 +540,14 @@ func readMasterKey(ctx *cli.Context) ([]byte, error) {
// checkFile is a convenience function to check if a file
// * exists
-// * is mode 0600
+// * is mode 0400
func checkFile(filename string) error {
info, err := os.Stat(filename)
if err != nil {
return fmt.Errorf("failed stat on %s: %v", filename, err)
}
// Check the unix permission bits
- if info.Mode().Perm()&077 != 0 {
+ if info.Mode().Perm()&0377 != 0 {
return fmt.Errorf("file (%v) has insecure file permissions (%v)", filename, info.Mode().String())
}
return nil