Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
bubblewrap: check for max_user_namespaces == 0
This change prevents bubblewrap to use userns when the
max_user_namespaces is set to 0.

Closes: #216

Closes: #215
Approved by: cgwalters
  • Loading branch information
TristanCacqueray authored and rh-atomic-bot committed Sep 18, 2017
1 parent 8ee3ca5 commit ec5093d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions bubblewrap.c
Expand Up @@ -1988,6 +1988,15 @@ main (int argc,
disabled = TRUE;
}

/* Check for max_user_namespaces */
if (stat ("/proc/sys/user/max_user_namespaces", &sbuf) == 0)
{
cleanup_free char *max_user_ns = NULL;
max_user_ns = load_file_at (AT_FDCWD, "/proc/sys/user/max_user_namespaces");
if (max_user_ns != NULL && strcmp(max_user_ns, "0\n") == 0)
disabled = TRUE;
}

/* Debian lets you disable *unprivileged* user namespaces. However this is not
a problem if we're privileged, and if we're not opt_unshare_user is TRUE
already, and there is not much we can do, its just a non-working setup. */
Expand Down

0 comments on commit ec5093d

Please sign in to comment.