From 7ca06aeae201b984ce2e8b3cf5dadbbd66fc6cf4 Mon Sep 17 00:00:00 2001 From: Evgenii Stratonikov Date: Mon, 7 Feb 2022 18:28:22 +0300 Subject: [PATCH] [#1115] neofs-adm: generate wallets with 0644 permission Signed-off-by: Evgenii Stratonikov --- cmd/neofs-adm/internal/modules/morph/generate.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/neofs-adm/internal/modules/morph/generate.go b/cmd/neofs-adm/internal/modules/morph/generate.go index 5b17afaac..452fb7878 100644 --- a/cmd/neofs-adm/internal/modules/morph/generate.go +++ b/cmd/neofs-adm/internal/modules/morph/generate.go @@ -3,6 +3,7 @@ package morph import ( "errors" "fmt" + "os" "path/filepath" "github.com/nspcc-dev/neo-go/cli/input" @@ -69,7 +70,13 @@ func initializeWallets(walletDir string, size int) ([]string, error) { } p := filepath.Join(walletDir, innerring.GlagoliticLetter(i).String()+".json") - // TODO(@fyrchik): file is created with 0666 permissions, consider changing. + f, err := os.OpenFile(p, os.O_CREATE, 0644) + if err != nil { + return nil, fmt.Errorf("can't create wallet file: %w", err) + } + if err := f.Close(); err != nil { + return nil, fmt.Errorf("can't close wallet file: %w", err) + } w, err := wallet.NewWallet(p) if err != nil { return nil, fmt.Errorf("can't create wallet: %w", err)