From aa6e22ff3910274e7e85c6d1c0cae05c4e3c07d3 Mon Sep 17 00:00:00 2001 From: Aaron Bieber Date: Sun, 2 Feb 2020 11:13:43 -0700 Subject: [PATCH] add protect and enable unveil on openbsd --- go.mod | 2 +- go.sum | 1 + main.go | 18 ++++++++++++------ 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/go.mod b/go.mod index 9d3eaa1..bbc7c41 100644 --- a/go.mod +++ b/go.mod @@ -7,5 +7,5 @@ require ( go.etcd.io/bbolt v1.3.3 golang.org/x/crypto v0.0.0-20200128174031-69ecbb4d6d5d golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 - golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9 // indirect + golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9 ) diff --git a/go.sum b/go.sum index 5403a80..bb6805d 100644 --- a/go.sum +++ b/go.sum @@ -11,4 +11,5 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9 h1:1/DFK4b7JH8DmkqhUk48onnSfrPzImPoVxuomtbT2nk= golang.org/x/sys v0.0.0-20200124204421-9fbb57f87de9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/main.go b/main.go index a3cb780..ed1d3e3 100644 --- a/main.go +++ b/main.go @@ -32,20 +32,26 @@ func sendMessage(c *gomatrix.Client, roomID, message string) error { } func main() { - var store, err = NewStore("mcchunkie.db") - if err != nil { - log.Fatalf("%s\n", err) - } - - var username, password, userID, accessToken, server string + var username, password, userID, accessToken, server, db string var setup bool flag.StringVar(&username, "user", "", "username to connect to matrix server with") flag.StringVar(&server, "server", "", "matrix server") flag.BoolVar(&setup, "s", false, "setup account") + flag.StringVar(&db, "db", "mcchunkie.db", "full path to database file") flag.Parse() + unveil("/etc/resolv.conf", "r") + unveil("/etc/ssl/cert.pem", "r") + unveil(db, "rwc") + unveilBlock() + + var store, err = NewStore(db) + if err != nil { + log.Fatalf("%s\n", err) + } + if server == "" { server, err = store.get("config", "server") if server == "" {