Skip to content

Commit 2355151

Browse files
committed
Add check for RHEL7/CentOS7 experimental userns disabled
Add a check in `check-config.sh` to see if we are running on a RHEL7 or CentOS7 system, which may report that CONFIG_USERNS is OK/enabled, but user namespaces still won't work because of the experimental feature flag added by Redhat. This will add a warning if it is actually disabled and notes what has to be added to the grub/boot command line to enable it. Docker-DCO-1.1-Signed-off-by: Phil Estes <[email protected]> (github: estesp)
1 parent 2ed1806 commit 2355151

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

contrib/check-config.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,17 @@ check_device() {
115115
fi
116116
}
117117

118+
check_distro_userns() {
119+
source /etc/os-release 2>/dev/null || /bin/true
120+
if [[ "${ID}" =~ ^(centos|rhel)$ && "${VERSION_ID}" =~ ^7 ]]; then
121+
# this is a CentOS7 or RHEL7 system
122+
grep -q "user_namespace.enable=1" /proc/cmdline || {
123+
# no user namespace support enabled
124+
wrap_bad " (RHEL7/CentOS7" "User namespaces disabled; add 'user_namespace.enable=1' to boot command line)"
125+
}
126+
fi
127+
}
128+
118129
if [ ! -e "$CONFIG" ]; then
119130
wrap_warning "warning: $CONFIG does not exist, searching other paths for kernel config ..."
120131
for tryConfig in "${possibleConfigs[@]}"; do
@@ -185,6 +196,7 @@ echo
185196
echo 'Optional Features:'
186197
{
187198
check_flags USER_NS
199+
check_distro_userns
188200
}
189201
{
190202
check_flags SECCOMP

0 commit comments

Comments
 (0)