aboutsummaryrefslogtreecommitdiffhomepage
path: root/main.go
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-11-02 03:03:44 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-11-02 03:13:57 +0900
commit584732f80ab91afb349720cfb8e9979ed2ba173e (patch)
tree8ef6ab9f8c9d3b8197682a53fb2c4a7b2ce8da55 /main.go
parent4b7b899bb35fb4ea218dabe49a674f4d2f80e7f8 (diff)
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 <cat@ophivana.moe>
Diffstat (limited to 'main.go')
-rw-r--r--main.go12
1 files changed, 3 insertions, 9 deletions
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")