diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-03-13 21:57:54 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-03-13 21:57:54 +0900 |
| commit | 4133b555ba8dd38accb272d86c01898ac4b99f95 (patch) | |
| tree | eb759ced154d8e35dd8ea85e4c58f027488ba793 /internal/app | |
| parent | 9b1a60b5c9f7a92abb632639117d61c5cbaf74f7 (diff) | |
internal/app: rename init to init0
This makes way for the new container init.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app')
| -rw-r--r-- | internal/app/app_nixos_test.go | 2 | ||||
| -rw-r--r-- | internal/app/app_pd_test.go | 4 | ||||
| -rw-r--r-- | internal/app/init0/early.go (renamed from internal/app/init/early.go) | 4 | ||||
| -rw-r--r-- | internal/app/init0/main.go (renamed from internal/app/init/main.go) | 2 | ||||
| -rw-r--r-- | internal/app/init0/payload.go (renamed from internal/app/init/payload.go) | 0 | ||||
| -rw-r--r-- | internal/app/seal.go | 2 | ||||
| -rw-r--r-- | internal/app/shim/main.go | 4 |
7 files changed, 9 insertions, 9 deletions
diff --git a/internal/app/app_nixos_test.go b/internal/app/app_nixos_test.go index 7ebd32e9..683b179a 100644 --- a/internal/app/app_nixos_test.go +++ b/internal/app/app_nixos_test.go @@ -218,6 +218,6 @@ var testCasesNixos = []sealTestCase{ Bind("/tmp/fortify.1971/8e2c76b066dabe574cf073bdb46eb5c1/system_bus_socket", "/run/dbus/system_bus_socket"). Tmpfs("/var/run/nscd", 8192). Bind("/run/wrappers/bin/fortify", "/.fortify/sbin/fortify"). - Symlink("fortify", "/.fortify/sbin/init"), + Symlink("fortify", "/.fortify/sbin/init0"), }, } diff --git a/internal/app/app_pd_test.go b/internal/app/app_pd_test.go index 2a03d356..602965ce 100644 --- a/internal/app/app_pd_test.go +++ b/internal/app/app_pd_test.go @@ -158,7 +158,7 @@ var testCasesPd = []sealTestCase{ CopyBind("/etc/group", []byte("fortify:x:65534:\n")). Tmpfs("/var/run/nscd", 8192). Bind("/run/wrappers/bin/fortify", "/.fortify/sbin/fortify"). - Symlink("fortify", "/.fortify/sbin/init"), + Symlink("fortify", "/.fortify/sbin/init0"), }, { "nixos permissive defaults chromium", new(stubNixOS), @@ -389,6 +389,6 @@ var testCasesPd = []sealTestCase{ Bind("/tmp/fortify.1971/ebf083d1b175911782d413369b64ce7c/system_bus_socket", "/run/dbus/system_bus_socket"). Tmpfs("/var/run/nscd", 8192). Bind("/run/wrappers/bin/fortify", "/.fortify/sbin/fortify"). - Symlink("fortify", "/.fortify/sbin/init"), + Symlink("fortify", "/.fortify/sbin/init0"), }, } diff --git a/internal/app/init/early.go b/internal/app/init0/early.go index ac2fedbf..0bcf094c 100644 --- a/internal/app/init/early.go +++ b/internal/app/init0/early.go @@ -9,9 +9,9 @@ import ( // used by the parent process -// TryArgv0 calls [Main] if argv0 indicates the process is started from a file named "init". +// TryArgv0 calls [Main] if the last element of argv0 is "init0". func TryArgv0() { - if len(os.Args) > 0 && path.Base(os.Args[0]) == "init" { + if len(os.Args) > 0 && path.Base(os.Args[0]) == "init0" { Main() internal.Exit(0) } diff --git a/internal/app/init/main.go b/internal/app/init0/main.go index 6fa22939..fe2f9aef 100644 --- a/internal/app/init/main.go +++ b/internal/app/init0/main.go @@ -25,7 +25,7 @@ const ( func Main() { // sharing stdout with shim // USE WITH CAUTION - fmsg.Prepare("init") + fmsg.Prepare("init0") // setting this prevents ptrace if err := internal.SetDumpable(internal.SUID_DUMP_DISABLE); err != nil { diff --git a/internal/app/init/payload.go b/internal/app/init0/payload.go index d1dc9ec3..d1dc9ec3 100644 --- a/internal/app/init/payload.go +++ b/internal/app/init0/payload.go diff --git a/internal/app/seal.go b/internal/app/seal.go index b133b466..7c4ba4b7 100644 --- a/internal/app/seal.go +++ b/internal/app/seal.go @@ -486,7 +486,7 @@ func (seal *outcome) finalise(sys sys.State, config *fst.Config) error { // mount fortify in sandbox for init seal.container.Bind(sys.MustExecutable(), path.Join(fst.Tmp, "sbin/fortify")) - seal.container.Symlink("fortify", path.Join(fst.Tmp, "sbin/init")) + seal.container.Symlink("fortify", path.Join(fst.Tmp, "sbin/init0")) fmsg.Verbosef("created application seal for uid %s (%s) groups: %v, command: %s", seal.user.uid, seal.user.username, config.Confinement.Groups, config.Command) diff --git a/internal/app/shim/main.go b/internal/app/shim/main.go index ed1cb980..360c89b7 100644 --- a/internal/app/shim/main.go +++ b/internal/app/shim/main.go @@ -16,7 +16,7 @@ import ( "git.gensokyo.uk/security/fortify/helper/proc" "git.gensokyo.uk/security/fortify/helper/seccomp" "git.gensokyo.uk/security/fortify/internal" - init0 "git.gensokyo.uk/security/fortify/internal/app/init" + "git.gensokyo.uk/security/fortify/internal/app/init0" "git.gensokyo.uk/security/fortify/internal/fmsg" ) @@ -125,7 +125,7 @@ func Main() { seccomp.CPrintln = log.Println } if b, err := helper.NewBwrap( - conf, path.Join(fst.Tmp, "sbin/init"), false, + conf, path.Join(fst.Tmp, "sbin/init0"), false, nil, func(int, int) []string { return make([]string, 0) }, extraFiles, syncFd, |
