Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/pillar/cmd/zedagent/attesttask.go
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,7 @@ func storeIntegrityToken(token []byte) {
if len(token) == 0 {
log.Warnf("[ATTEST] Received empty integrity token")
}
err := os.WriteFile(types.ITokenFile, token, 644)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems error prone to begin with and the leading zero doesn't make it less so. Should we make all of them use syscall.S_IRUSR etc to not have any numeric values?

err := os.WriteFile(types.ITokenFile, token, 0644)
if err != nil {
log.Fatalf("Failed to store integrity token, err: %v", err)
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/pillar/vault/handler_ext4.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (h *Ext4Handler) SetupDefaultVault() error {
if os.IsNotExist(err) {
// No TPM or TPM lacks required features
// Vault is just a plain folder in those cases
return os.MkdirAll(defaultVault, 755)
return os.MkdirAll(defaultVault, 0755)
}
if err == nil && h.isFscryptEnabled(defaultVault) {
// old versions of EVE created vault on TPM platforms
Expand Down Expand Up @@ -352,7 +352,7 @@ func (h *Ext4Handler) setupVault(vaultPath string, deprecated bool) error {
}
if err != nil && !deprecated {
// Create vault dir
if err := os.MkdirAll(vaultPath, 755); err != nil {
if err := os.MkdirAll(vaultPath, 0755); err != nil {
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/vault/handler_unsupported.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (h *UnsupportedHandler) SetupDefaultVault() error {
if os.IsNotExist(err) {
// No TPM or TPM lacks required features
// Vault is just a plain folder in those cases
return os.MkdirAll(defaultVault, 755)
return os.MkdirAll(defaultVault, 0755)
}
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/pillar/vault/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func deriveVaultKey(log *base.LogObject, cloudKeyOnlyMode, useSealedKey, tpmKeyO
// returns function to unstage the key
func stageKey(log *base.LogObject, cloudKeyOnlyMode, useSealedKey, tpmKeyOnlyMode bool, keyDirName string, keyFileName string) (func(), error) {
// Create a tmpfs file to pass the secret to fscrypt
if err := os.MkdirAll(keyDirName, 755); err != nil {
if err := os.MkdirAll(keyDirName, 0700); err != nil {
return nil, fmt.Errorf("error creating keyDir %s %v", keyDirName, err)
}

Expand Down
Loading