Skip to main content

Capability

Enum Capability 

Source
#[non_exhaustive]
#[repr(u32)]
pub enum Capability {
Show 41 variants Chown = 0, DacOverride = 1, DacReadSearch = 2, Fowner = 3, Fsetid = 4, Kill = 5, Setgid = 6, Setuid = 7, Setpcap = 8, LinuxImmutable = 9, NetBindService = 10, NetBroadcast = 11, NetAdmin = 12, NetRaw = 13, IpcLock = 14, IpcOwner = 15, SysModule = 16, SysRawio = 17, SysChroot = 18, SysPtrace = 19, SysPacct = 20, SysAdmin = 21, SysBoot = 22, SysNice = 23, SysResource = 24, SysTime = 25, SysTtyConfig = 26, Mknod = 27, Lease = 28, AuditWrite = 29, AuditControl = 30, Setfcap = 31, MacOverride = 32, MacAdmin = 33, Syslog = 34, WakeAlarm = 35, BlockSuspend = 36, AuditRead = 37, Perfmon = 38, Bpf = 39, CheckpointRestore = 40,
}
Expand description

Capability Linux — permission fine remplaçant le modèle binaire root/non-root.

Ensemble complet. Les 41 capabilities du noyau (CAP_CHOWN = 0 … CAP_CHECKPOINT_RESTORE = 40 = CAP_LAST_CAP sur Linux ≥ 5.9) sont toutes nommées (ADR-126, couche-0-v1.14). Un consommateur peut donc désigner n’importe quelle capability — en particulier pour réduire un bounding set à un sous-ensemble exact (privsep, ADR-124), ce que le stub partiel initial (20/41) ne permettait pas.

Valeurs numériques. Tirées de include/uapi/linux/capability.h ; identiques x86_64 et aarch64 (ABI kernel stable hors archs hors ADR-014).

Note de discipline (mot haut). Les valeurs 32-40 (CAP_MAC_OVERRIDECAP_CHECKPOINT_RESTORE) occupent le mot haut (bits 32-63) du CapabilityMask (u64) et donc le second mot u32 de l’ABI capget/capset. La conversion lo/hi est faite par les helpers d’air-sys-syscall (mask_to_words/words_to_mask) et testée explicitement (masque à bit ≥ 32) pour catcher une éventuelle inversion lo/hi.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Chown = 0

CAP_CHOWN (0) : changer l’ownership d’un fichier arbitrairement.

§

DacOverride = 1

CAP_DAC_OVERRIDE (1) : passer outre les vérifications DAC.

§

DacReadSearch = 2

CAP_DAC_READ_SEARCH (2) : lire/parcourir tout fichier/répertoire.

§

Fowner = 3

CAP_FOWNER (3) : opérations habituellement réservées au propriétaire.

§

Fsetid = 4

CAP_FSETID (4) : ne pas vider SUID/SGID sur modification.

§

Kill = 5

CAP_KILL (5) : envoyer signal à n’importe quel processus.

§

Setgid = 6

CAP_SETGID (6) : manipulation arbitraire des GID.

§

Setuid = 7

CAP_SETUID (7) : manipulation arbitraire des UID.

§

Setpcap = 8

CAP_SETPCAP (8) : transfert/retrait de capabilities (dont PR_CAPBSET_DROP).

§

LinuxImmutable = 9

CAP_LINUX_IMMUTABLE (9) : poser les attributs IMMUTABLE/APPEND.

§

NetBindService = 10

CAP_NET_BIND_SERVICE (10) : bind sur ports < 1024.

§

NetBroadcast = 11

CAP_NET_BROADCAST (11) : broadcast et écoute multicast.

§

NetAdmin = 12

CAP_NET_ADMIN (12) : configuration réseau (interfaces, routage…).

§

NetRaw = 13

CAP_NET_RAW (13) : sockets raw et packet.

§

IpcLock = 14

CAP_IPC_LOCK (14) : verrouiller de la mémoire (mlock, SHM_LOCK).

§

IpcOwner = 15

CAP_IPC_OWNER (15) : passer outre les vérifications de propriété IPC.

§

SysModule = 16

CAP_SYS_MODULE (16) : load/unload de modules kernel.

§

SysRawio = 17

CAP_SYS_RAWIO (17) : I/O ports, /dev/mem, etc.

§

SysChroot = 18

CAP_SYS_CHROOT (18) : chroot(2).

§

SysPtrace = 19

CAP_SYS_PTRACE (19) : ptrace arbitraire.

§

SysPacct = 20

CAP_SYS_PACCT (20) : acct(2) (comptabilité des processus).

§

SysAdmin = 21

CAP_SYS_ADMIN (21) : « capability fourre-tout » système.

§

SysBoot = 22

CAP_SYS_BOOT (22) : reboot(2) et kexec_load(2).

§

SysNice = 23

CAP_SYS_NICE (23) : priorités CPU et politiques RT/IO.

§

SysResource = 24

CAP_SYS_RESOURCE (24) : relever les hard limits et autres ceilings.

§

SysTime = 25

CAP_SYS_TIME (25) : horloge système et RTC.

§

SysTtyConfig = 26

CAP_SYS_TTY_CONFIG (26) : configuration TTY et vhangup(2).

§

Mknod = 27

CAP_MKNOD (27) : créer des fichiers spéciaux via mknod(2).

§

Lease = 28

CAP_LEASE (28) : poser des baux (fcntl(F_SETLEASE)).

§

AuditWrite = 29

CAP_AUDIT_WRITE (29) : écrire des enregistrements dans le journal d’audit.

§

AuditControl = 30

CAP_AUDIT_CONTROL (30) : configurer/désactiver l’audit du kernel.

§

Setfcap = 31

CAP_SETFCAP (31) : poser des file-capabilities.

§

MacOverride = 32

CAP_MAC_OVERRIDE (32) : passer outre le MAC (LSM Smack…).

§

MacAdmin = 33

CAP_MAC_ADMIN (33) : administrer la politique MAC.

§

Syslog = 34

CAP_SYSLOG (34) : opérations syslog(2) privilégiées.

§

WakeAlarm = 35

CAP_WAKE_ALARM (35) : armer un réveil qui sort le système de veille.

§

BlockSuspend = 36

CAP_BLOCK_SUSPEND (36) : empêcher la mise en veille du système.

§

AuditRead = 37

CAP_AUDIT_READ (37) : lire le journal d’audit via socket multicast.

§

Perfmon = 38

CAP_PERFMON (38) : monitoring de performance (perf_event_open…).

§

Bpf = 39

CAP_BPF (39) : opérations bpf(2) privilégiées.

§

CheckpointRestore = 40

CAP_CHECKPOINT_RESTORE (40) : checkpoint/restore (CAP_LAST_CAP).

Implementations§

Source§

impl Capability

Source

pub const fn as_raw(self) -> u32

Retourne l’index ABI kernel (valeur numérique de CAP_*).

Trait Implementations§

Source§

impl Clone for Capability

Source§

fn clone(&self) -> Capability

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Capability

Source§

impl Debug for Capability

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for Capability

Source§

impl Hash for Capability

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for Capability

Source§

fn eq(&self, other: &Capability) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Capability

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.