1. 08 9月, 2012 2 次提交
    • D
      ima: allocating iint improvements · bf2276d1
      Dmitry Kasatkin 提交于
      With IMA-appraisal's removal of the iint mutex and taking the i_mutex
      instead, allocating the iint becomes a lot simplier, as we don't need
      to be concerned with two processes racing to allocate the iint. This
      patch cleans up and improves performance for allocating the iint.
      
      - removed redundant double i_mutex locking
      - combined iint allocation with tree search
      
      Changelog v2:
      - removed the rwlock/read_lock changes from this patch
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@intel.com>
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      bf2276d1
    • M
      ima: integrity appraisal extension · 2fe5d6de
      Mimi Zohar 提交于
      IMA currently maintains an integrity measurement list used to assert the
      integrity of the running system to a third party.  The IMA-appraisal
      extension adds local integrity validation and enforcement of the
      measurement against a "good" value stored as an extended attribute
      'security.ima'.  The initial methods for validating 'security.ima' are
      hashed based, which provides file data integrity, and digital signature
      based, which in addition to providing file data integrity, provides
      authenticity.
      
      This patch creates and maintains the 'security.ima' xattr, containing
      the file data hash measurement.  Protection of the xattr is provided by
      EVM, if enabled and configured.
      
      Based on policy, IMA calls evm_verifyxattr() to verify a file's metadata
      integrity and, assuming success, compares the file's current hash value
      with the one stored as an extended attribute in 'security.ima'.
      
      Changelov v4:
      - changed iint cache flags to hex values
      
      Changelog v3:
      - change appraisal default for filesystems without xattr support to fail
      
      Changelog v2:
      - fix audit msg 'res' value
      - removed unused 'ima_appraise=' values
      
      Changelog v1:
      - removed unused iint mutex (Dmitry Kasatkin)
      - setattr hook must not reset appraised (Dmitry Kasatkin)
      - evm_verifyxattr() now differentiates between no 'security.evm' xattr
        (INTEGRITY_NOLABEL) and no EVM 'protected' xattrs included in the
        'security.evm' (INTEGRITY_NOXATTRS).
      - replace hash_status with ima_status (Dmitry Kasatkin)
      - re-initialize slab element ima_status on free (Dmitry Kasatkin)
      - include 'security.ima' in EVM if CONFIG_IMA_APPRAISE, not CONFIG_IMA
      - merged half "ima: ima_must_appraise_or_measure API change" (Dmitry Kasatkin)
      - removed unnecessary error variable in process_measurement() (Dmitry Kasatkin)
      - use ima_inode_post_setattr() stub function, if IMA_APPRAISE not configured
        (moved ima_inode_post_setattr() to ima_appraise.c)
      - make sure ima_collect_measurement() can read file
      
      Changelog:
      - add 'iint' to evm_verifyxattr() call (Dimitry Kasatkin)
      - fix the race condition between chmod, which takes the i_mutex and then
        iint->mutex, and ima_file_free() and process_measurement(), which take
        the locks in the reverse order, by eliminating iint->mutex. (Dmitry Kasatkin)
      - cleanup of ima_appraise_measurement() (Dmitry Kasatkin)
      - changes as a result of the iint not allocated for all regular files, but
        only for those measured/appraised.
      - don't try to appraise new/empty files
      - expanded ima_appraisal description in ima/Kconfig
      - IMA appraise definitions required even if IMA_APPRAISE not enabled
      - add return value to ima_must_appraise() stub
      - unconditionally set status = INTEGRITY_PASS *after* testing status,
        not before.  (Found by Joe Perches)
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@intel.com>
      2fe5d6de
  2. 15 9月, 2011 1 次提交
  3. 19 7月, 2011 3 次提交
    • D
      evm: replace hmac_status with evm_status · 24e0198e
      Dmitry Kasatkin 提交于
      We will use digital signatures in addtion to hmac.
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@nokia.com>
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      24e0198e
    • 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
    • M
      integrity: move ima inode integrity data management · f381c272
      Mimi Zohar 提交于
      Move the inode integrity data(iint) management up to the integrity directory
      in order to share the iint among the different integrity models.
      
      Changelog:
      - don't define MAX_DIGEST_SIZE
      - rename several globally visible 'ima_' prefixed functions, structs,
        locks, etc to 'integrity_'
      - replace '20' with SHA1_DIGEST_SIZE
      - reflect location change in appropriate Kconfig and Makefiles
      - remove unnecessary initialization of iint_initialized to 0
      - rebased on current ima_iint.c
      - define integrity_iint_store/lock as static
      
      There should be no other functional changes.
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      Acked-by: NSerge Hallyn <serge.hallyn@ubuntu.com>
      f381c272