switch to suah.dev/protect

This commit is contained in:
Aaron Bieber 2020-05-08 16:47:44 -06:00
parent c73821a3b3
commit eca991022d
5 changed files with 20 additions and 49 deletions

8
go.mod
View File

@ -1,9 +1,9 @@
module suah.dev/gavin
go 1.13
go 1.14
require (
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
golang.org/x/net v0.0.0-20191105084925-a882066a44e0
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f
suah.dev/protect v0.0.0-20200508135532-408f86d55f26
)

15
go.sum
View File

@ -1,7 +1,14 @@
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/net v0.0.0-20191105084925-a882066a44e0 h1:QPlSTtPE2k6PZPasQUbzuK3p9JbS+vMXYVto8g/yrsg=
golang.org/x/net v0.0.0-20191105084925-a882066a44e0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79 h1:IaQbIIB2X/Mp/DKctl6ROxz1KyMlKp4uyvL6+kQ7C88=
golang.org/x/crypto v0.0.0-20200429183012-4b2356b1ed79/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f h1:QBjCr1Fz5kw158VqdE9JfI9cJnl/ymnJWAdMuinqL7Y=
golang.org/x/net v0.0.0-20200506145744-7e3656a0809f/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3 h1:5B6i6EAiSYyejWfvc5Rc9BbI3rzIsrrXfAQBWnYfn+w=
golang.org/x/sys v0.0.0-20200501145240-bc7a7d42d5c3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
suah.dev/protect v0.0.0-20200508135532-408f86d55f26 h1:trB+FkW4IPwmiON5ipshh3y/7imr0Y+KRP1PRIne5k0=
suah.dev/protect v0.0.0-20200508135532-408f86d55f26/go.mod h1:ZSgyBM30JUwhVPWJzVHh0jlu5W6Qz1VR6tIhAzqJZ9Y=

10
main.go
View File

@ -13,7 +13,7 @@ import (
"golang.org/x/crypto/bcrypt"
"golang.org/x/net/webdav"
"suah.dev/gavin/pu"
"suah.dev/protect"
)
var (
@ -40,10 +40,10 @@ func init() {
flag.Parse()
// These are OpenBSD specific protections used to prevent un-necesary file access.
pu.Unveil(staticDir, "r")
pu.Unveil(passPath, "r")
pu.Unveil(davDir, "rwc")
err = pu.UnveilBlock()
protect.Unveil(staticDir, "r")
protect.Unveil(passPath, "r")
protect.Unveil(davDir, "rwc")
err = protect.UnveilBlock()
if err != nil {
log.Fatal(err)
}

View File

@ -1,17 +0,0 @@
// +build !openbsd
package pu
import "fmt"
func Pledge(promisess string) {
return nil
}
func Unveil(path string, perms string) {
return nil
}
func UnveilBlock() error {
return nil
}

View File

@ -1,19 +0,0 @@
// +build openbsd
package pu
import (
"golang.org/x/sys/unix"
)
func Pledge(promises string) {
unix.PledgePromises(promises)
}
func Unveil(path string, perms string) {
unix.Unveil(path, perms)
}
func UnveilBlock() error {
return unix.UnveilBlock()
}