Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set the Notary Signer to be non dumpable in Linux #1327

Merged
merged 1 commit into from
Apr 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions cmd/notary-signer/dump_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package main

import (
"golang.org/x/sys/unix"
)

func protect() error {
// Make sure process is not dumpable, so will not core dump, which would
// write keys to disk, and cannot be ptraced to read keys.
return unix.Prctl(unix.PR_SET_DUMPABLE, 0, 0, 0, 0)
}
7 changes: 7 additions & 0 deletions cmd/notary-signer/dump_unsupported.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// +build !linux

package main

func protect() error {
return nil
}
5 changes: 5 additions & 0 deletions cmd/notary-signer/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ func main() {

if flagStorage.debug {
go debugServer(debugAddr)
} else {
// If not in debug mode, stop tracing, core dumps if supported to help protect keys.
if err := protect(); err != nil {
logrus.Fatal(err.Error())
}
}

// when the signer starts print the version for debugging and issue logs later
Expand Down