09 Sep, 2014

2 commits

  • The integrity subsystem has lots of options and takes more than
    half of the security menu. This patch consolidates the options
    under "integrity", which are hidden if not enabled. This change
    does not affect existing configurations. Re-configuration is not
    needed.

    Changes v4:
    - no need to change "integrity subsystem" to menuconfig as
    options are hidden, when not enabled. (Mimi)
    - add INTEGRITY Kconfig help description

    Changes v3:
    - dependency to INTEGRITY removed when behind 'if INTEGRITY'

    Changes v2:
    - previous patch moved integrity out of the 'security' menu.
    This version keeps integrity as a security option (Mimi).

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     
  • For better visual appearance it is better to co-locate
    asymmetric key options together with signature support.

    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     

20 Jun, 2013

1 commit

  • This patch moves the integrity_audit_msg() function and defintion to
    security/integrity/, the parent directory, renames the 'ima_audit'
    boot command line option to 'integrity_audit', and fixes the Kconfig
    help text to reflect the actual code.

    Changelog:
    - Fixed ifdef inclusion of integrity_audit_msg() (Fengguang Wu)

    Signed-off-by: Mimi Zohar

    Mimi Zohar
     

07 Feb, 2013

1 commit

  • Asymmetric keys were introduced in linux-3.7 to verify the signature on
    signed kernel modules. The asymmetric keys infrastructure abstracts the
    signature verification from the crypto details. This patch adds IMA/EVM
    signature verification using asymmetric keys. Support for additional
    signature verification methods can now be delegated to the asymmetric
    key infrastructure.

    Although the module signature header and the IMA/EVM signature header
    could use the same format, to minimize the signature length and save
    space in the extended attribute, this patch defines a new IMA/EVM
    header format. The main difference is that the key identifier is a
    sha1[12 - 19] hash of the key modulus and exponent, similar to the
    current implementation. The only purpose of the key identifier is to
    identify the corresponding key in the kernel keyring. ima-evm-utils
    was updated to support the new signature format.

    While asymmetric signature verification functionality supports many
    different hash algorithms, the hash used in this patch is calculated
    during the IMA collection phase, based on the configured algorithm.
    The default algorithm is sha1, but for backwards compatibility md5
    is supported. Due to this current limitation, signatures should be
    generated using a sha1 hash algorithm.

    Changes in this patch:
    - Functionality has been moved to separate source file in order to get rid of
    in source #ifdefs.
    - keyid is derived according to the RFC 3280. It does not require to assign
    IMA/EVM specific "description" when loading X509 certificate. Kernel
    asymmetric key subsystem automatically generate the description. Also
    loading a certificate does not require using of ima-evm-utils and can be
    done using keyctl only.
    - keyid size is reduced to 32 bits to save xattr space. Key search is done
    using partial match functionality of asymmetric_key_match().
    - Kconfig option title was changed

    Signed-off-by: Dmitry Kasatkin
    Acked-by: David Howells
    Signed-off-by: Mimi Zohar

    Dmitry Kasatkin
     

18 Jan, 2012

2 commits


22 Nov, 2011

1 commit

  • Fix build errors by adding Kconfig dependency on KEYS.
    CRYPTO dependency removed.

    CC security/integrity/digsig.o
    security/integrity/digsig.c: In function ?integrity_digsig_verify?:
    security/integrity/digsig.c:38:4: error: implicit declaration of function ?request_key?
    security/integrity/digsig.c:38:17: error: ?key_type_keyring? undeclared (first use in this function)
    security/integrity/digsig.c:38:17: note: each undeclared identifier is reported only once for each function it appears in
    make[2]: *** [security/integrity/digsig.o] Error 1

    Reported-by: Randy Dunlap
    Signed-off-by: Dmitry Kasatkin
    Signed-off-by: James Morris

    Dmitry Kasatkin
     

09 Nov, 2011

1 commit


19 Jul, 2011

2 commits

  • 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 > /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: Mimi Zohar
    Acked-by: Serge Hallyn

    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: Mimi Zohar
    Acked-by: Serge Hallyn

    Mimi Zohar