aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/seal.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-12-18 13:45:55 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-12-18 13:45:55 +0900
commitb752ec44689aa5a3a0f3b9672b218691f161c7c1 (patch)
treeb514cb0c247f8deaa9feba84d9f8944623911f5d /internal/app/seal.go
parent5d00805a7c775382516e05b5b01e58df651408ab (diff)
fipc: export config struct
Also store full config as part of state. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/app/seal.go')
-rw-r--r--internal/app/seal.go16
1 files changed, 9 insertions, 7 deletions
diff --git a/internal/app/seal.go b/internal/app/seal.go
index 94c9e061..b01befc1 100644
--- a/internal/app/seal.go
+++ b/internal/app/seal.go
@@ -9,6 +9,7 @@ import (
"strconv"
"git.ophivana.moe/security/fortify/dbus"
+ "git.ophivana.moe/security/fortify/fipc"
"git.ophivana.moe/security/fortify/internal/fmsg"
"git.ophivana.moe/security/fortify/internal/linux"
"git.ophivana.moe/security/fortify/internal/state"
@@ -59,7 +60,7 @@ type appSeal struct {
}
// Seal seals the app launch context
-func (a *app) Seal(config *Config) error {
+func (a *app) Seal(config *fipc.Config) error {
a.lock.Lock()
defer a.lock.Unlock()
@@ -147,7 +148,7 @@ func (a *app) Seal(config *Config) error {
fmsg.VPrintln("sandbox configuration not supplied, PROCEED WITH CAUTION")
// permissive defaults
- conf := &SandboxConfig{
+ conf := &fipc.SandboxConfig{
UserNS: true,
Net: true,
NoNewSession: true,
@@ -157,7 +158,7 @@ func (a *app) Seal(config *Config) error {
if d, err := a.os.ReadDir("/"); err != nil {
return err
} else {
- b := make([]*FilesystemConfig, 0, len(d))
+ b := make([]*fipc.FilesystemConfig, 0, len(d))
for _, ent := range d {
p := "/" + ent.Name()
switch p {
@@ -169,7 +170,7 @@ func (a *app) Seal(config *Config) error {
case "/etc":
default:
- b = append(b, &FilesystemConfig{Src: p, Write: true, Must: true})
+ b = append(b, &fipc.FilesystemConfig{Src: p, Write: true, Must: true})
}
}
conf.Filesystem = append(conf.Filesystem, b...)
@@ -178,7 +179,7 @@ func (a *app) Seal(config *Config) error {
if d, err := a.os.ReadDir("/run"); err != nil {
return err
} else {
- b := make([]*FilesystemConfig, 0, len(d))
+ b := make([]*fipc.FilesystemConfig, 0, len(d))
for _, ent := range d {
name := ent.Name()
switch name {
@@ -186,7 +187,7 @@ func (a *app) Seal(config *Config) error {
case "dbus":
default:
p := "/run/" + name
- b = append(b, &FilesystemConfig{Src: p, Write: true, Must: true})
+ b = append(b, &fipc.FilesystemConfig{Src: p, Write: true, Must: true})
}
}
conf.Filesystem = append(conf.Filesystem, b...)
@@ -198,7 +199,7 @@ func (a *app) Seal(config *Config) error {
}
// bind GPU stuff
if config.Confinement.Enablements.Has(system.EX11) || config.Confinement.Enablements.Has(system.EWayland) {
- conf.Filesystem = append(conf.Filesystem, &FilesystemConfig{Src: "/dev/dri", Device: true})
+ conf.Filesystem = append(conf.Filesystem, &fipc.FilesystemConfig{Src: "/dev/dri", Device: true})
}
config.Confinement.Sandbox = conf
@@ -236,5 +237,6 @@ func (a *app) Seal(config *Config) error {
// seal app and release lock
a.seal = seal
+ a.ct = newAppCt(config)
return nil
}