Declare OpenBSD pledge(2) (#5)

This commit is contained in:
Maxim Baz
2018-04-12 23:37:59 +02:00
committed by GitHub
parent 90ca691ac9
commit b0f774585c
4 changed files with 27 additions and 6 deletions

14
main.go
View File

@@ -2,8 +2,10 @@ package main
import (
"flag"
"fmt"
"os"
"github.com/maximbaz/browserpass-native/openbsd"
log "github.com/sirupsen/logrus"
)
@@ -17,16 +19,18 @@ func main() {
flag.BoolVar(&version, "version", false, "print version and exit")
flag.Parse()
if version {
fmt.Println("Browserpass host app version:", VERSION)
os.Exit(0)
}
openbsd.Pledge("stdio rpath proc exec")
log.SetFormatter(&log.TextFormatter{FullTimestamp: true})
if verbose {
log.SetLevel(log.DebugLevel)
}
if version {
log.Info("Browserpass host app version: ", VERSION)
os.Exit(0)
}
log.Debugf("Starting browserpass host app v%v", VERSION)
process()
}