1. 18 7月, 2018 1 次提交
  2. 19 5月, 2018 1 次提交
  3. 23 3月, 2018 1 次提交
  4. 12 12月, 2017 2 次提交
    • M
      EVM: Add support for portable signature format · 50b97748
      Matthew Garrett 提交于
      The EVM signature includes the inode number and (optionally) the
      filesystem UUID, making it impractical to ship EVM signatures in
      packages. This patch adds a new portable format intended to allow
      distributions to include EVM signatures. It is identical to the existing
      format but hardcodes the inode and generation numbers to 0 and does not
      include the filesystem UUID even if the kernel is configured to do so.
      
      Removing the inode means that the metadata and signature from one file
      could be copied to another file without invalidating it. This is avoided
      by ensuring that an IMA xattr is present during EVM validation.
      
      Portable signatures are intended to be immutable - ie, they will never
      be transformed into HMACs.
      
      Based on earlier work by Dmitry Kasatkin and Mikhail Kurinnoi.
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Cc: Dmitry Kasatkin <dmitry.kasatkin@huawei.com>
      Cc: Mikhail Kurinnoi <viewizard@viewizard.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      50b97748
    • M
      EVM: Allow userland to permit modification of EVM-protected metadata · ae1ba167
      Matthew Garrett 提交于
      When EVM is enabled it forbids modification of metadata protected by
      EVM unless there is already a valid EVM signature. If any modification
      is made, the kernel will then generate a new EVM HMAC. However, this
      does not map well on use cases which use only asymmetric EVM signatures,
      as in this scenario the kernel is unable to generate new signatures.
      
      This patch extends the /sys/kernel/security/evm interface to allow
      userland to request that modification of these xattrs be permitted. This
      is only permitted if no keys have already been loaded. In this
      configuration, modifying the metadata will invalidate the EVM appraisal
      on the file in question. This allows packaging systems to write out new
      files, set the relevant extended attributes and then move them into
      place.
      
      There's also some refactoring of the use of evm_initialized in order to
      avoid heading down codepaths that assume there's a key available.
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      ae1ba167
  5. 09 11月, 2017 1 次提交
    • M
      EVM: Allow userspace to signal an RSA key has been loaded · f00d7975
      Matthew Garrett 提交于
      EVM will only perform validation once a key has been loaded. This key
      may either be a symmetric trusted key (for HMAC validation and creation)
      or the public half of an asymmetric key (for digital signature
      validation). The /sys/kernel/security/evm interface allows userland to
      signal that a symmetric key has been loaded, but does not allow userland
      to signal that an asymmetric public key has been loaded.
      
      This patch extends the interface to permit userspace to pass a bitmask
      of loaded key types. It also allows userspace to block loading of a
      symmetric key in order to avoid a compromised system from being able to
      load an additional key type later.
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      f00d7975
  6. 15 12月, 2015 1 次提交
    • D
      evm: enable EVM when X509 certificate is loaded · 26ddabfe
      Dmitry Kasatkin 提交于
      In order to enable EVM before starting the 'init' process,
      evm_initialized needs to be non-zero.  Previously non-zero indicated
      that the HMAC key was loaded.  When EVM loads the X509 before calling
      'init', with this patch it is now possible to enable EVM to start
      signature based verification.
      
      This patch defines bits to enable EVM if a key of any type is loaded.
      
      Changes in v3:
      * print error message if key is not set
      
      Changes in v2:
      * EVM_STATE_KEY_SET replaced by EVM_INIT_HMAC
      * EVM_STATE_X509_SET replaced by EVM_INIT_X509
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      26ddabfe
  7. 13 6月, 2014 1 次提交
  8. 08 3月, 2014 1 次提交
  9. 06 2月, 2013 1 次提交
    • D
      evm: add file system uuid to EVM hmac · 74de6684
      Dmitry Kasatkin 提交于
      EVM uses the same key for all file systems to calculate the HMAC,
      making it possible to paste inodes from one file system on to another
      one, without EVM being able to detect it.  To prevent such an attack,
      it is necessary to make the EVM HMAC file system specific.
      
      This patch uses the file system UUID, a file system unique identifier,
      to bind the EVM HMAC to the file system. The value inode->i_sb->s_uuid
      is used for the HMAC hash calculation, instead of using it for deriving
      the file system specific key.  Initializing the key for every inode HMAC
      calculation is a bit more expensive operation than adding the uuid to
      the HMAC hash.
      
      Changing the HMAC calculation method or adding additional info to the
      calculation, requires existing EVM labeled file systems to be relabeled.
      This patch adds a Kconfig HMAC version option for backwards compatability.
      
      Changelog v1:
      - squash "hmac version setting"
      Changelog v0:
      - add missing Kconfig depends (Mimi)
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@intel.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      74de6684
  10. 17 1月, 2013 1 次提交
  11. 09 11月, 2011 1 次提交
  12. 19 7月, 2011 3 次提交
    • D
      evm: crypto hash replaced by shash · d46eb369
      Dmitry Kasatkin 提交于
      Using shash is more efficient, because the algorithm is allocated only
      once. Only the descriptor to store the hash state needs to be allocated
      for every operation.
      
      Changelog v6:
      - check for crypto_shash_setkey failure
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@nokia.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      d46eb369
    • M
      evm: add evm_inode_init_security to initialize new files · cb723180
      Mimi Zohar 提交于
      Initialize 'security.evm' for new files.
      
      Changelog v7:
      - renamed evm_inode_post_init_security to evm_inode_init_security
      - moved struct xattr definition to earlier patch
      - allocate xattr name
      Changelog v6:
      - Use 'struct evm_ima_xattr_data'
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      cb723180
    • M
      evm: re-release · 66dbc325
      Mimi Zohar 提交于
      EVM protects a file's security extended attributes(xattrs) against integrity
      attacks.  This patchset provides the framework and an initial method.  The
      initial method maintains an HMAC-sha1 value across the security extended
      attributes, storing the HMAC value as the extended attribute 'security.evm'.
      Other methods of validating the integrity of a file's metadata will be posted
      separately (eg. EVM-digital-signatures).
      
      While this patchset does authenticate the security xattrs, and
      cryptographically binds them to the inode, coming extensions will bind other
      directory and inode metadata for more complete protection.  To help simplify
      the review and upstreaming process, each extension will be posted separately
      (eg. IMA-appraisal, IMA-appraisal-directory).  For a general overview of the
      proposed Linux integrity subsystem, refer to Dave Safford's whitepaper:
      http://downloads.sf.net/project/linux-ima/linux-ima/Integrity_overview.pdf.
      
      EVM depends on the Kernel Key Retention System to provide it with a
      trusted/encrypted key for the HMAC-sha1 operation. The key is loaded onto the
      root's keyring using keyctl.  Until EVM receives notification that the key has
      been successfully loaded onto the keyring (echo 1 > <securityfs>/evm), EVM can
      not create or validate the 'security.evm' xattr, but returns INTEGRITY_UNKNOWN.
      Loading the key and signaling EVM should be done as early as possible. Normally
      this is done in the initramfs, which has already been measured as part of the
      trusted boot.  For more information on creating and loading existing
      trusted/encrypted keys, refer to Documentation/keys-trusted-encrypted.txt.  A
      sample dracut patch, which loads the trusted/encrypted key and enables EVM, is
      available from http://linux-ima.sourceforge.net/#EVM.
      
      Based on the LSMs enabled, the set of EVM protected security xattrs is defined
      at compile.  EVM adds the following three calls to the existing security hooks:
      evm_inode_setxattr(), evm_inode_post_setxattr(), and evm_inode_removexattr.  To
      initialize and update the 'security.evm' extended attribute, EVM defines three
      calls: evm_inode_post_init(), evm_inode_post_setattr() and
      evm_inode_post_removexattr() hooks.  To verify the integrity of a security
      xattr, EVM exports evm_verifyxattr().
      
      Changelog v7:
      - Fixed URL in EVM ABI documentation
      
      Changelog v6: (based on Serge Hallyn's review)
      - fix URL in patch description
      - remove evm_hmac_size definition
      - use SHA1_DIGEST_SIZE (removed both MAX_DIGEST_SIZE and evm_hmac_size)
      - moved linux include before other includes
      - test for crypto_hash_setkey failure
      - fail earlier for invalid key
      - clear entire encrypted key, even on failure
      - check xattr name length before comparing xattr names
      
      Changelog:
      - locking based on i_mutex, remove evm_mutex
      - using trusted/encrypted keys for storing the EVM key used in the HMAC-sha1
        operation.
      - replaced crypto hash with shash (Dmitry Kasatkin)
      - support for additional methods of verifying the security xattrs
        (Dmitry Kasatkin)
      - iint not allocated for all regular files, but only for those appraised
      - Use cap_sys_admin in lieu of cap_mac_admin
      - Use __vfs_setxattr_noperm(), without permission checks, from EVM
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      Acked-by: NSerge Hallyn <serge.hallyn@canonical.com>
      66dbc325