Add seccomp configuration params to the Oz profile specification/parser

master
dma 10 years ago
parent 7fca7e3cfc
commit a44a8ae679

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"io/ioutil" "io/ioutil"
"path" "path"
"strings"
"github.com/subgraph/oz/network" "github.com/subgraph/oz/network"
) )
@ -42,9 +43,12 @@ type Profile struct {
Environment []EnvVar Environment []EnvVar
// Networking // Networking
Networking NetworkProfile Networking NetworkProfile
// Seccomp
Seccomp SeccompConf
} }
type AudioMode string type AudioMode string
const ( const (
PROFILE_AUDIO_NONE AudioMode = "none" PROFILE_AUDIO_NONE AudioMode = "none"
PROFILE_AUDIO_SPEAKER AudioMode = "speaker" PROFILE_AUDIO_SPEAKER AudioMode = "speaker"
@ -53,15 +57,22 @@ const (
type XServerConf struct { type XServerConf struct {
Enabled bool Enabled bool
TrayIcon string `json:"tray_icon"` TrayIcon string `json:"tray_icon"`
WindowIcon string `json:"window_icon"` WindowIcon string `json:"window_icon"`
EnableTray bool `json:"enable_tray"` EnableTray bool `json:"enable_tray"`
EnableNotifications bool `json:"enable_notifications"` EnableNotifications bool `json:"enable_notifications"`
UsePulseAudio bool `json:"use_pulse_audio"` UsePulseAudio bool `json:"use_pulse_audio"`
DisableClipboard bool `json:"disable_clipboard"` DisableClipboard bool `json:"disable_clipboard"`
AudioMode AudioMode `json:"audio_mode"` AudioMode AudioMode `json:"audio_mode"`
} }
type SeccompConf struct {
Mode string
Enforce bool
Seccomp_Whitelist string
Seccomp_Blacklist string
}
type WhitelistItem struct { type WhitelistItem struct {
Path string Path string
ReadOnly bool `json:"read_only"` ReadOnly bool `json:"read_only"`
@ -157,11 +168,14 @@ func LoadProfiles(dir string) (Profiles, error) {
for _, f := range fs { for _, f := range fs {
if !f.IsDir() { if !f.IsDir() {
name := path.Join(dir, f.Name()) name := path.Join(dir, f.Name())
p, err := loadProfileFile(name) if strings.Contains(f.Name(), ".json") {
if err != nil {
return nil, fmt.Errorf("error loading '%s': %v", f.Name(), err) p, err := loadProfileFile(name)
if err != nil {
return nil, fmt.Errorf("error loading '%s': %v", f.Name(), err)
}
ps = append(ps, p)
} }
ps = append(ps, p)
} }
} }

Loading…
Cancel
Save