Skip to content

Commit

Permalink
Should always makedirs as 0755
Browse files Browse the repository at this point in the history
Volumes being created with 0644 are not writable by users, since they
are not allowed to search through them.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
  • Loading branch information
rhatdan committed Jan 3, 2019
1 parent bb90cc9 commit f79dd70
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions server/container_create.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,13 +165,13 @@ func addImageVolumes(rootfs string, s *Server, containerInfo *storage.ContainerI
}
switch s.config.ImageVolumes {
case lib.ImageVolumesMkdir:
if err1 := os.MkdirAll(fp, 0644); err1 != nil {
if err1 := os.MkdirAll(fp, 0755); err1 != nil {
return nil, err1
}
case lib.ImageVolumesBind:
volumeDirName := stringid.GenerateNonCryptoID()
src := filepath.Join(containerInfo.RunDir, "mounts", volumeDirName)
if err1 := os.MkdirAll(src, 0644); err1 != nil {
if err1 := os.MkdirAll(src, 0755); err1 != nil {
return nil, err1
}
// Label the source with the sandbox selinux mount label
Expand Down
2 changes: 1 addition & 1 deletion server/container_create_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -1035,7 +1035,7 @@ func addOCIBindMounts(mountLabel string, containerConfig *pb.ContainerConfig, sp
} else {
if !os.IsNotExist(err) {
return nil, nil, fmt.Errorf("failed to resolve symlink %q: %v", src, err)
} else if err = os.MkdirAll(src, 0644); err != nil {
} else if err = os.MkdirAll(src, 0755); err != nil {
return nil, nil, fmt.Errorf("Failed to mkdir %s: %s", src, err)
}
}
Expand Down

0 comments on commit f79dd70

Please sign in to comment.