1 module symmetry.linux.capabilities; 2 import core.sys.posix.sys.capabilities; 3 import core.sys.linux.sys.capability; 4 import symmetry.sildoc; 5 6 version(Posix): 7 8 9 enum LinuxCapability 10 { 11 12 @SILdoc("Enable and disable kernel auditing; change auditing filter rules; retrieve auditing status and filtering rules") 13 auditControl = CAP_AUDIT_CONTROL, 14 15 @SILdoc("Read records from kernel auditing log") 16 auditRead = CAP_AUDIT_READ, 17 18 @SILdoc("Write records to kernel auditing log") 19 auditWrite = CAP_AUDIT_WRITE, 20 21 @SILdoc("Employ features that can block system suspend (epoll(7) EPOLLWAKEUP, /proc/sys/wake_lock)") 22 blockSuspend = CAP_BLOCK_SUSPEND, 23 24 @SILdoc("Make arbitrary changes to file UIDs and GIDs (see chown(2))") 25 chown = CAP_CHOWN, 26 27 @SILdoc("Bypass file read, write, and execute permission checks") 28 discretionaryAccessControlOverride = CAP_DAC_OVERRIDE, 29 30 @SILdoc("Bypass file read permission checks and directory read and execute permission checks") 31 discretionaryAccessControlReadSearch = CAP_DAC_READ_SEARCH, 32 33 @SILdoc("Bypass permission checks on operations that normally require the file system UID of the process to match the UID of the file (e.g., chmod(2), utime(2)), excluding those operations covered by CAP_DAC_OVERRIDE and CAP_DAC_READ_SEARCH: 34 35 - set extended file attributes (see chattr(1)) on arbitrary files; 36 - set Access Control Lists (ACLs) on arbitrary files; 37 - ignore directory sticky bit on file deletion; 38 - specify O_NOATIME for arbitrary files in open(2) and fcntl(2)") 39 fOwner = CAP_FOWNER, 40 41 @SILdoc("Don't clear set-user-ID and set-group-ID permission bits when a file is modified; set the set-group-ID bit for a file whose GID does not match the file system or any of the supplementary GIDs of the calling process") 42 fSetID = CAP_FSETID, 43 44 @SILdoc("Lock memory (mlock(2), mlockall(2), mmap(2), shmctl(2))") 45 ipcLock = CAP_IPC_LOCK, 46 47 @SILdoc("Bypass permission checks for operations on System V IPC objects") 48 ipcOwner = CAP_IPC_OWNER, 49 50 @SILdoc("Bypass permission checks for sending signals (see kill(2)). This includes use of the ioctl(2) KDSIGACCEPT operation") 51 kill = CAP_KILL, 52 53 @SILdoc("Establish leases on arbitrary files (see fcntl(2))") 54 lease = CAP_LEASE, 55 56 @SILdoc("Set the FS_APPEND_FL and FS_IMMUTABLE_FL i-node flags (see chattr(1)).") 57 linuxImmutable = CAP_LINUX_IMMUTABLE, 58 59 @SILdoc("Override Mandatory Access Control (MAC). Implemented for the Smack Linux Security Module (LSM)") 60 macAdmin = CAP_MAC_ADMIN, 61 62 @SILdoc("Allow MAC configuration or state changes. Implemented for the Smack LSM.") 63 macOverride = CAP_MAC_OVERRIDE, 64 65 @SILdoc("Create special files using mknod(2)") 66 mknod = CAP_MKNOD, 67 68 @SILdoc("Perform various network-related operations: 69 - interface configuration; 70 - administration of IP firewall, masquerading, and accounting 71 - modify routing tables; 72 - bind to any address for transparent proxying; 73 - set type-of-service (TOS) 74 - clear driver statistics; 75 - set promiscuous mode; 76 - enabling multicasting; 77 - use setsockopt(2) to set the following socket options: SO_DEBUG, SO_MARK, SO_PRIORITY (for a priority outside the range 0 to 6), SO_RCVBUFFORCE, and SO_SNDBUFFORCE") 78 netAdmin = CAP_NET_ADMIN, 79 80 @SILdoc("Bind a socket to Internet domain privileged ports (port numbers less than 1024)") 81 netBindService = CAP_NET_BIND_SERVICE, 82 83 @SILdoc("(Unused) Make socket broadcasts, and listen to multicasts") 84 netBroadcast = CAP_NET_BROADCAST, 85 86 @SILdoc("use RAW and PACKET sockets; bind to any address for transparent proxying") 87 netRaw = CAP_NET_RAW, 88 89 @SILdoc("Make arbitrary manipulations of process GIDs and supplementary GID list; forge GID when passing socket credentials via UNIX domain sockets") 90 setGID = CAP_SETGID, 91 92 @SILdoc("Set file capabilities") 93 setFileCapabilities = CAP_SETFCAP, 94 95 @SILdoc("If file capabilities are not supported: grant or remove any capability in the caller's permitted capability set to or from any other process. (This property of CAP_SETPCAP is not available when the kernel is configured to support file capabilities, since CAP_SETPCAP has entirely different semantics for such kernels.) 96 If file capabilities are supported: add any capability from the calling thread's bounding set to its inheritable set; drop capabilities from the bounding set (via prctl(2) PR_CAPBSET_DROP); make changes to the securebits flags") 97 capSetProcessCapabilities = CAP_SETPCAP, 98 99 @SILdoc("Make arbitrary manipulations of process UIDs (setuid(2), setreuid(2), setresuid(2), setfsuid(2)); make forged UID when passing socket credentials via UNIX domain sockets") 100 setUID = CAP_SETUID, 101 102 @SILdoc("Perform a range of system administration operations including: quotactl(2), mount(2), umount(2), swapon(2), swapoff(2), sethostname(2), and setdomainname(2): 103 - perform privileged syslog(2) operations (since Linux 2.6.37, CAP_SYSLOG should be used to permit such operations); 104 - perform VM86_REQUEST_IRQ vm86(2) command; 105 - perform IPC_SET and IPC_RMID operations on arbitrary System V IPC objects; 106 - perform operations on trusted and security Extended Attributes (see attr(5)); 107 - use lookup_dcookie(2); 108 - use ioprio_set(2) to assign IOPRIO_CLASS_RT and (before Linux 2.6.25) IOPRIO_CLASS_IDLE I/O scheduling classes; 109 - forge UID when passing socket credentials; 110 - exceed /proc/sys/fs/file-max, the system-wide limit on the number of open files, in system calls that open files (e.g., accept(2), execve(2), open(2), pipe(2)); 111 - employ CLONE_* flags that create new namespaces with clone(2) and unshare(2); 112 - call perf_event_open(2); 113 - access privileged perf event information; 114 - call setns(2); 115 - call fanotify_init(2); 116 - perform KEYCTL_CHOWN and KEYCTL_SETPERM keyctl(2) operations; 117 - perform madvise(2) MADV_HWPOISON operation; 118 - employ the TIOCSTI ioctl(2) to insert characters into the input queue of a terminal other than the caller's controlling terminal. 119 - employ the obsolete nfsservctl(2) system call; 120 - employ the obsolete bdflush(2) system call; 121 - perform various privileged block-device ioctl(2) operations; 122 - perform various privileged file-system ioctl(2) operations; 123 - perform administrative operations on many device drivers.") 124 sysAdmin = CAP_SYS_ADMIN, 125 126 @SILdoc("Use reboot(2) and kexec_load(2)") 127 sysBoot = CAP_SYS_BOOT, 128 129 @SILdoc("Use chroot(2)") 130 chroot = CAP_SYS_CHROOT, 131 132 @SILdoc("Load and unload kernel modules (see init_module(2) and delete_module(2)); in kernels before 2.6.25: drop capabilities from the system-wide capability bounding set") 133 sysModule = CAP_SYS_MODULE, 134 135 @SILdoc("Raise process nice value (nice(2), setpriority(2)) and change the nice value for arbitrary processes; 136 - set real-time scheduling policies for calling process, and set scheduling policies and priorities for arbitrary processes (sched_setscheduler(2), sched_setparam(2)); 137 - set CPU affinity for arbitrary processes (sched_setaffinity(2)); 138 - set I/O scheduling class and priority for arbitrary processes (ioprio_set(2)); 139 - apply migrate_pages(2) to arbitrary processes and allow processes to be migrated to arbitrary nodes; 140 - apply move_pages(2) to arbitrary processes; 141 - use the MPOL_MF_MOVE_ALL flag with mbind(2) and move_pages(2).") 142 sysNice = CAP_SYS_NICE, 143 144 @SILdoc("Use Acct") 145 sysProcessAccount = CAP_SYS_PACCT, 146 147 @SILdoc("Trace arbitrary processes using ptrace(2); apply get_robust_list(2) to arbitrary processes; inspect processes using kcmp(2).") 148 ptrace = CAP_SYS_PTRACE, 149 150 @SILdoc("Perform I/O port operations (iopl(2) and ioperm(2)); 151 - access /proc/kcore; 152 - employ the FIBMAP ioctl(2) operation; 153 - open devices for accessing x86 model-specific registers (MSRs, see msr(4)) 154 - update /proc/sys/vm/mmap_min_addr; 155 - create memory mappings at addresses below the value specified by /proc/sys/vm/mmap_min_addr; 156 - map files in /proc/pci/bus; 157 - open /dev/mem and /dev/kmem; 158 - perform various SCSI device commands; 159 - perform certain operations on hpsa(4) and cciss(4) devices; 160 - perform a range of device-specific operations on other devices.") 161 162 sysRawIO = CAP_SYS_RAWIO, 163 164 @SILdoc("Use reserved space on ext2 file systems; 165 - make ioctl(2) calls controlling ext3 journaling; 166 - override disk quota limits; 167 - increase resource limits (see setrlimit(2)); 168 - override RLIMIT_NPROC resource limit; 169 - override maximum number of consoles on console allocation; 170 - override maximum number of keymaps; 171 - allow more than 64hz interrupts from the real-time clock; 172 - raise msg_qbytes limit for a System V message queue above the limit in /proc/sys/kernel/msgmnb (see msgop(2) and msgctl(2)); 173 - override the /proc/sys/fs/pipe-size-max limit when setting the capacity of a pipe using the F_SETPIPE_SZ fcntl(2) command. 174 - use F_SETPIPE_SZ to increase the capacity of a pipe above the limit specified by /proc/sys/fs/pipe-max-size; 175 - override /proc/sys/fs/mqueue/queues_max limit when creating POSIX message queues (see mq_overview(7)); 176 - employ prctl(2) PR_SET_MM operation; set 177 /proc/PID/oom_score_adj to a value lower than the value last set by a process with CAP_SYS_RESOURCE.") 178 sysResource = CAP_SYS_RESOURCE, 179 180 @SILdoc("Set system clock (settimeofday(2), stime(2), adjtimex(2)); set real-time (hardware) clock.") 181 sysTime = CAP_SYS_TIME, 182 183 @SILdoc("Use vhangup(2); employ various privileged ioctl(2) operations on virtual terminals") 184 sysTTYConfig = CAP_SYS_TTY_CONFIG, 185 186 @SILdoc("Perform privileged syslog(2) operations. See syslog(2) for information on which operations require privilege. 187 View kernel addresses exposed via /proc and other interfaces when /proc/sys/kernel/kptr_restrict has the value 1. (See the discussion of the kptr_restrict in proc(5).)") 188 sysLog = CAP_SYSLOG, 189 190 @SILdoc("Trigger something that will wake up the system (set CLOCK_REALTIME_ALARM and CLOCK_BOOTTIME_ALARM timers).") 191 wakeAlarm = CAP_WAKE_ALARM, 192 }