Browse code

Merge pull request #27840 from estesp/add-userns-status-to-info

Add "userns" to `docker info` security options output

Vincent Demeester authored on 2016/10/29 09:58:34
Showing 4 changed files
... ...
@@ -78,6 +78,10 @@ func (daemon *Daemon) SystemInfo() (*types.Info, error) {
78 78
 	if selinuxEnabled() {
79 79
 		securityOptions = append(securityOptions, "selinux")
80 80
 	}
81
+	uid, gid := daemon.GetRemappedUIDGID()
82
+	if uid != 0 || gid != 0 {
83
+		securityOptions = append(securityOptions, "userns")
84
+	}
81 85
 
82 86
 	v := &types.Info{
83 87
 		ID:                 daemon.ID,
... ...
@@ -161,7 +161,7 @@ This section lists each version from latest to oldest.  Each listing includes a
161 161
 * `POST /networks/prune` prunes unused networks.
162 162
 * Every API response now includes a `Docker-Experimental` header specifying if experimental features are enabled (value can be `true` or `false`).
163 163
 * The `hostConfig` option now accepts the fields `CpuRealtimePeriod` and `CpuRtRuntime` to allocate cpu runtime to rt tasks when `CONFIG_RT_GROUP_SCHED` is enabled in the kernel.
164
-
164
+* The `SecurityOptions` field within the `GET /info` response now includes `userns` if user namespaces are enabled in the daemon.
165 165
 
166 166
 ### v1.24 API changes
167 167
 
... ...
@@ -2507,7 +2507,8 @@ Display system-wide information
2507 2507
         "SecurityOptions": [
2508 2508
             "apparmor",
2509 2509
             "seccomp",
2510
-            "selinux"
2510
+            "selinux",
2511
+            "userns"
2511 2512
         ],
2512 2513
         "ServerVersion": "1.9.0",
2513 2514
         "SwapLimit": false,
... ...
@@ -986,6 +986,11 @@ If you have a group that doesn't match the username, you may provide the `gid`
986 986
 or group name as well; otherwise the username will be used as the group name
987 987
 when querying the system for the subordinate group ID range.
988 988
 
989
+The output of `docker info` can be used to determine if the daemon is running
990
+with user namespaces enabled or not. If the daemon is configured with user
991
+namespaces, the Security Options entry in the response will list "userns" as
992
+one of the enabled security features.
993
+
989 994
 ### Detailed information on `subuid`/`subgid` ranges
990 995
 
991 996
 Given potential advanced use of the subordinate ID ranges by power users, the