This pull request added a `SecurityOptions` field in the `GET /info`
output to show if there is `apparmor`, `seccomp`, or `selinux` suport.
The API changes are updated in the documentation and the update in
`GET /info` is covered by the test case in `TestInfoApi`.
This pull request fixes #20909.
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
| ... | ... |
@@ -67,6 +67,17 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
| 67 | 67 |
} |
| 68 | 68 |
}) |
| 69 | 69 |
|
| 70 |
+ var securityOptions []string |
|
| 71 |
+ if sysInfo.AppArmor {
|
|
| 72 |
+ securityOptions = append(securityOptions, "apparmor") |
|
| 73 |
+ } |
|
| 74 |
+ if sysInfo.Seccomp {
|
|
| 75 |
+ securityOptions = append(securityOptions, "seccomp") |
|
| 76 |
+ } |
|
| 77 |
+ if selinuxEnabled() {
|
|
| 78 |
+ securityOptions = append(securityOptions, "selinux") |
|
| 79 |
+ } |
|
| 80 |
+ |
|
| 70 | 81 |
v := &types.Info{
|
| 71 | 82 |
ID: daemon.ID, |
| 72 | 83 |
Containers: int(cRunning + cPaused + cStopped), |
| ... | ... |
@@ -104,6 +115,7 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
|
| 104 | 104 |
HTTPProxy: sockets.GetProxyEnv("http_proxy"),
|
| 105 | 105 |
HTTPSProxy: sockets.GetProxyEnv("https_proxy"),
|
| 106 | 106 |
NoProxy: sockets.GetProxyEnv("no_proxy"),
|
| 107 |
+ SecurityOptions: securityOptions, |
|
| 107 | 108 |
} |
| 108 | 109 |
|
| 109 | 110 |
// TODO Windows. Refactor this more once sysinfo is refactored into |
| ... | ... |
@@ -117,6 +117,7 @@ This section lists each version from latest to oldest. Each listing includes a |
| 117 | 117 |
[Docker Remote API v1.24](docker_remote_api_v1.24.md) documentation |
| 118 | 118 |
|
| 119 | 119 |
* `POST /containers/create` now takes `StorageOpt` field. |
| 120 |
+* `GET /info` now returns `SecurityOptions` field, showing if `apparmor`, `seccomp`, or `selinux` is supported. |
|
| 120 | 121 |
|
| 121 | 122 |
### v1.23 API changes |
| 122 | 123 |
|
| ... | ... |
@@ -2239,6 +2239,11 @@ Display system-wide information |
| 2239 | 2239 |
"127.0.0.0/8" |
| 2240 | 2240 |
] |
| 2241 | 2241 |
}, |
| 2242 |
+ "SecurityOptions": [ |
|
| 2243 |
+ "apparmor", |
|
| 2244 |
+ "seccomp", |
|
| 2245 |
+ "selinux" |
|
| 2246 |
+ ], |
|
| 2242 | 2247 |
"ServerVersion": "1.9.0", |
| 2243 | 2248 |
"SwapLimit": false, |
| 2244 | 2249 |
"SystemStatus": [["State", "Healthy"]], |