1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00

add default seccomp profile as json

profile is created by go generate

Signed-off-by: Jessica Frazelle <acidburn@docker.com>
This commit is contained in:
Jessica Frazelle 2016-02-08 08:19:21 -08:00
parent fa8f4aa539
commit d57816de02
No known key found for this signature in database
GPG key ID: 18F3685C0022BFF3
5 changed files with 1609 additions and 3 deletions

1567
profiles/seccomp/default.json Executable file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,35 @@
// +build ignore
package main
import (
"encoding/json"
"io/ioutil"
"os"
"path/filepath"
"github.com/docker/docker/profiles/seccomp"
)
// saves the default seccomp profile as a json file so people can use it as a
// base for their own custom profiles
func main() {
wd, err := os.Getwd()
if err != nil {
panic(err)
}
f := filepath.Join(wd, "default.json")
// get the default profile
p := seccomp.GetDefaultProfile()
// write the default profile to the file
b, err := json.MarshalIndent(p, "", "\t")
if err != nil {
panic(err)
}
if err := ioutil.WriteFile(f, b, 0755); err != nil {
panic(err)
}
}

View file

@ -11,9 +11,11 @@ import (
"github.com/opencontainers/runc/libcontainer/seccomp"
)
//go:generate go run -tags 'seccomp' generate.go
// GetDefaultProfile returns the default seccomp profile.
func GetDefaultProfile() *configs.Seccomp {
return defaultSeccompProfile
return defaultProfile
}
// LoadProfile takes a file path a decodes the seccomp profile.

View file

@ -33,7 +33,8 @@ func arches() []string {
}
}
var defaultSeccompProfile = &configs.Seccomp{
// defaultProfile defines the whitelist for the default seccomp profile.
var defaultProfile = &configs.Seccomp{
DefaultAction: configs.Errno,
Architectures: arches(),
Syscalls: []*configs.Syscall{

View file

@ -5,5 +5,6 @@ package seccomp
import "github.com/opencontainers/runc/libcontainer/configs"
var (
defaultSeccompProfile *configs.Seccomp
// defaultProfile is a nil pointer on unsupported systems.
defaultProfile *configs.Seccomp
)