-
Notifications
You must be signed in to change notification settings - Fork 191
Conversation
@bergwolf Any updates on this? |
The hyperstart part needs rebase. |
CI failures are because of |
Signed-off-by: Peng Tao <[email protected]>
ReadOnly option is added to container spec. Signed-off-by: Peng Tao <[email protected]>
b42fca2
to
b6f3067
Compare
Mount rootfs readonly here so that even if user remount it rw inside container, the rootfs is still readonly. ``` [hypervsock@~]$sudo hyperctl run -t --read-only busybox / # mount share_dir on / type 9p (ro,sync,dirsync,relatime,trans=virtio) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) devtmpfs on /dev type devtmpfs (rw,nosuid,relatime,size=21984k,nr_inodes=5496,mode=755) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,relatime) devpts on /dev/pts type devpts (rw,nosuid,relatime,mode=620,ptmxmode=666) share_dir on /etc/hosts type 9p (rw,sync,dirsync,nodev,relatime,trans=virtio) rootfs on /etc/hostname type rootfs (rw,size=21984k,nr_inodes=5496) / # mount / -o remount,rw / # mount share_dir on / type 9p (rw,sync,dirsync,relatime,trans=virtio) proc on /proc type proc (rw,nosuid,nodev,noexec,relatime) sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) devtmpfs on /dev type devtmpfs (rw,nosuid,relatime,size=21984k,nr_inodes=5496,mode=755) tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,relatime) devpts on /dev/pts type devpts (rw,nosuid,relatime,mode=620,ptmxmode=666) share_dir on /etc/hosts type 9p (rw,sync,dirsync,nodev,relatime,trans=virtio) rootfs on /etc/hostname type rootfs (rw,size=21984k,nr_inodes=5496) / # touch foo touch: foo: Read-only file system ``` Signed-off-by: Peng Tao <[email protected]>
Signed-off-by: Peng Tao <[email protected]>
Signed-off-by: Peng Tao <[email protected]>
it seems that the ro-mount for btrfs driver is not included. |
hykins was running too slow (>40 mins) and timed out. retest this please @hykins |
@@ -446,6 +446,12 @@ func (s *BtrfsStorage) PrepareContainer(containerId, sharedDir string, readonly | |||
if err := syscall.Mount(btrfsRootfs, mountPoint, "bind", syscall.MS_BIND, ""); err != nil { | |||
return nil, fmt.Errorf("failed to mount %s to %s: %v", btrfsRootfs, mountPoint, err) | |||
} | |||
if readonly { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so there may be a security problem among these two mount operations. The early existing container can possible write to the roofs of this one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They are different subvolumes. It needs to break its own chroot sandbox to access another container's rootfs, no?
LGTM |
A new command line option
--read-only
is added tohyperctl run
andhyperctl create
to enable readonly rootfs support. A new fieldreadonly
is added to container spec to enable it as well.Readonly rootfs is enforced in two ways:
Needs: hyperhq/hyperstart#314 hyperhq/runv#511
Fixes: #564