aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/sandbox/container.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-03-17 02:31:46 +0900
committerOphestra <cat@gensokyo.uk>2025-03-17 02:44:07 +0900
commit9a1f8e129fe0f9919981b8a1d345a9b455bd76de (patch)
treee52f33a3908c256aebb30f059cabd40f371a886f /internal/sandbox/container.go
parentee108603572101ad3c285830e04ee248916b6c5d (diff)
sandbox: wrap fmsg interface
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/sandbox/container.go')
-rw-r--r--internal/sandbox/container.go18
1 files changed, 8 insertions, 10 deletions
diff --git a/internal/sandbox/container.go b/internal/sandbox/container.go
index 2cd64ebf..f243ffd9 100644
--- a/internal/sandbox/container.go
+++ b/internal/sandbox/container.go
@@ -14,8 +14,6 @@ import (
"time"
"git.gensokyo.uk/security/fortify/helper/proc"
- "git.gensokyo.uk/security/fortify/internal"
- "git.gensokyo.uk/security/fortify/internal/fmsg"
"git.gensokyo.uk/security/fortify/seccomp"
)
@@ -139,7 +137,7 @@ func (p *Container) Start() error {
if p.CommandContext != nil {
p.cmd = p.CommandContext(ctx)
} else {
- p.cmd = exec.CommandContext(ctx, internal.MustExecutable())
+ p.cmd = exec.CommandContext(ctx, MustExecutable())
p.cmd.Args = []string{"init"}
}
@@ -166,7 +164,7 @@ func (p *Container) Start() error {
// place setup pipe before user supplied extra files, this is later restored by init
if fd, e, err := proc.Setup(&p.cmd.ExtraFiles); err != nil {
- return fmsg.WrapErrorSuffix(err,
+ return wrapErrSuffix(err,
"cannot create shim setup pipe:")
} else {
p.setup = e
@@ -174,9 +172,9 @@ func (p *Container) Start() error {
}
p.cmd.ExtraFiles = append(p.cmd.ExtraFiles, p.ExtraFiles...)
- fmsg.Verbose("starting container init")
+ msg.Verbose("starting container init")
if err := p.cmd.Start(); err != nil {
- return fmsg.WrapError(err, err.Error())
+ return msg.WrapErr(err, err.Error())
}
return nil
}
@@ -187,7 +185,7 @@ func (p *Container) Serve() error {
}
if p.Path != "" && !path.IsAbs(p.Path) {
- return fmsg.WrapError(syscall.EINVAL,
+ return msg.WrapErr(syscall.EINVAL,
fmt.Sprintf("invalid executable path %q", p.Path))
}
@@ -195,14 +193,14 @@ func (p *Container) Serve() error {
if p.name == "" {
p.Path = os.Getenv("SHELL")
if !path.IsAbs(p.Path) {
- return fmsg.WrapError(syscall.EBADE,
+ return msg.WrapErr(syscall.EBADE,
"no command specified and $SHELL is invalid")
}
p.name = path.Base(p.Path)
} else if path.IsAbs(p.name) {
p.Path = p.name
} else if v, err := exec.LookPath(p.name); err != nil {
- return fmsg.WrapError(err, err.Error())
+ return msg.WrapErr(err, err.Error())
} else {
p.Path = v
}
@@ -216,7 +214,7 @@ func (p *Container) Serve() error {
syscall.Getuid(),
syscall.Getgid(),
len(p.ExtraFiles),
- fmsg.Load(),
+ msg.IsVerbose(),
},
)
}