implemented pledge and unveil

This commit is contained in:
ston1th 2023-12-21 14:30:04 +01:00
commit 37ecf9a192
3 changed files with 39 additions and 0 deletions

View file

@ -12,6 +12,7 @@ import (
"syscall"
"time"
"git.giftfish.de/ston1th/godrop/v2"
"git.giftfish.de/ston1th/keyctl/pkg/api"
"git.giftfish.de/ston1th/keyctl/pkg/cli"
"git.giftfish.de/ston1th/keyctl/pkg/db"
@ -71,10 +72,16 @@ func server() {
log = klogr.New().WithName("main")
log.Info("starting keyctl", "version", version)
err := godrop.PledgePromises("stdio rpath wpath cpath inet fattr flock unix unveil")
if err != nil {
klog.Fatalf("init failed: %s", err)
}
dbstore, err := db.New(klogr.New().WithName("db"), path)
if err != nil {
klog.Fatalf("init failed: %s", err)
}
srv, err := api.NewServer(klogr.New().WithName("srv"), listen, filepath.Join(path, socket), dbstore)
if err != nil {
klog.Fatalf("init failed: %s", err)