mirror of
https://github.com/Mic92/sops-nix.git
synced 2024-12-15 17:50:51 +00:00
Merge pull request #97 from Mic92/fix-permissions
allow non-key group users to access /run/secrets
This commit is contained in:
commit
7918c59b39
1 changed files with 3 additions and 3 deletions
|
@ -254,7 +254,7 @@ func decryptSecrets(secrets []secret) error {
|
||||||
const RAMFS_MAGIC int32 = -2054924042
|
const RAMFS_MAGIC int32 = -2054924042
|
||||||
|
|
||||||
func mountSecretFs(mountpoint string, keysGid int) error {
|
func mountSecretFs(mountpoint string, keysGid int) error {
|
||||||
if err := os.MkdirAll(mountpoint, 0750); err != nil {
|
if err := os.MkdirAll(mountpoint, 0751); err != nil {
|
||||||
return fmt.Errorf("Cannot create directory '%s': %w", mountpoint, err)
|
return fmt.Errorf("Cannot create directory '%s': %w", mountpoint, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,7 +263,7 @@ func mountSecretFs(mountpoint string, keysGid int) error {
|
||||||
return fmt.Errorf("Cannot get statfs for directory '%s': %w", mountpoint, err)
|
return fmt.Errorf("Cannot get statfs for directory '%s': %w", mountpoint, err)
|
||||||
}
|
}
|
||||||
if int32(buf.Type) != RAMFS_MAGIC {
|
if int32(buf.Type) != RAMFS_MAGIC {
|
||||||
if err := unix.Mount("none", mountpoint, "ramfs", unix.MS_NODEV|unix.MS_NOSUID, "mode=0750"); err != nil {
|
if err := unix.Mount("none", mountpoint, "ramfs", unix.MS_NODEV|unix.MS_NOSUID, "mode=0751"); err != nil {
|
||||||
return fmt.Errorf("Cannot mount: %s", err)
|
return fmt.Errorf("Cannot mount: %s", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -296,7 +296,7 @@ func prepareSecretsDir(secretMountpoint string, linkName string, keysGid int) (*
|
||||||
return nil, fmt.Errorf("Cannot remove existing %s: %w", dir, err)
|
return nil, fmt.Errorf("Cannot remove existing %s: %w", dir, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := os.Mkdir(dir, os.FileMode(0750)); err != nil {
|
if err := os.Mkdir(dir, os.FileMode(0751)); err != nil {
|
||||||
return nil, fmt.Errorf("mkdir(): %w", err)
|
return nil, fmt.Errorf("mkdir(): %w", err)
|
||||||
}
|
}
|
||||||
if err := os.Chown(dir, 0, int(keysGid)); err != nil {
|
if err := os.Chown(dir, 0, int(keysGid)); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue