1. 23 8月, 2011 1 次提交
    • D
      KEYS: If install_session_keyring() is given a keyring, it should install it · 99599537
      David Howells 提交于
      If install_session_keyring() is given a keyring, it should install it rather
      than just creating a new one anyway.  This was accidentally broken in:
      
      	commit d84f4f99
      	Author: David Howells <dhowells@redhat.com>
      	Date:   Fri Nov 14 10:39:23 2008 +1100
      	Subject: CRED: Inaugurate COW credentials
      
      The impact of that commit is that pam_keyinit no longer works correctly if
      'force' isn't specified against a login process. This is because:
      
      	keyctl_get_keyring_ID(KEY_SPEC_SESSION_KEYRING, 0)
      
      now always creates a new session keyring and thus the check whether the session
      keyring and the user-session keyring are the same is always false.  This leads
      pam_keyinit to conclude that a session keyring is installed and it shouldn't be
      revoked by pam_keyinit here if 'revoke' is specified.
      
      Any system that specifies 'force' against pam_keyinit in the PAM configuration
      files for login methods (login, ssh, su -l, kdm, etc.) is not affected since
      that bypasses the broken check and forces the creation of a new session keyring
      anyway (for which the revoke flag is not cleared) - and any subsequent call to
      pam_keyinit really does have a session keyring already installed, and so the
      check works correctly there.
      
      Reverting to the previous behaviour will cause the kernel to subscribe the
      process to the user-session keyring as its session keyring if it doesn't have a
      session keyring of its own.  pam_keyinit will detect this and install a new
      session keyring anyway (and won't clear the revert flag).
      
      This can be tested by commenting out pam_keyinit in the /etc/pam.d files and
      running the following program a couple of times in a row:
      
      	#include <stdio.h>
      	#include <stdlib.h>
      	#include <keyutils.h>
      	int main(int argc, char *argv[])
      	{
      		key_serial_t uk, usk, sk;
      		uk = keyctl_get_keyring_ID(KEY_SPEC_USER_KEYRING, 0);
      		usk = keyctl_get_keyring_ID(KEY_SPEC_USER_SESSION_KEYRING, 0);
      		sk = keyctl_get_keyring_ID(KEY_SPEC_SESSION_KEYRING, 0);
      		printf("keys: %08x %08x %08x\n", uk, usk, sk);
      		return 0;
      	}
      
      Without the patch, I see:
      
      	keys: 3884e281 24c4dfcf 22825f8e
      	keys: 3884e281 24c4dfcf 068772be
      
      With the patch, I see:
      
      	keys: 26be9c83 0e755ce0 0e755ce0
      	keys: 26be9c83 0e755ce0 0e755ce0
      
      As can be seen, with the patch, the session keyring is the same as the
      user-session keyring each time; without the patch a new session keyring is
      generated each time.
      Reported-by: NGreg Wettstein <greg@enjellic.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Tested-by: NGreg Wettstein <greg@enjellic.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      99599537
  2. 18 8月, 2011 1 次提交
    • M
      evm: add Kconfig TCG_TPM dependency · dbe5ad17
      Mimi Zohar 提交于
      Although the EVM encrypted-key should be encrypted/decrypted using a
      trusted-key, a user-defined key could be used instead. When using a user-
      defined key, a TCG_TPM dependency should not be required.  Unfortunately,
      the encrypted-key code needs to be refactored a bit in order to remove
      this dependency.
      
      This patch adds the TCG_TPM dependency.
      
      Reported-by: Stephen Rothwell <sfr@canb.auug.org.au>,
      	     Randy Dunlap <rdunlap@xenotimenet>
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      dbe5ad17
  3. 17 8月, 2011 1 次提交
  4. 16 8月, 2011 1 次提交
  5. 12 8月, 2011 1 次提交
    • Z
      capabilities: do not grant full privs for setuid w/ file caps + no effective caps · 4d49f671
      Zhi Li 提交于
      A task (when !SECURE_NOROOT) which executes a setuid-root binary will
      obtain root privileges while executing that binary.  If the binary also
      has effective capabilities set, then only those capabilities will be
      granted.  The rationale is that the same binary can carry both setuid-root
      and the minimal file capability set, so that on a filesystem not
      supporting file caps the binary can still be executed with privilege,
      while on a filesystem supporting file caps it will run with minimal
      privilege.
      
      This special case currently does NOT happen if there are file capabilities
      but no effective capabilities.  Since capability-aware programs can very
      well start with empty pE but populated pP and move those caps to pE when
      needed.  In other words, if the file has file capabilities but NOT
      effective capabilities, then we should do the same thing as if there
      were file capabilities, and not grant full root privileges.
      
      This patchset does that.
      
      (Changelog by Serge Hallyn).
      Signed-off-by: NZhi Li <lizhi1215@gmail.com>
      Acked-by: NSerge Hallyn <serge.hallyn@canonical.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      4d49f671
  6. 11 8月, 2011 1 次提交
  7. 09 8月, 2011 1 次提交
  8. 02 8月, 2011 2 次提交
  9. 27 7月, 2011 2 次提交
  10. 24 7月, 2011 1 次提交
    • T
      VFS : mount lock scalability for internal mounts · 423e0ab0
      Tim Chen 提交于
      For a number of file systems that don't have a mount point (e.g. sockfs
      and pipefs), they are not marked as long term. Therefore in
      mntput_no_expire, all locks in vfs_mount lock are taken instead of just
      local cpu's lock to aggregate reference counts when we release
      reference to file objects.  In fact, only local lock need to have been
      taken to update ref counts as these file systems are in no danger of
      going away until we are ready to unregister them.
      
      The attached patch marks file systems using kern_mount without
      mount point as long term.  The contentions of vfs_mount lock
      is now eliminated.  Before un-registering such file system,
      kern_unmount should be called to remove the long term flag and
      make the mount point ready to be freed.
      Signed-off-by: NTim Chen <tim.c.chen@linux.intel.com>
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      423e0ab0
  11. 21 7月, 2011 3 次提交
  12. 20 7月, 2011 4 次提交
  13. 19 7月, 2011 13 次提交
    • M
      evm: add evm_inode_setattr to prevent updating an invalid security.evm · 817b54aa
      Mimi Zohar 提交于
      Permit changing of security.evm only when valid, unless in fixmode.
      Reported-by: NRoberto Sassu <roberto.sassu@polito.it>
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      817b54aa
    • M
      evm: permit only valid security.evm xattrs to be updated · 7102ebcd
      Mimi Zohar 提交于
      In addition to requiring CAP_SYS_ADMIN permission to modify/delete
      security.evm, prohibit invalid security.evm xattrs from changing,
      unless in fixmode. This patch prevents inadvertent 'fixing' of
      security.evm to reflect offline modifications.
      
      Changelog v7:
      - rename boot paramater 'evm_mode' to 'evm'
      Reported-by: NRoberto Sassu <roberto.sassu@polito.it>
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      7102ebcd
    • 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
    • D
      evm: evm_verify_hmac must not return INTEGRITY_UNKNOWN · 6d38ca01
      Dmitry Kasatkin 提交于
      If EVM is not supported or enabled, evm_verify_hmac() returns
      INTEGRITY_UNKNOWN, which ima_appraise_measurement() ignores and sets
      the appraisal status based solely on the security.ima verification.
      
      evm_verify_hmac() also returns INTEGRITY_UNKNOWN for other failures, such
      as temporary failures like -ENOMEM, resulting in possible attack vectors.
      This patch changes the default return code for temporary/unexpected
      failures, like -ENOMEM, from INTEGRITY_UNKNOWN to INTEGRITY_FAIL, making
      evm_verify_hmac() fail safe.
      
      As a result, failures need to be re-evaluated in order to catch both
      temporary errors, such as the -ENOMEM, as well as errors that have been
      resolved in fix mode.
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@nokia.com>
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      6d38ca01
    • D
      evm: additional parameter to pass integrity cache entry 'iint' · 2960e6cb
      Dmitry Kasatkin 提交于
      Additional iint parameter allows to skip lookup in the cache.
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@nokia.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      2960e6cb
    • 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: call evm_inode_init_security from security_inode_init_security · 823eb1cc
      Mimi Zohar 提交于
      Changelog v7:
      - moved the initialization call to security_inode_init_security,
        renaming evm_inode_post_init_security to evm_inode_init_security
      - increase size of xattr array for EVM xattr
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      823eb1cc
    • 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
      security: imbed evm calls in security hooks · 3e1be52d
      Mimi Zohar 提交于
      Imbed the evm calls evm_inode_setxattr(), evm_inode_post_setxattr(),
      evm_inode_removexattr() in the security hooks.  evm_inode_setxattr()
      protects security.evm xattr.  evm_inode_post_setxattr() and
      evm_inode_removexattr() updates the hmac associated with an inode.
      
      (Assumes an LSM module protects the setting/removing of xattr.)
      
      Changelog:
        - Don't define evm_verifyxattr(), unless CONFIG_INTEGRITY is enabled.
        - xattr_name is a 'const', value is 'void *'
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      Acked-by: NSerge Hallyn <serge.hallyn@ubuntu.com>
      3e1be52d
    • D
      evm: add support for different security.evm data types · 6be5cc52
      Dmitry Kasatkin 提交于
      EVM protects a file's security extended attributes(xattrs) against integrity
      attacks. The current patchset maintains an HMAC-sha1 value across the security
      xattrs, storing the value as the extended attribute 'security.evm'. We
      anticipate other methods for protecting the security extended attributes.
      This patch reserves the first byte of 'security.evm' as a place holder for
      the type of method.
      
      Changelog v6:
      - move evm_ima_xattr_type definition to security/integrity/integrity.h
      - defined a structure for the EVM xattr called evm_ima_xattr_data
        (based on Serge Hallyn's suggestion)
      - removed unnecessary memset
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@nokia.com>
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      Acked-by: NSerge Hallyn <serge.hallyn@canonical.com>
      6be5cc52
    • 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
    • M
      security: new security_inode_init_security API adds function callback · 9d8f13ba
      Mimi Zohar 提交于
      This patch changes the security_inode_init_security API by adding a
      filesystem specific callback to write security extended attributes.
      This change is in preparation for supporting the initialization of
      multiple LSM xattrs and the EVM xattr.  Initially the callback function
      walks an array of xattrs, writing each xattr separately, but could be
      optimized to write multiple xattrs at once.
      
      For existing security_inode_init_security() calls, which have not yet
      been converted to use the new callback function, such as those in
      reiserfs and ocfs2, this patch defines security_old_inode_init_security().
      Signed-off-by: NMimi Zohar <zohar@us.ibm.com>
      9d8f13ba
  14. 14 7月, 2011 1 次提交
  15. 11 7月, 2011 5 次提交
  16. 09 7月, 2011 1 次提交
  17. 08 7月, 2011 1 次提交