This repository has been archived by the owner on Dec 13, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 317
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Small updates throughout based on feedback
Signed-off-by: Matthew Heon <[email protected]>
- Loading branch information
Showing
7 changed files
with
81 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// +build !linux !cgo !seccomp | ||
|
||
package seccomp | ||
|
||
// Seccomp not supported, do nothing | ||
func InitSeccomp(config *Config) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,48 @@ | ||
package seccomp | ||
|
||
// A condition on which to match a syscall | ||
// The condition is considered matched if the following boolean expression | ||
// is true: (Value of Syscall Argument) Operator ValueOne | ||
// As an example, using an operator of > and value of 2 would compare | ||
// whether the value of a syscall argument was greater than 2 | ||
type SyscallCondition struct { | ||
Argument uint `json:"argument"` | ||
// Which argument of the syscall to inspect. Valid values are 0-6 | ||
Argument uint `json:"argument"` | ||
|
||
// Operator to compare with | ||
// Valid values are <, <=, ==, >=, >, and |= (masked equality) | ||
Operator string `json:"operator"` | ||
|
||
// Value to compare given argument against | ||
ValueOne uint64 `json:"value_one"` | ||
|
||
// Presently only used in masked equality - mask of bits to compare | ||
ValueTwo uint64 `json:"value_two,omitempty"` | ||
} | ||
|
||
// An individual syscall to be blocked by Libseccomp | ||
type BlockedSyscall struct { | ||
Name string `json:"name,"` | ||
// Name of the syscall | ||
Name string `json:"name"` | ||
|
||
// Conditions on which to match the syscall. | ||
// Can be omitted for an unconditional match. | ||
Conditions []SyscallCondition `json:"conditions,omitempty"` | ||
} | ||
|
||
type SeccompConfig struct { | ||
Enable bool `json:"enable"` | ||
WhitelistToggle bool `json:"whitelist_toggle"` | ||
Architectures []string `json:"architectures,omitempty"` | ||
Syscalls []BlockedSyscall `json:"syscalls"` | ||
// Overall configuration for Seccomp support | ||
type Config struct { | ||
// Enable/disable toggle for Libseccomp | ||
Enable bool `json:"enable"` | ||
|
||
// Toggle whitelisting on. Default is blacklisting - deny given syscalls. | ||
// if set to true, this reverses this behavior - permit only the given syscalls | ||
WhitelistToggle bool `json:"whitelist_toggle"` | ||
|
||
// Additional architectures to support in the container. | ||
// The installed kernel's default architecture is always supported | ||
Architectures []string `json:"architectures,omitempty"` | ||
|
||
// A list of syscalls to deny (or permit, if WhitelistToggle is set) | ||
Syscalls []*BlockedSyscall `json:"syscalls"` | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters