shim: new shim implementation

This implementation of shim accepts configuration as a gob stream over a unix socket, with support for mediating access to wayland via WAYLAND_SOCKET fd. All configuration is now included in the payload, and child is started inside bwrap configured with supplied bwrap.Config.

Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
This commit is contained in:
2024-10-11 01:55:33 +09:00
parent 6eb712aec7
commit b86fa6b4c9
3 changed files with 301 additions and 0 deletions

23
internal/shim/payload.go Normal file
View File

@@ -0,0 +1,23 @@
package shim
import (
"git.ophivana.moe/cat/fortify/helper/bwrap"
)
const EnvShim = "FORTIFY_SHIM"
type Payload struct {
// child full argv
Argv []string
// env variables passed through to bwrap
Env []string
// bwrap, target full exec path
Exec [2]string
// bwrap config, nil for permissive
Bwrap *bwrap.Config
// whether to pas wayland fd
WL bool
// verbosity pass through
Verbose bool
}