Disable prctl dumpable protection under delve debugging
This commit is contained in:
parent
cf9f3f33dd
commit
761fb91a8a
3 changed files with 18 additions and 1 deletions
6
agent/processsecurity/isdelve/isdelve.go
Normal file
6
agent/processsecurity/isdelve/isdelve.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
//go:build delve
|
||||
// +build delve
|
||||
|
||||
package isdelve
|
||||
|
||||
const Enabled = true
|
||||
6
agent/processsecurity/isdelve/nodelve.go
Normal file
6
agent/processsecurity/isdelve/nodelve.go
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
//go:build !delve
|
||||
// +build !delve
|
||||
|
||||
package isdelve
|
||||
|
||||
const Enabled = false
|
||||
|
|
@ -6,13 +6,18 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/godbus/dbus/v5"
|
||||
"github.com/quexten/goldwarden/agent/processsecurity/isdelve"
|
||||
"golang.org/x/sys/unix"
|
||||
)
|
||||
|
||||
const IDLE_TIME = 60 * 15
|
||||
|
||||
func DisableDumpable() error {
|
||||
return unix.Prctl(unix.PR_SET_DUMPABLE, 0, 0, 0, 0)
|
||||
if isdelve.Enabled {
|
||||
return nil
|
||||
} else {
|
||||
return unix.Prctl(unix.PR_SET_DUMPABLE, 0, 0, 0, 0)
|
||||
}
|
||||
}
|
||||
|
||||
func MonitorLocks(onlock func()) error {
|
||||
|
|
|
|||
Loading…
Reference in a new issue