mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-18 23:04:20 +01:00
vc: make host shared path readonly
We need to make sure containers cannot modify host path unless it is explicitly shared to it. Right now we expose an additional top level shared directory to the guest and allow it to be modified. This is less ideal and can be enhanced by following method: 1. create two directories for each sandbox: -. /run/kata-containers/shared/sandboxes/$sbx_id/mounts/, a directory to hold all host/guest shared mounts -. /run/kata-containers/shared/sandboxes/$sbx_id/shared/, a host/guest shared directory (9pfs/virtiofs source dir) 2. /run/kata-containers/shared/sandboxes/$sbx_id/mounts/ is bind mounted readonly to /run/kata-containers/shared/sandboxes/$sbx_id/shared/, so guest cannot modify it 3. host-guest shared files/directories are mounted one-level under /run/kata-containers/shared/sandboxes/$sbx_id/mounts/ and thus present to guest at one level under /run/kata-containers/shared/sandboxes/$sbx_id/shared/ Signed-off-by: Peng Tao <bergwolf@hyper.sh>
This commit is contained in:
@@ -756,19 +756,6 @@ func TestHandlePidNamespace(t *testing.T) {
|
||||
assert.False(testIsPidNamespacePresent(g))
|
||||
}
|
||||
|
||||
func TestAgentPathAPI(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
k1 := &kataAgent{}
|
||||
k2 := &kataAgent{}
|
||||
id := "foobar"
|
||||
|
||||
// getSharePath
|
||||
path1 := k1.getSharePath(id)
|
||||
path2 := k2.getSharePath(id)
|
||||
assert.Equal(path1, path2)
|
||||
}
|
||||
|
||||
func TestAgentConfigure(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user