1164032Srwatson/*- 2164032Srwatson * Copyright (c) 2006 nCircle Network Security, Inc. 3164032Srwatson * All rights reserved. 4164032Srwatson * 5164032Srwatson * This software was developed by Robert N. M. Watson for the TrustedBSD 6164032Srwatson * Project under contract to nCircle Network Security, Inc. 7164032Srwatson * 8164032Srwatson * Redistribution and use in source and binary forms, with or without 9164032Srwatson * modification, are permitted provided that the following conditions 10164032Srwatson * are met: 11164032Srwatson * 1. Redistributions of source code must retain the above copyright 12164032Srwatson * notice, this list of conditions and the following disclaimer. 13164032Srwatson * 2. Redistributions in binary form must reproduce the above copyright 14164032Srwatson * notice, this list of conditions and the following disclaimer in the 15164032Srwatson * documentation and/or other materials provided with the distribution. 16164032Srwatson * 17164032Srwatson * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 18164032Srwatson * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19164032Srwatson * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20164032Srwatson * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR, NCIRCLE NETWORK SECURITY, 21164032Srwatson * INC., OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22164032Srwatson * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 23164032Srwatson * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 24164032Srwatson * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 25164032Srwatson * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 26164032Srwatson * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 27164032Srwatson * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28164032Srwatson * 29164032Srwatson * $FreeBSD$ 30164032Srwatson */ 31164032Srwatson 32164032Srwatson/* 33164032Srwatson * Privilege checking interface for BSD kernel. 34164032Srwatson */ 35164032Srwatson#ifndef _SYS_PRIV_H_ 36164032Srwatson#define _SYS_PRIV_H_ 37164032Srwatson 38164032Srwatson/* 39170916Srwatson * Privilege list, sorted loosely by kernel subsystem. 40164032Srwatson * 41164032Srwatson * Think carefully before adding or reusing one of these privileges -- are 42164032Srwatson * there existing instances referring to the same privilege? Third party 43164032Srwatson * vendors may request the assignment of privileges to be used in loadable 44164032Srwatson * modules. Particular numeric privilege assignments are part of the 45164032Srwatson * loadable kernel module ABI, and should not be changed across minor 46164032Srwatson * releases. 47164032Srwatson * 48164032Srwatson * When adding a new privilege, remember to determine if it's appropriate for 49164032Srwatson * use in jail, and update the privilege switch in kern_jail.c as necessary. 50164032Srwatson */ 51164032Srwatson 52164032Srwatson/* 53164032Srwatson * Track beginning of privilege list. 54164032Srwatson */ 55189153Srwatson#define _PRIV_LOWEST 1 56164032Srwatson 57164032Srwatson/* 58164032Srwatson * The remaining privileges typically correspond to one or a small 59164032Srwatson * number of specific privilege checks, and have (relatively) precise 60164032Srwatson * meanings. They are loosely sorted into a set of base system 61164032Srwatson * privileges, such as the ability to reboot, and then loosely by 62164032Srwatson * subsystem, indicated by a subsystem name. 63164032Srwatson */ 64189153Srwatson#define _PRIV_ROOT 1 /* Removed. */ 65164032Srwatson#define PRIV_ACCT 2 /* Manage process accounting. */ 66164032Srwatson#define PRIV_MAXFILES 3 /* Exceed system open files limit. */ 67164032Srwatson#define PRIV_MAXPROC 4 /* Exceed system processes limit. */ 68164032Srwatson#define PRIV_KTRACE 5 /* Set/clear KTRFAC_ROOT on ktrace. */ 69164032Srwatson#define PRIV_SETDUMPER 6 /* Configure dump device. */ 70164032Srwatson#define PRIV_REBOOT 8 /* Can reboot system. */ 71164032Srwatson#define PRIV_SWAPON 9 /* Can swapon(). */ 72164032Srwatson#define PRIV_SWAPOFF 10 /* Can swapoff(). */ 73164032Srwatson#define PRIV_MSGBUF 11 /* Can read kernel message buffer. */ 74166857Srwatson#define PRIV_IO 12 /* Can perform low-level I/O. */ 75166857Srwatson#define PRIV_KEYBOARD 13 /* Reprogram keyboard. */ 76166857Srwatson#define PRIV_DRIVER 14 /* Low-level driver privilege. */ 77166857Srwatson#define PRIV_ADJTIME 15 /* Set time adjustment. */ 78166857Srwatson#define PRIV_NTP_ADJTIME 16 /* Set NTP time adjustment. */ 79166857Srwatson#define PRIV_CLOCK_SETTIME 17 /* Can call clock_settime. */ 80166857Srwatson#define PRIV_SETTIMEOFDAY 18 /* Can call settimeofday. */ 81193066Sjamie#define _PRIV_SETHOSTID 19 /* Removed. */ 82184962Sed#define _PRIV_SETDOMAINNAME 20 /* Removed. */ 83164032Srwatson 84164032Srwatson/* 85164032Srwatson * Audit subsystem privileges. 86164032Srwatson */ 87164032Srwatson#define PRIV_AUDIT_CONTROL 40 /* Can configure audit. */ 88164032Srwatson#define PRIV_AUDIT_FAILSTOP 41 /* Can run during audit fail stop. */ 89164032Srwatson#define PRIV_AUDIT_GETAUDIT 42 /* Can get proc audit properties. */ 90164032Srwatson#define PRIV_AUDIT_SETAUDIT 43 /* Can set proc audit properties. */ 91164032Srwatson#define PRIV_AUDIT_SUBMIT 44 /* Can submit an audit record. */ 92164032Srwatson 93164032Srwatson/* 94164032Srwatson * Credential management privileges. 95164032Srwatson */ 96164032Srwatson#define PRIV_CRED_SETUID 50 /* setuid. */ 97164032Srwatson#define PRIV_CRED_SETEUID 51 /* seteuid to !ruid and !svuid. */ 98164032Srwatson#define PRIV_CRED_SETGID 52 /* setgid. */ 99164032Srwatson#define PRIV_CRED_SETEGID 53 /* setgid to !rgid and !svgid. */ 100164032Srwatson#define PRIV_CRED_SETGROUPS 54 /* Set process additional groups. */ 101164032Srwatson#define PRIV_CRED_SETREUID 55 /* setreuid. */ 102164032Srwatson#define PRIV_CRED_SETREGID 56 /* setregid. */ 103164032Srwatson#define PRIV_CRED_SETRESUID 57 /* setresuid. */ 104164032Srwatson#define PRIV_CRED_SETRESGID 58 /* setresgid. */ 105164032Srwatson#define PRIV_SEEOTHERGIDS 59 /* Exempt bsd.seeothergids. */ 106164032Srwatson#define PRIV_SEEOTHERUIDS 60 /* Exempt bsd.seeotheruids. */ 107164032Srwatson 108164032Srwatson/* 109164032Srwatson * Debugging privileges. 110164032Srwatson */ 111164032Srwatson#define PRIV_DEBUG_DIFFCRED 80 /* Exempt debugging other users. */ 112164032Srwatson#define PRIV_DEBUG_SUGID 81 /* Exempt debugging setuid proc. */ 113164032Srwatson#define PRIV_DEBUG_UNPRIV 82 /* Exempt unprivileged debug limit. */ 114164032Srwatson 115164032Srwatson/* 116164032Srwatson * Dtrace privileges. 117164032Srwatson */ 118164032Srwatson#define PRIV_DTRACE_KERNEL 90 /* Allow use of DTrace on the kernel. */ 119164032Srwatson#define PRIV_DTRACE_PROC 91 /* Allow attaching DTrace to process. */ 120164032Srwatson#define PRIV_DTRACE_USER 92 /* Process may submit DTrace events. */ 121164032Srwatson 122164032Srwatson/* 123164032Srwatson * Firmware privilegs. 124164032Srwatson */ 125164032Srwatson#define PRIV_FIRMWARE_LOAD 100 /* Can load firmware. */ 126164032Srwatson 127164032Srwatson/* 128164032Srwatson * Jail privileges. 129164032Srwatson */ 130164032Srwatson#define PRIV_JAIL_ATTACH 110 /* Attach to a jail. */ 131191673Sjamie#define PRIV_JAIL_SET 111 /* Set jail parameters. */ 132191673Sjamie#define PRIV_JAIL_REMOVE 112 /* Remove a jail. */ 133164032Srwatson 134164032Srwatson/* 135164032Srwatson * Kernel environment priveleges. 136164032Srwatson */ 137164032Srwatson#define PRIV_KENV_SET 120 /* Set kernel env. variables. */ 138164032Srwatson#define PRIV_KENV_UNSET 121 /* Unset kernel env. variables. */ 139164032Srwatson 140164032Srwatson/* 141164032Srwatson * Loadable kernel module privileges. 142164032Srwatson */ 143164032Srwatson#define PRIV_KLD_LOAD 130 /* Load a kernel module. */ 144164032Srwatson#define PRIV_KLD_UNLOAD 131 /* Unload a kernel module. */ 145164032Srwatson 146164032Srwatson/* 147164032Srwatson * Privileges associated with the MAC Framework and specific MAC policy 148164032Srwatson * modules. 149164032Srwatson */ 150164032Srwatson#define PRIV_MAC_PARTITION 140 /* Privilege in mac_partition policy. */ 151164032Srwatson#define PRIV_MAC_PRIVS 141 /* Privilege in the mac_privs policy. */ 152164032Srwatson 153164032Srwatson/* 154164032Srwatson * Process-related privileges. 155164032Srwatson */ 156164032Srwatson#define PRIV_PROC_LIMIT 160 /* Exceed user process limit. */ 157164032Srwatson#define PRIV_PROC_SETLOGIN 161 /* Can call setlogin. */ 158164032Srwatson#define PRIV_PROC_SETRLIMIT 162 /* Can raise resources limits. */ 159219304Strasz#define PRIV_PROC_SETLOGINCLASS 163 /* Can call setloginclass(2). */ 160164032Srwatson 161253915Strasz/* 162253915Strasz * System V IPC privileges. 163164032Srwatson */ 164164032Srwatson#define PRIV_IPC_READ 170 /* Can override IPC read perm. */ 165164032Srwatson#define PRIV_IPC_WRITE 171 /* Can override IPC write perm. */ 166166838Srwatson#define PRIV_IPC_ADMIN 172 /* Can override IPC owner-only perm. */ 167166838Srwatson#define PRIV_IPC_MSGSIZE 173 /* Exempt IPC message queue limit. */ 168164032Srwatson 169164032Srwatson/* 170164032Srwatson * POSIX message queue privileges. 171164032Srwatson */ 172164032Srwatson#define PRIV_MQ_ADMIN 180 /* Can override msgq owner-only perm. */ 173164032Srwatson 174164032Srwatson/* 175164032Srwatson * Performance monitoring counter privileges. 176164032Srwatson */ 177164032Srwatson#define PRIV_PMC_MANAGE 190 /* Can administer PMC. */ 178164032Srwatson#define PRIV_PMC_SYSTEM 191 /* Can allocate a system-wide PMC. */ 179164032Srwatson 180164032Srwatson/* 181164032Srwatson * Scheduling privileges. 182164032Srwatson */ 183164032Srwatson#define PRIV_SCHED_DIFFCRED 200 /* Exempt scheduling other users. */ 184164032Srwatson#define PRIV_SCHED_SETPRIORITY 201 /* Can set lower nice value for proc. */ 185164032Srwatson#define PRIV_SCHED_RTPRIO 202 /* Can set real time scheduling. */ 186164032Srwatson#define PRIV_SCHED_SETPOLICY 203 /* Can set scheduler policy. */ 187164032Srwatson#define PRIV_SCHED_SET 204 /* Can set thread scheduler. */ 188164032Srwatson#define PRIV_SCHED_SETPARAM 205 /* Can set thread scheduler params. */ 189180098Sbz#define PRIV_SCHED_CPUSET 206 /* Can manipulate cpusets. */ 190195249Sjhb#define PRIV_SCHED_CPUSET_INTR 207 /* Can adjust IRQ to CPU binding. */ 191164032Srwatson 192164032Srwatson/* 193164032Srwatson * POSIX semaphore privileges. 194164032Srwatson */ 195164032Srwatson#define PRIV_SEM_WRITE 220 /* Can override sem write perm. */ 196164032Srwatson 197164032Srwatson/* 198164032Srwatson * Signal privileges. 199164032Srwatson */ 200164032Srwatson#define PRIV_SIGNAL_DIFFCRED 230 /* Exempt signalling other users. */ 201164032Srwatson#define PRIV_SIGNAL_SUGID 231 /* Non-conserv signal setuid proc. */ 202164032Srwatson 203164032Srwatson/* 204164032Srwatson * Sysctl privileges. 205164032Srwatson */ 206164032Srwatson#define PRIV_SYSCTL_DEBUG 240 /* Can invoke sysctl.debug. */ 207164032Srwatson#define PRIV_SYSCTL_WRITE 241 /* Can write sysctls. */ 208164032Srwatson#define PRIV_SYSCTL_WRITEJAIL 242 /* Can write sysctls, jail permitted. */ 209164032Srwatson 210164032Srwatson/* 211164032Srwatson * TTY privileges. 212164032Srwatson */ 213164032Srwatson#define PRIV_TTY_CONSOLE 250 /* Set console to tty. */ 214164032Srwatson#define PRIV_TTY_DRAINWAIT 251 /* Set tty drain wait time. */ 215164032Srwatson#define PRIV_TTY_DTRWAIT 252 /* Set DTR wait on tty. */ 216164032Srwatson#define PRIV_TTY_EXCLUSIVE 253 /* Override tty exclusive flag. */ 217194538Sed#define _PRIV_TTY_PRISON 254 /* Removed. */ 218164032Srwatson#define PRIV_TTY_STI 255 /* Simulate input on another tty. */ 219164032Srwatson#define PRIV_TTY_SETA 256 /* Set tty termios structure. */ 220164032Srwatson 221164032Srwatson/* 222164032Srwatson * UFS-specific privileges. 223164032Srwatson */ 224164032Srwatson#define PRIV_UFS_EXTATTRCTL 270 /* Can configure EAs on UFS1. */ 225166832Srwatson#define PRIV_UFS_QUOTAOFF 271 /* quotaoff(). */ 226166832Srwatson#define PRIV_UFS_QUOTAON 272 /* quotaon(). */ 227166832Srwatson#define PRIV_UFS_SETUSE 273 /* setuse(). */ 228164032Srwatson 229164032Srwatson/* 230168405Spjd * ZFS-specific privileges. 231168405Spjd */ 232168405Spjd#define PRIV_ZFS_POOL_CONFIG 280 /* Can configure ZFS pools. */ 233168405Spjd#define PRIV_ZFS_INJECT 281 /* Can inject faults in the ZFS fault 234168405Spjd injection framework. */ 235168405Spjd#define PRIV_ZFS_JAIL 282 /* Can attach/detach ZFS file systems 236168405Spjd to/from jails. */ 237168405Spjd 238168405Spjd/* 239168931Srwatson * NFS-specific privileges. 240168931Srwatson */ 241168931Srwatson#define PRIV_NFS_DAEMON 290 /* Can become the NFS daemon. */ 242168931Srwatson#define PRIV_NFS_LOCKD 291 /* Can become NFS lock daemon. */ 243168931Srwatson 244168931Srwatson/* 245164032Srwatson * VFS privileges. 246164032Srwatson */ 247164032Srwatson#define PRIV_VFS_READ 310 /* Override vnode DAC read perm. */ 248164032Srwatson#define PRIV_VFS_WRITE 311 /* Override vnode DAC write perm. */ 249164032Srwatson#define PRIV_VFS_ADMIN 312 /* Override vnode DAC admin perm. */ 250164032Srwatson#define PRIV_VFS_EXEC 313 /* Override vnode DAC exec perm. */ 251164032Srwatson#define PRIV_VFS_LOOKUP 314 /* Override vnode DAC lookup perm. */ 252164032Srwatson#define PRIV_VFS_BLOCKRESERVE 315 /* Can use free block reserve. */ 253164032Srwatson#define PRIV_VFS_CHFLAGS_DEV 316 /* Can chflags() a device node. */ 254164032Srwatson#define PRIV_VFS_CHOWN 317 /* Can set user; group to non-member. */ 255164032Srwatson#define PRIV_VFS_CHROOT 318 /* chroot(). */ 256167152Spjd#define PRIV_VFS_RETAINSUGID 319 /* Can retain sugid bits on change. */ 257166832Srwatson#define PRIV_VFS_EXCEEDQUOTA 320 /* Exempt from quota restrictions. */ 258166832Srwatson#define PRIV_VFS_EXTATTR_SYSTEM 321 /* Operate on system EA namespace. */ 259166832Srwatson#define PRIV_VFS_FCHROOT 322 /* fchroot(). */ 260166832Srwatson#define PRIV_VFS_FHOPEN 323 /* Can fhopen(). */ 261166832Srwatson#define PRIV_VFS_FHSTAT 324 /* Can fhstat(). */ 262166832Srwatson#define PRIV_VFS_FHSTATFS 325 /* Can fhstatfs(). */ 263166832Srwatson#define PRIV_VFS_GENERATION 326 /* stat() returns generation number. */ 264166832Srwatson#define PRIV_VFS_GETFH 327 /* Can retrieve file handles. */ 265166832Srwatson#define PRIV_VFS_GETQUOTA 328 /* getquota(). */ 266166832Srwatson#define PRIV_VFS_LINK 329 /* bsd.hardlink_check_uid */ 267166832Srwatson#define PRIV_VFS_MKNOD_BAD 330 /* Can mknod() to mark bad inodes. */ 268166832Srwatson#define PRIV_VFS_MKNOD_DEV 331 /* Can mknod() to create dev nodes. */ 269166832Srwatson#define PRIV_VFS_MKNOD_WHT 332 /* Can mknod() to create whiteout. */ 270166832Srwatson#define PRIV_VFS_MOUNT 333 /* Can mount(). */ 271185029Spjd#define PRIV_VFS_MOUNT_OWNER 334 /* Can manage other users' file systems. */ 272166832Srwatson#define PRIV_VFS_MOUNT_EXPORTED 335 /* Can set MNT_EXPORTED on mount. */ 273166832Srwatson#define PRIV_VFS_MOUNT_PERM 336 /* Override dev node perms at mount. */ 274166832Srwatson#define PRIV_VFS_MOUNT_SUIDDIR 337 /* Can set MNT_SUIDDIR on mount. */ 275166832Srwatson#define PRIV_VFS_MOUNT_NONUSER 338 /* Can perform a non-user mount. */ 276166832Srwatson#define PRIV_VFS_SETGID 339 /* Can setgid if not in group. */ 277166832Srwatson#define PRIV_VFS_SETQUOTA 340 /* setquota(). */ 278166832Srwatson#define PRIV_VFS_STICKYFILE 341 /* Can set sticky bit on file. */ 279166832Srwatson#define PRIV_VFS_SYSFLAGS 342 /* Can modify system flags. */ 280166832Srwatson#define PRIV_VFS_UNMOUNT 343 /* Can unmount(). */ 281172860Srwatson#define PRIV_VFS_STAT 344 /* Override vnode MAC stat perm. */ 282164032Srwatson 283164032Srwatson/* 284164032Srwatson * Virtual memory privileges. 285164032Srwatson */ 286164032Srwatson#define PRIV_VM_MADV_PROTECT 360 /* Can set MADV_PROTECT. */ 287164032Srwatson#define PRIV_VM_MLOCK 361 /* Can mlock(), mlockall(). */ 288164032Srwatson#define PRIV_VM_MUNLOCK 362 /* Can munlock(), munlockall(). */ 289194766Skib#define PRIV_VM_SWAP_NOQUOTA 363 /* 290194766Skib * Can override the global 291194766Skib * swap reservation limits. 292194766Skib */ 293194766Skib#define PRIV_VM_SWAP_NORLIMIT 364 /* 294194766Skib * Can override the per-uid 295194766Skib * swap reservation limits. 296194766Skib */ 297164032Srwatson 298164032Srwatson/* 299164032Srwatson * Device file system privileges. 300164032Srwatson */ 301164032Srwatson#define PRIV_DEVFS_RULE 370 /* Can manage devfs rules. */ 302164032Srwatson#define PRIV_DEVFS_SYMLINK 371 /* Can create symlinks in devfs. */ 303164032Srwatson 304164032Srwatson/* 305164032Srwatson * Random number generator privileges. 306164032Srwatson */ 307164032Srwatson#define PRIV_RANDOM_RESEED 380 /* Closing /dev/random reseeds. */ 308164032Srwatson 309164032Srwatson/* 310164032Srwatson * Network stack privileges. 311164032Srwatson */ 312164032Srwatson#define PRIV_NET_BRIDGE 390 /* Administer bridge. */ 313164032Srwatson#define PRIV_NET_GRE 391 /* Administer GRE. */ 314194895Srwatson#define _PRIV_NET_PPP 392 /* Removed. */ 315194895Srwatson#define _PRIV_NET_SLIP 393 /* Removed. */ 316164032Srwatson#define PRIV_NET_BPF 394 /* Monitor BPF. */ 317164032Srwatson#define PRIV_NET_RAW 395 /* Open raw socket. */ 318164032Srwatson#define PRIV_NET_ROUTE 396 /* Administer routing. */ 319164032Srwatson#define PRIV_NET_TAP 397 /* Can open tap device. */ 320164032Srwatson#define PRIV_NET_SETIFMTU 398 /* Set interface MTU. */ 321164032Srwatson#define PRIV_NET_SETIFFLAGS 399 /* Set interface flags. */ 322164032Srwatson#define PRIV_NET_SETIFCAP 400 /* Set interface capabilities. */ 323164032Srwatson#define PRIV_NET_SETIFNAME 401 /* Set interface name. */ 324164032Srwatson#define PRIV_NET_SETIFMETRIC 402 /* Set interface metrics. */ 325164032Srwatson#define PRIV_NET_SETIFPHYS 403 /* Set interface physical layer prop. */ 326164032Srwatson#define PRIV_NET_SETIFMAC 404 /* Set interface MAC label. */ 327164032Srwatson#define PRIV_NET_ADDMULTI 405 /* Add multicast addr. to ifnet. */ 328164032Srwatson#define PRIV_NET_DELMULTI 406 /* Delete multicast addr. from ifnet. */ 329166839Srwatson#define PRIV_NET_HWIOCTL 407 /* Issue hardware ioctl on ifnet. */ 330167095Spjd#define PRIV_NET_SETLLADDR 408 /* Set interface link-level address. */ 331166839Srwatson#define PRIV_NET_ADDIFGROUP 409 /* Add new interface group. */ 332166839Srwatson#define PRIV_NET_DELIFGROUP 410 /* Delete interface group. */ 333166839Srwatson#define PRIV_NET_IFCREATE 411 /* Create cloned interface. */ 334166839Srwatson#define PRIV_NET_IFDESTROY 412 /* Destroy cloned interface. */ 335166839Srwatson#define PRIV_NET_ADDIFADDR 413 /* Add protocol addr to interface. */ 336166839Srwatson#define PRIV_NET_DELIFADDR 414 /* Delete protocol addr on interface. */ 337168793Sthompsa#define PRIV_NET_LAGG 415 /* Administer lagg interface. */ 338193664Shrs#define PRIV_NET_GIF 416 /* Administer gif interface. */ 339194251Sjamie#define PRIV_NET_SETIFVNET 417 /* Move interface to vnet. */ 340203052Sdelphij#define PRIV_NET_SETIFDESCR 418 /* Set interface description. */ 341223735Sbz#define PRIV_NET_SETIFFIB 419 /* Set interface fib. */ 342164032Srwatson 343164032Srwatson/* 344164032Srwatson * 802.11-related privileges. 345164032Srwatson */ 346166839Srwatson#define PRIV_NET80211_GETKEY 440 /* Query 802.11 keys. */ 347166839Srwatson#define PRIV_NET80211_MANAGE 441 /* Administer 802.11. */ 348164032Srwatson 349164032Srwatson/* 350164032Srwatson * AppleTalk privileges. 351164032Srwatson */ 352166839Srwatson#define PRIV_NETATALK_RESERVEDPORT 450 /* Bind low port number. */ 353164032Srwatson 354164032Srwatson/* 355164032Srwatson * ATM privileges. 356164032Srwatson */ 357166839Srwatson#define PRIV_NETATM_CFG 460 358166839Srwatson#define PRIV_NETATM_ADD 461 359166839Srwatson#define PRIV_NETATM_DEL 462 360166839Srwatson#define PRIV_NETATM_SET 463 361164032Srwatson 362164032Srwatson/* 363164032Srwatson * Bluetooth privileges. 364164032Srwatson */ 365166839Srwatson#define PRIV_NETBLUETOOTH_RAW 470 /* Open raw bluetooth socket. */ 366164032Srwatson 367164032Srwatson/* 368164032Srwatson * Netgraph and netgraph module privileges. 369164032Srwatson */ 370166839Srwatson#define PRIV_NETGRAPH_CONTROL 480 /* Open netgraph control socket. */ 371166839Srwatson#define PRIV_NETGRAPH_TTY 481 /* Configure tty for netgraph. */ 372164032Srwatson 373164032Srwatson/* 374164032Srwatson * IPv4 and IPv6 privileges. 375164032Srwatson */ 376166839Srwatson#define PRIV_NETINET_RESERVEDPORT 490 /* Bind low port number. */ 377166839Srwatson#define PRIV_NETINET_IPFW 491 /* Administer IPFW firewall. */ 378166839Srwatson#define PRIV_NETINET_DIVERT 492 /* Open IP divert socket. */ 379166839Srwatson#define PRIV_NETINET_PF 493 /* Administer pf firewall. */ 380166839Srwatson#define PRIV_NETINET_DUMMYNET 494 /* Administer DUMMYNET. */ 381166839Srwatson#define PRIV_NETINET_CARP 495 /* Administer CARP. */ 382166839Srwatson#define PRIV_NETINET_MROUTE 496 /* Administer multicast routing. */ 383166839Srwatson#define PRIV_NETINET_RAW 497 /* Open netinet raw socket. */ 384166839Srwatson#define PRIV_NETINET_GETCRED 498 /* Query netinet pcb credentials. */ 385166839Srwatson#define PRIV_NETINET_ADDRCTRL6 499 /* Administer IPv6 address scopes. */ 386166839Srwatson#define PRIV_NETINET_ND6 500 /* Administer IPv6 neighbor disc. */ 387166839Srwatson#define PRIV_NETINET_SCOPE6 501 /* Administer IPv6 address scopes. */ 388166839Srwatson#define PRIV_NETINET_ALIFETIME6 502 /* Administer IPv6 address lifetimes. */ 389166839Srwatson#define PRIV_NETINET_IPSEC 503 /* Administer IPSEC. */ 390168590Srwatson#define PRIV_NETINET_REUSEPORT 504 /* Allow [rapid] port/address reuse. */ 391175630Sbz#define PRIV_NETINET_SETHDROPTS 505 /* Set certain IPv4/6 header options. */ 392193217Spjd#define PRIV_NETINET_BINDANY 506 /* Allow bind to any address. */ 393164032Srwatson 394164032Srwatson/* 395164032Srwatson * IPX/SPX privileges. 396164032Srwatson */ 397166839Srwatson#define PRIV_NETIPX_RESERVEDPORT 520 /* Bind low port number. */ 398166839Srwatson#define PRIV_NETIPX_RAW 521 /* Open netipx raw socket. */ 399164032Srwatson 400164032Srwatson/* 401164032Srwatson * NCP privileges. 402164032Srwatson */ 403166839Srwatson#define PRIV_NETNCP 530 /* Use another user's connection. */ 404164032Srwatson 405164032Srwatson/* 406164032Srwatson * SMB privileges. 407164032Srwatson */ 408166839Srwatson#define PRIV_NETSMB 540 /* Use another user's connection. */ 409164032Srwatson 410164032Srwatson/* 411164032Srwatson * VM86 privileges. 412164032Srwatson */ 413166839Srwatson#define PRIV_VM86_INTCALL 550 /* Allow invoking vm86 int handlers. */ 414164032Srwatson 415164032Srwatson/* 416164032Srwatson * Set of reserved privilege values, which will be allocated to code as 417164032Srwatson * needed, in order to avoid renumbering later privileges due to insertion. 418164032Srwatson */ 419166839Srwatson#define _PRIV_RESERVED0 560 420166839Srwatson#define _PRIV_RESERVED1 561 421166839Srwatson#define _PRIV_RESERVED2 562 422166839Srwatson#define _PRIV_RESERVED3 563 423166839Srwatson#define _PRIV_RESERVED4 564 424166839Srwatson#define _PRIV_RESERVED5 565 425166839Srwatson#define _PRIV_RESERVED6 566 426166839Srwatson#define _PRIV_RESERVED7 567 427166839Srwatson#define _PRIV_RESERVED8 568 428166839Srwatson#define _PRIV_RESERVED9 569 429166839Srwatson#define _PRIV_RESERVED10 570 430166839Srwatson#define _PRIV_RESERVED11 571 431166839Srwatson#define _PRIV_RESERVED12 572 432166839Srwatson#define _PRIV_RESERVED13 573 433166839Srwatson#define _PRIV_RESERVED14 574 434166839Srwatson#define _PRIV_RESERVED15 575 435164032Srwatson 436164032Srwatson/* 437164032Srwatson * Define a set of valid privilege numbers that can be used by loadable 438164032Srwatson * modules that don't yet have privilege reservations. Ideally, these should 439164032Srwatson * not be used, since their meaning is opaque to any policies that are aware 440164032Srwatson * of specific privileges, such as jail, and as such may be arbitrarily 441164032Srwatson * denied. 442164032Srwatson */ 443166839Srwatson#define PRIV_MODULE0 600 444166839Srwatson#define PRIV_MODULE1 601 445166839Srwatson#define PRIV_MODULE2 602 446166839Srwatson#define PRIV_MODULE3 603 447166839Srwatson#define PRIV_MODULE4 604 448166839Srwatson#define PRIV_MODULE5 605 449166839Srwatson#define PRIV_MODULE6 606 450166839Srwatson#define PRIV_MODULE7 607 451166839Srwatson#define PRIV_MODULE8 608 452166839Srwatson#define PRIV_MODULE9 609 453166839Srwatson#define PRIV_MODULE10 610 454166839Srwatson#define PRIV_MODULE11 611 455166839Srwatson#define PRIV_MODULE12 612 456166839Srwatson#define PRIV_MODULE13 613 457166839Srwatson#define PRIV_MODULE14 614 458166839Srwatson#define PRIV_MODULE15 615 459164032Srwatson 460164032Srwatson/* 461174899Srwatson * DDB(4) privileges. 462174899Srwatson */ 463174899Srwatson#define PRIV_DDB_CAPTURE 620 /* Allow reading of DDB capture log. */ 464174899Srwatson 465174899Srwatson/* 466176319Srwatson * Arla/nnpfs privileges. 467176319Srwatson */ 468176319Srwatson#define PRIV_NNPFS_DEBUG 630 /* Perforn ARLA_VIOC_NNPFSDEBUG. */ 469176319Srwatson 470176319Srwatson/* 471181430Sstas * cpuctl(4) privileges. 472181430Sstas */ 473181430Sstas#define PRIV_CPUCTL_WRMSR 640 /* Write model-specific register. */ 474181430Sstas#define PRIV_CPUCTL_UPDATE 641 /* Update cpu microcode. */ 475181430Sstas 476181430Sstas/* 477192577Sbz * Capi4BSD privileges. 478192577Sbz */ 479192577Sbz#define PRIV_C4B_RESET_CTLR 650 /* Load firmware, reset controller. */ 480192577Sbz#define PRIV_C4B_TRACE 651 /* Unrestricted CAPI message tracing. */ 481192577Sbz 482192577Sbz/* 483195970Srwatson * OpenAFS privileges. 484195970Srwatson */ 485195970Srwatson#define PRIV_AFS_ADMIN 660 /* Can change AFS client settings. */ 486195970Srwatson#define PRIV_AFS_DAEMON 661 /* Can become the AFS daemon. */ 487195970Srwatson 488195970Srwatson/* 489220163Strasz * Resource Limits privileges. 490220163Strasz */ 491220527Strasz#define PRIV_RCTL_GET_RACCT 670 492220527Strasz#define PRIV_RCTL_GET_RULES 671 493220527Strasz#define PRIV_RCTL_GET_LIMITS 672 494220527Strasz#define PRIV_RCTL_ADD_RULE 673 495220527Strasz#define PRIV_RCTL_REMOVE_RULE 674 496220163Strasz 497220163Strasz/* 498252855Sjamie * mem(4) privileges. 499252841Sjamie */ 500252855Sjamie#define PRIV_KMEM_READ 680 /* Open mem/kmem for reading. */ 501252855Sjamie#define PRIV_KMEM_WRITE 681 /* Open mem/kmem for writing. */ 502252841Sjamie 503252841Sjamie/* 504164032Srwatson * Track end of privilege list. 505164032Srwatson */ 506252845Sjamie#define _PRIV_HIGHEST 682 507164032Srwatson 508164032Srwatson/* 509164032Srwatson * Validate that a named privilege is known by the privilege system. Invalid 510164032Srwatson * privileges presented to the privilege system by a priv_check interface 511164032Srwatson * will result in a panic. This is only approximate due to sparse allocation 512164032Srwatson * of the privilege space. 513164032Srwatson */ 514164032Srwatson#define PRIV_VALID(x) ((x) > _PRIV_LOWEST && (x) < _PRIV_HIGHEST) 515164032Srwatson 516164032Srwatson#ifdef _KERNEL 517164032Srwatson/* 518210292Srpaulo * Privilege check interfaces, modeled after historic suser() interfaces, but 519170850Srwatson * with the addition of a specific privilege name. No flags are currently 520170850Srwatson * defined for the API. Historically, flags specified using the real uid 521170850Srwatson * instead of the effective uid, and whether or not the check should be 522170850Srwatson * allowed in jail. 523164032Srwatson */ 524164032Srwatsonstruct thread; 525164032Srwatsonstruct ucred; 526164032Srwatsonint priv_check(struct thread *td, int priv); 527164032Srwatsonint priv_check_cred(struct ucred *cred, int priv, int flags); 528164032Srwatson#endif 529164032Srwatson 530164032Srwatson#endif /* !_SYS_PRIV_H_ */ 531