between independent processes. History: The Linux Namespaces originated in 2002 in the 2.4.19 kernel with work on the mount namespace. “What happens in namespace stays in namespace”
mount points seen by a group of processes • UTS: isolate domain and host name • IPC: isolate certain interprocess communication resources (semaphores, queues…) • PID: isolate the PID number space • Network: isolate network related system resources (network devices, ip, ports …) • User: isolate user and group ID number spaces • Cgroup: hides the identity of the control group of which process is a member
default namespace for each type, used by all processes. • Processes can create additional namespaces with the unshare command or as new flags in a clone syscall. • nsenter command can bu used to enter a namespace P.S. Google Chrome make use of namespaces to isolate its own processes which are at risk from attack on the internet.
allow processes to be organized into hierarchical groups whose usage of various types of resources can then be limited and monitored. History: cgroups are originally developed by Google and merged into the Linux kernel in 2008
time, system memory, network bandwidth, storage i/o or combinations of these resources — among processes (or threads) running on a system. In other words:
100 MB Prioritisation: Some groups may get a larger share of CPU utilization Accounting: Measure a group's resource usage Control: Stop, freeze or restart group of processes Group Profile 1 Group Profile • % 60 CPU • 5 GB Memory • %90 Network • % 70 blkio Applications • NGINX, postgresql, httpd…
check • Privileged processes (root) or unprivileged (non root users) • Root (UID 0) user is too powerful, dangerous • Other users have very restricted access (can’t open raw socket, load module etc..)
units, known as capabilities • They can be assigned to processes independently • Parent processes might pass capabilities to child • There are around 40 capabilities on current Linux kernel
file UIDs and GIDs • CAP_KILL: Bypass permission checks for sending signals • CAP_NET_RAW: Use RAW and PACKET sockets • CAP_SYS_BOOT: Use reboot P.S. The child process created by clone() with the CLONE_NEWUSER flag starts out with a complete set of capabilities in the new user namespace