aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/app/app_nixos_linux_test.go5
-rw-r--r--internal/app/app_pd_linux_test.go7
-rw-r--r--internal/app/seal_linux.go3
3 files changed, 12 insertions, 3 deletions
diff --git a/internal/app/app_nixos_linux_test.go b/internal/app/app_nixos_linux_test.go
index c1bda924..303d535d 100644
--- a/internal/app/app_nixos_linux_test.go
+++ b/internal/app/app_nixos_linux_test.go
@@ -1,6 +1,8 @@
package app_test
import (
+ "syscall"
+
"hakurei.app/container"
"hakurei.app/container/seccomp"
"hakurei.app/hst"
@@ -141,7 +143,8 @@ var testCasesNixos = []sealTestCase{
Place(hst.Tmp+"/pulse-cookie", nil).
Bind("/tmp/hakurei.1971/8e2c76b066dabe574cf073bdb46eb5c1/bus", "/run/user/1971/bus", 0).
Bind("/tmp/hakurei.1971/8e2c76b066dabe574cf073bdb46eb5c1/system_bus_socket", "/run/dbus/system_bus_socket", 0).
- Tmpfs("/var/run/nscd", 8192, 0755),
+ Tmpfs("/var/run/nscd", 8192, 0755).
+ Remount("/", syscall.MS_RDONLY),
SeccompPresets: seccomp.PresetExt | seccomp.PresetDenyTTY | seccomp.PresetDenyDevel,
HostNet: true,
ForwardCancel: true,
diff --git a/internal/app/app_pd_linux_test.go b/internal/app/app_pd_linux_test.go
index 7f0049bf..66cebe4f 100644
--- a/internal/app/app_pd_linux_test.go
+++ b/internal/app/app_pd_linux_test.go
@@ -2,6 +2,7 @@ package app_test
import (
"os"
+ "syscall"
"hakurei.app/container"
"hakurei.app/container/seccomp"
@@ -56,7 +57,8 @@ var testCasesPd = []sealTestCase{
Bind("/tmp/hakurei.1971/tmpdir/0", "/tmp", container.BindWritable).
Bind("/home/chronos", "/home/chronos", container.BindWritable).
Place("/etc/passwd", []byte("chronos:x:65534:65534:Hakurei:/home/chronos:/run/current-system/sw/bin/zsh\n")).
- Place("/etc/group", []byte("hakurei:x:65534:\n")),
+ Place("/etc/group", []byte("hakurei:x:65534:\n")).
+ Remount("/", syscall.MS_RDONLY),
SeccompPresets: seccomp.PresetExt | seccomp.PresetDenyDevel,
HostNet: true,
RetainSession: true,
@@ -195,7 +197,8 @@ var testCasesPd = []sealTestCase{
Bind("/run/user/1971/hakurei/ebf083d1b175911782d413369b64ce7c/pulse", "/run/user/65534/pulse/native", 0).
Place(hst.Tmp+"/pulse-cookie", nil).
Bind("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/bus", "/run/user/65534/bus", 0).
- Bind("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/system_bus_socket", "/run/dbus/system_bus_socket", 0),
+ Bind("/tmp/hakurei.1971/ebf083d1b175911782d413369b64ce7c/system_bus_socket", "/run/dbus/system_bus_socket", 0).
+ Remount("/", syscall.MS_RDONLY),
SeccompPresets: seccomp.PresetExt | seccomp.PresetDenyDevel,
HostNet: true,
RetainSession: true,
diff --git a/internal/app/seal_linux.go b/internal/app/seal_linux.go
index cc92db29..b25b5c4f 100644
--- a/internal/app/seal_linux.go
+++ b/internal/app/seal_linux.go
@@ -478,6 +478,9 @@ func (seal *outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co
seal.container.Tmpfs(dest, 1<<13, 0755)
}
+ // mount root read-only as the final setup Op
+ seal.container.Remount("/", syscall.MS_RDONLY)
+
// append ExtraPerms last
for _, p := range config.ExtraPerms {
if p == nil {