Skip to content

Commit d32cd94

Browse files
committed
Merge pull request #89 from mrunalp/security
Add security section
2 parents cb928bb + 63d3d27 commit d32cd94

File tree

2 files changed

+68
-3
lines changed

2 files changed

+68
-3
lines changed

config-linux.md

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ the container. For more information, see the [kernel cgroups documentation](http
143143
## Linux capabilities
144144

145145
Capabilities is an array that specifies Linux capabilities that can be provided to the process
146-
inside the container. Valid values are the string after `CAP_` for capabilities defined
146+
inside the container. Valid values are the string after `CAP_` for capabilities defined
147147
in [the man page](http://man7.org/linux/man-pages/man7/capabilities.7.html)
148148

149149
```json
@@ -208,7 +208,39 @@ rootfsPropagation sets the rootfs's mount propagation. Its value is either slave
208208
"rootfsPropagation": "slave",
209209
```
210210

211-
## Security
211+
## Selinux process label
212212

213-
**TODO:** security profiles
213+
Selinux process label specifies the label with which the processes in a container are run.
214+
For more information about SELinux, see [Selinux documentation](http://selinuxproject.org/page/Main_Page)
215+
```json
216+
"selinuxProcessLabel": "system_u:system_r:svirt_lxc_net_t:s0:c124,c675"
217+
```
218+
219+
## Apparmor profile
220+
221+
Apparmor profile specifies the name of the apparmor profile that will be used for the container.
222+
For more information about Apparmor, see [Apparmor documentation](https://wiki.ubuntu.com/AppArmor)
223+
224+
```json
225+
"apparmorProfile": "acme_secure_profile"
226+
```
227+
228+
## Seccomp
229+
230+
Seccomp provides application sandboxing mechanism in the Linux kernel.
231+
Seccomp configuration allows one to configure actions to take for matched syscalls and furthermore also allows
232+
matching on values passed as arguments to syscalls.
233+
For more information about Seccomp, see [Seccomp kernel documentation](https://www.kernel.org/doc/Documentation/prctl/seccomp_filter.txt)
234+
The actions and operators are strings that match the definitions in seccomp.h from [libseccomp](https://github.com/seccomp/libseccomp) and are translated to corresponding values.
214235

236+
```json
237+
"seccomp": {
238+
"defaultAction": "SCMP_ACT_ALLOW",
239+
"syscalls": [
240+
{
241+
"name": "getcwd",
242+
"action": "SCMP_ACT_ERRNO"
243+
}
244+
]
245+
}
246+
```

spec_linux.go

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ type Linux struct {
3030
Capabilities []string `json:"capabilities"`
3131
// Devices are a list of device nodes that are created and enabled for the container
3232
Devices []Device `json:"devices"`
33+
// ApparmorProfile specified the apparmor profile for the container.
34+
ApparmorProfile string `json:"apparmorProfile"`
35+
// SelinuxProcessLabel specifies the selinux context that the container process is run as.
36+
SelinuxProcessLabel string `json:"selinuxProcessLabel"`
37+
// Seccomp specifies the seccomp security settings for the container.
38+
Seccomp Seccomp `json:"seccomp"`
3339
// RootfsPropagation is the rootfs mount propagation mode for the container
3440
RootfsPropagation string `json:"rootfsPropagation"`
3541
}
@@ -178,3 +184,30 @@ type Device struct {
178184
// Gid of the device.
179185
GID uint32 `json:"gid"`
180186
}
187+
188+
// Seccomp represents syscall restrictions
189+
type Seccomp struct {
190+
DefaultAction Action `json:"defaultAction"`
191+
Syscalls []*Syscall `json:"syscalls"`
192+
}
193+
194+
// Action taken upon Seccomp rule match
195+
type Action string
196+
197+
// Operator used to match syscall arguments in Seccomp
198+
type Operator string
199+
200+
// Arg used for matching specific syscall arguments in Seccomp
201+
type Arg struct {
202+
Index uint `json:"index"`
203+
Value uint64 `json:"value"`
204+
ValueTwo uint64 `json:"valueTwo"`
205+
Op Operator `json:"op"`
206+
}
207+
208+
// Syscall is used to match a syscall in Seccomp
209+
type Syscall struct {
210+
Name string `json:"name"`
211+
Action Action `json:"action"`
212+
Args []*Arg `json:"args"`
213+
}

0 commit comments

Comments
 (0)