1What: /sys/kernel/security/evm 2What: /sys/kernel/security/*/evm 3Date: March 2011 4Contact: Mimi Zohar <zohar@us.ibm.com> 5Description: 6 EVM protects a file's security extended attributes(xattrs) 7 against integrity attacks. The initial method maintains an 8 HMAC-sha1 value across the extended attributes, storing the 9 value as the extended attribute 'security.evm'. 10 11 EVM supports two classes of security.evm. The first is 12 an HMAC-sha1 generated locally with a 13 trusted/encrypted key stored in the Kernel Key 14 Retention System. The second is a digital signature 15 generated either locally or remotely using an 16 asymmetric key. These keys are loaded onto root's 17 keyring using keyctl, and EVM is then enabled by 18 echoing a value to <securityfs>/evm made up of the 19 following bits: 20 21 === ================================================== 22 Bit Effect 23 === ================================================== 24 0 Enable HMAC validation and creation 25 1 Enable digital signature validation 26 2 Permit modification of EVM-protected metadata at 27 runtime. Not supported if HMAC validation and 28 creation is enabled (deprecated). 29 3 Require asymmetric signatures to be version 3 30 31 Disable further runtime modification of EVM policy 31 === ================================================== 32 33 For example:: 34 35 echo 1 ><securityfs>/evm 36 37 will enable HMAC validation and creation 38 39 :: 40 41 echo 0x80000003 ><securityfs>/evm 42 43 will enable HMAC and digital signature validation and 44 HMAC creation and disable all further modification of policy. 45 46 :: 47 48 echo 0x80000006 ><securityfs>/evm 49 50 will enable digital signature validation, permit 51 modification of EVM-protected metadata and 52 disable all further modification of policy. This option is now 53 deprecated in favor of:: 54 55 echo 0x80000002 ><securityfs>/evm 56 57 as the outstanding issues that prevent the usage of EVM portable 58 signatures have been solved. 59 60 Echoing a value is additive, the new value is added to the 61 existing initialization flags. 62 63 For example, after:: 64 65 echo 2 ><securityfs>/evm 66 67 another echo can be performed:: 68 69 echo 1 ><securityfs>/evm 70 71 and the resulting value will be 3. 72 73 Note that once an HMAC key has been loaded, it will no longer 74 be possible to enable metadata modification. Signaling that an 75 HMAC key has been loaded will clear the corresponding flag. 76 For example, if the current value is 6 (2 and 4 set):: 77 78 echo 1 ><securityfs>/evm 79 80 will set the new value to 3 (4 cleared). 81 82 Loading an HMAC key is the only way to disable metadata 83 modification. 84 85 Until key loading has been signaled EVM can not create 86 or validate the 'security.evm' xattr, but returns 87 INTEGRITY_UNKNOWN. Loading keys and signaling EVM 88 should be done as early as possible. Normally this is 89 done in the initramfs, which has already been measured 90 as part of the trusted boot. For more information on 91 creating and loading existing trusted/encrypted keys, 92 refer to: 93 Documentation/security/keys/trusted-encrypted.rst. Both 94 dracut (via 97masterkey and 98integrity) and systemd (via 95 core/ima-setup) have support for loading keys at boot 96 time. 97 98What: /sys/kernel/security/*/evm/evm_xattrs 99Date: April 2018 100Contact: Matthew Garrett <mjg59@google.com> 101Description: 102 Shows the set of extended attributes used to calculate or 103 validate the EVM signature, and allows additional attributes 104 to be added at runtime. Any signatures generated after 105 additional attributes are added (and on files possessing those 106 additional attributes) will only be valid if the same 107 additional attributes are configured on system boot. Writing 108 a single period (.) will lock the xattr list from any further 109 modification. 110