aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/seal_linux.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-08-01 04:10:33 +0900
committerOphestra <cat@gensokyo.uk>2025-08-01 04:21:54 +0900
commit387b86bcdd7798a149ba2349cdf2a699f05cefe5 (patch)
treeede8a378bb00664ba38ce4619e03f72507d7b415 /internal/app/seal_linux.go
parent4e856438656ea0a1b30d52975f6b5415568df9a8 (diff)
app: integrate container autoroot
Doing this instead of mounting directly on / because it's impossible to ensure a parent is available for every path hakurei wants to mount to. This situation is similar to autoetc hence the similar name, however a symlink mirror will not work in this case. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/seal_linux.go')
-rw-r--r--internal/app/seal_linux.go35
1 files changed, 3 insertions, 32 deletions
diff --git a/internal/app/seal_linux.go b/internal/app/seal_linux.go
index 13257211..d020697e 100644
--- a/internal/app/seal_linux.go
+++ b/internal/app/seal_linux.go
@@ -241,26 +241,9 @@ func (seal *outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co
Net: true,
Tty: true,
AutoEtc: true,
- }
- // bind entries in /
- if d, err := sys.ReadDir("/"); err != nil {
- return err
- } else {
- b := make([]*hst.FilesystemConfig, 0, len(d))
- for _, ent := range d {
- p := "/" + ent.Name()
- switch p {
- case "/proc":
- case "/dev":
- case "/tmp":
- case "/mnt":
- case "/etc":
- default:
- b = append(b, &hst.FilesystemConfig{Src: p, Write: true, Must: true})
- }
- }
- conf.Filesystem = append(conf.Filesystem, b...)
+ AutoRoot: "/",
+ RootFlags: container.BindWritable,
}
// hide nscd from sandbox if present
@@ -282,7 +265,7 @@ func (seal *outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co
{
var uid, gid int
var err error
- seal.container, seal.env, err = newContainer(config.Container, sys, &uid, &gid)
+ seal.container, seal.env, err = newContainer(config.Container, sys, seal.id.String(), &uid, &gid)
seal.waitDelay = config.Container.WaitDelay
if err != nil {
return hlog.WrapErrSuffix(err,
@@ -305,18 +288,6 @@ func (seal *outcome) finalise(ctx context.Context, sys sys.State, config *hst.Co
}
}
- if !config.Container.AutoEtc {
- if config.Container.Etc != "" {
- seal.container.Bind(config.Container.Etc, "/etc", 0)
- }
- } else {
- etcPath := config.Container.Etc
- if etcPath == "" {
- etcPath = "/etc"
- }
- seal.container.Etc(etcPath, seal.id.String())
- }
-
// inner XDG_RUNTIME_DIR default formatting of `/run/user/%d` as mapped uid
innerRuntimeDir := path.Join("/run/user", mapuid.String())
seal.env[xdgRuntimeDir] = innerRuntimeDir