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:
parent
fa8f4aa539
commit
d57816de02
5 changed files with 1609 additions and 3 deletions
1567
profiles/seccomp/default.json
Executable file
1567
profiles/seccomp/default.json
Executable file
File diff suppressed because it is too large
Load diff
35
profiles/seccomp/generate.go
Normal file
35
profiles/seccomp/generate.go
Normal 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)
|
||||||
|
}
|
||||||
|
}
|
|
@ -11,9 +11,11 @@ import (
|
||||||
"github.com/opencontainers/runc/libcontainer/seccomp"
|
"github.com/opencontainers/runc/libcontainer/seccomp"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:generate go run -tags 'seccomp' generate.go
|
||||||
|
|
||||||
// GetDefaultProfile returns the default seccomp profile.
|
// GetDefaultProfile returns the default seccomp profile.
|
||||||
func GetDefaultProfile() *configs.Seccomp {
|
func GetDefaultProfile() *configs.Seccomp {
|
||||||
return defaultSeccompProfile
|
return defaultProfile
|
||||||
}
|
}
|
||||||
|
|
||||||
// LoadProfile takes a file path a decodes the seccomp profile.
|
// LoadProfile takes a file path a decodes the seccomp profile.
|
||||||
|
|
|
@ -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,
|
DefaultAction: configs.Errno,
|
||||||
Architectures: arches(),
|
Architectures: arches(),
|
||||||
Syscalls: []*configs.Syscall{
|
Syscalls: []*configs.Syscall{
|
||||||
|
|
|
@ -5,5 +5,6 @@ package seccomp
|
||||||
import "github.com/opencontainers/runc/libcontainer/configs"
|
import "github.com/opencontainers/runc/libcontainer/configs"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
defaultSeccompProfile *configs.Seccomp
|
// defaultProfile is a nil pointer on unsupported systems.
|
||||||
|
defaultProfile *configs.Seccomp
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue