From 584732f80ab91afb349720cfb8e9979ed2ba173e Mon Sep 17 00:00:00 2001 From: Ophestra Umiker Date: Sat, 2 Nov 2024 03:03:44 +0900 Subject: cmd: shim and init into separate binaries This change also fixes a deadlock when shim fails to connect and complete the setup. Signed-off-by: Ophestra Umiker --- main.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'main.go') diff --git a/main.go b/main.go index 746a2335..4ffca317 100644 --- a/main.go +++ b/main.go @@ -4,11 +4,9 @@ import ( "flag" "syscall" - "git.ophivana.moe/security/fortify/internal" "git.ophivana.moe/security/fortify/internal/app" "git.ophivana.moe/security/fortify/internal/fmsg" - init0 "git.ophivana.moe/security/fortify/internal/init" - "git.ophivana.moe/security/fortify/internal/shim" + "git.ophivana.moe/security/fortify/internal/linux" ) var ( @@ -19,12 +17,12 @@ func init() { flag.BoolVar(&flagVerbose, "v", false, "Verbose output") } -var os = new(internal.Std) +var os = new(linux.Std) func main() { // linux/sched/coredump.h if _, _, errno := syscall.RawSyscall(syscall.SYS_PRCTL, syscall.PR_SET_DUMPABLE, 0, 0); errno != 0 { - fmsg.Printf("fortify: cannot set SUID_DUMP_DISABLE: %s", errno.Error()) + fmsg.Printf("cannot set SUID_DUMP_DISABLE: %s", errno.Error()) } flag.Parse() @@ -34,10 +32,6 @@ func main() { fmsg.VPrintln("system booted with systemd as init system") } - // shim/init early exit - init0.Try() - shim.Try() - // root check if os.Geteuid() == 0 { fmsg.Fatal("this program must not run as root") -- cgit v1.3.1