UserNamespaces - Check whether user namespaces are enabled

This combiner reports whether user namespaces are enabled for the running system per the kernel command line, and if grub info is available, for which boot configurations they’re enabled.

The user namespaces feature was introduced in kernel version 3.8, first shipped in RHEL 7.x. It is built into the kernel, but requires an option to enable:

user_namespaces.enable=1

There are a few checks which are presently left to callers:
  • enabled() doesn’t check whether the kernel supports user namespaces, only that the command line argument to enable them is present.

  • There is currently no attempt to relate the current kernel to a grub entry, which may be useful to know, if e.g. grub configuration has been changed, but the system needs a reboot.

class insights.combiners.user_namespaces.UserNamespaces(cmdline, grub2)[source]

Bases: object

A combiner which determines if user namespaces are enabled.

enabled()[source]

Determine whether user namespaces are enabled or not.

Returns:

True if user namespaces are enabled, false if they aren’t, or if user namespaces aren’t supported by this kernel.

Return type:

bool

enabled_configs()[source]

Get boot configs for which user namespaces are enabled.

Returns:

A list of grub menu entries in which user namespaces are enabled. An empty list if user namespaces aren’t supported or grub data isn’t available.

Return type:

list