github.com/portworx/docker@v1.12.1/profiles/seccomp/generate.go (about)

     1  // +build ignore
     2  
     3  package main
     4  
     5  import (
     6  	"encoding/json"
     7  	"io/ioutil"
     8  	"os"
     9  	"path/filepath"
    10  
    11  	"github.com/docker/docker/oci"
    12  	"github.com/docker/docker/profiles/seccomp"
    13  )
    14  
    15  // saves the default seccomp profile as a json file so people can use it as a
    16  // base for their own custom profiles
    17  func main() {
    18  	wd, err := os.Getwd()
    19  	if err != nil {
    20  		panic(err)
    21  	}
    22  	f := filepath.Join(wd, "default.json")
    23  
    24  	rs := oci.DefaultSpec()
    25  
    26  	// write the default profile to the file
    27  	b, err := json.MarshalIndent(seccomp.DefaultProfile(&rs), "", "\t")
    28  	if err != nil {
    29  		panic(err)
    30  	}
    31  
    32  	if err := ioutil.WriteFile(f, b, 0644); err != nil {
    33  		panic(err)
    34  	}
    35  }