1. 18 7月, 2018 1 次提交
  2. 01 6月, 2018 1 次提交
  3. 31 5月, 2018 3 次提交
  4. 19 5月, 2018 2 次提交
    • M
      EVM: Allow runtime modification of the set of verified xattrs · fa516b66
      Matthew Garrett 提交于
      Sites may wish to provide additional metadata alongside files in order
      to make more fine-grained security decisions[1]. The security of this is
      enhanced if this metadata is protected, something that EVM makes
      possible. However, the kernel cannot know about the set of extended
      attributes that local admins may wish to protect, and hardcoding this
      policy in the kernel makes it difficult to change over time and less
      convenient for distributions to enable.
      
      This patch adds a new /sys/kernel/security/integrity/evm/evm_xattrs node,
      which can be read to obtain the current set of EVM-protected extended
      attributes or written to in order to add new entries. Extending this list
      will not change the validity of any existing signatures provided that the
      file in question does not have any of the additional extended attributes -
      missing xattrs are skipped when calculating the EVM hash.
      
      [1] For instance, a package manager could install information about the
      package uploader in an additional extended attribute. Local LSM policy
      could then be associated with that extended attribute in order to
      restrict the privileges available to packages from less trusted
      uploaders.
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Reviewed-by: NJames Morris <james.morris@microsoft.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      fa516b66
    • M
      EVM: turn evm_config_xattrnames into a list · 21af7663
      Matthew Garrett 提交于
      Use a list of xattrs rather than an array - this makes it easier to
      extend the list at runtime.
      Signed-off-by: NMatthew Garrett <mjg59@google.com>
      Reviewed-by: NJames Morris <james.morris@microsoft.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      21af7663
  5. 17 5月, 2018 1 次提交
  6. 04 5月, 2018 1 次提交
  7. 25 3月, 2018 1 次提交
  8. 23 3月, 2018 2 次提交
  9. 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
  10. 09 11月, 2017 3 次提交
  11. 05 6月, 2017 1 次提交
  12. 02 3月, 2017 1 次提交
  13. 03 12月, 2016 1 次提交
  14. 14 11月, 2016 1 次提交
  15. 08 10月, 2016 1 次提交
  16. 06 7月, 2016 1 次提交
  17. 11 4月, 2016 2 次提交
  18. 12 2月, 2016 1 次提交
  19. 15 12月, 2015 5 次提交
    • A
      evm: EVM_LOAD_X509 depends on EVM · 05d3884b
      Arnd Bergmann 提交于
      The newly added EVM_LOAD_X509 code can be configured even if
      CONFIG_EVM is disabled, but that causes a link error:
      
      security/built-in.o: In function `integrity_load_keys':
      digsig_asymmetric.c:(.init.text+0x400): undefined reference to `evm_load_x509'
      
      This adds a Kconfig dependency to ensure it is only enabled when
      CONFIG_EVM is set as well.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Fixes: 2ce523eb ("evm: load x509 certificate from the kernel")
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      05d3884b
    • D
      evm: reset EVM status when file attributes change · 523b74b1
      Dmitry Kasatkin 提交于
      The EVM verification status is cached in iint->evm_status and if it
      was successful, never re-verified again when IMA passes the 'iint' to
      evm_verifyxattr().
      
      When file attributes or extended attributes change, we may wish to
      re-verify EVM integrity as well.  For example, after setting a digital
      signature we may need to re-verify the signature and update the
      iint->flags that there is an EVM signature.
      
      This patch enables that by resetting evm_status to INTEGRITY_UKNOWN
      state.
      
      Changes in v2:
      * Flag setting moved to EVM layer
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      523b74b1
    • D
      evm: provide a function to set the EVM key from the kernel · 76266763
      Dmitry Kasatkin 提交于
      A crypto HW kernel module can possibly initialize the EVM key from the
      kernel __init code to enable EVM before calling the 'init' process.
      This patch provides a function evm_set_key() to set the EVM key
      directly without using the KEY subsystem.
      
      Changes in v4:
      * kernel-doc style for evm_set_key
      
      Changes in v3:
      * error reporting moved to evm_set_key
      * EVM_INIT_HMAC moved to evm_set_key
      * added bitop to prevent key setting race
      
      Changes in v2:
      * use size_t for key size instead of signed int
      * provide EVM_MAX_KEY_SIZE macro in <linux/evm.h>
      * provide EVM_MIN_KEY_SIZE macro in <linux/evm.h>
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      76266763
    • 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
    • D
      evm: load an x509 certificate from the kernel · 2ce523eb
      Dmitry Kasatkin 提交于
      This patch defines a configuration option and the evm_load_x509() hook
      to load an X509 certificate onto the EVM trusted kernel keyring.
      
      Changes in v4:
      * Patch description updated
      
      Changes in v3:
      * Removed EVM_X509_PATH definition. CONFIG_EVM_X509_PATH is used
        directly.
      
      Changes in v2:
      * default key patch changed to /etc/keys
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      2ce523eb
  20. 24 11月, 2015 1 次提交
    • D
      integrity: define '.evm' as a builtin 'trusted' keyring · f4dc3778
      Dmitry Kasatkin 提交于
      Require all keys added to the EVM keyring be signed by an
      existing trusted key on the system trusted keyring.
      
      This patch also switches IMA to use integrity_init_keyring().
      
      Changes in v3:
      * Added 'init_keyring' config based variable to skip initializing
        keyring instead of using  __integrity_init_keyring() wrapper.
      * Added dependency back to CONFIG_IMA_TRUSTED_KEYRING
      
      Changes in v2:
      * Replace CONFIG_EVM_TRUSTED_KEYRING with IMA and EVM common
        CONFIG_INTEGRITY_TRUSTED_KEYRING configuration option
      * Deprecate CONFIG_IMA_TRUSTED_KEYRING but keep it for config
        file compatibility. (Mimi Zohar)
      Signed-off-by: NDmitry Kasatkin <dmitry.kasatkin@huawei.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      f4dc3778
  21. 21 10月, 2015 1 次提交
    • D
      KEYS: Merge the type-specific data with the payload data · 146aa8b1
      David Howells 提交于
      Merge the type-specific data with the payload data into one four-word chunk
      as it seems pointless to keep them separate.
      
      Use user_key_payload() for accessing the payloads of overloaded
      user-defined keys.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      cc: linux-cifs@vger.kernel.org
      cc: ecryptfs@vger.kernel.org
      cc: linux-ext4@vger.kernel.org
      cc: linux-f2fs-devel@lists.sourceforge.net
      cc: linux-nfs@vger.kernel.org
      cc: ceph-devel@vger.kernel.org
      cc: linux-ima-devel@lists.sourceforge.net
      146aa8b1
  22. 22 5月, 2015 2 次提交
  23. 16 4月, 2015 1 次提交
  24. 07 1月, 2015 1 次提交
  25. 28 10月, 2014 1 次提交
    • D
      evm: check xattr value length and type in evm_inode_setxattr() · 3b1deef6
      Dmitry Kasatkin 提交于
      evm_inode_setxattr() can be called with no value. The function does not
      check the length so that following command can be used to produce the
      kernel oops: setfattr -n security.evm FOO. This patch fixes it.
      
      Changes in v3:
      * there is no reason to return different error codes for EVM_XATTR_HMAC
        and non EVM_XATTR_HMAC. Remove unnecessary test then.
      
      Changes in v2:
      * testing for validity of xattr type
      
      [ 1106.396921] BUG: unable to handle kernel NULL pointer dereference at           (null)
      [ 1106.398192] IP: [<ffffffff812af7b8>] evm_inode_setxattr+0x2a/0x48
      [ 1106.399244] PGD 29048067 PUD 290d7067 PMD 0
      [ 1106.399953] Oops: 0000 [#1] SMP
      [ 1106.400020] Modules linked in: bridge stp llc evdev serio_raw i2c_piix4 button fuse
      [ 1106.400020] CPU: 0 PID: 3635 Comm: setxattr Not tainted 3.16.0-kds+ #2936
      [ 1106.400020] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2011
      [ 1106.400020] task: ffff8800291a0000 ti: ffff88002917c000 task.ti: ffff88002917c000
      [ 1106.400020] RIP: 0010:[<ffffffff812af7b8>]  [<ffffffff812af7b8>] evm_inode_setxattr+0x2a/0x48
      [ 1106.400020] RSP: 0018:ffff88002917fd50  EFLAGS: 00010246
      [ 1106.400020] RAX: 0000000000000000 RBX: ffff88002917fdf8 RCX: 0000000000000000
      [ 1106.400020] RDX: 0000000000000000 RSI: ffffffff818136d3 RDI: ffff88002917fdf8
      [ 1106.400020] RBP: ffff88002917fd68 R08: 0000000000000000 R09: 00000000003ec1df
      [ 1106.400020] R10: 0000000000000000 R11: 0000000000000000 R12: ffff8800438a0a00
      [ 1106.400020] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
      [ 1106.400020] FS:  00007f7dfa7d7740(0000) GS:ffff88005da00000(0000) knlGS:0000000000000000
      [ 1106.400020] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
      [ 1106.400020] CR2: 0000000000000000 CR3: 000000003763e000 CR4: 00000000000006f0
      [ 1106.400020] Stack:
      [ 1106.400020]  ffff8800438a0a00 ffff88002917fdf8 0000000000000000 ffff88002917fd98
      [ 1106.400020]  ffffffff812a1030 ffff8800438a0a00 ffff88002917fdf8 0000000000000000
      [ 1106.400020]  0000000000000000 ffff88002917fde0 ffffffff8116d08a ffff88002917fdc8
      [ 1106.400020] Call Trace:
      [ 1106.400020]  [<ffffffff812a1030>] security_inode_setxattr+0x5d/0x6a
      [ 1106.400020]  [<ffffffff8116d08a>] vfs_setxattr+0x6b/0x9f
      [ 1106.400020]  [<ffffffff8116d1e0>] setxattr+0x122/0x16c
      [ 1106.400020]  [<ffffffff811687e8>] ? mnt_want_write+0x21/0x45
      [ 1106.400020]  [<ffffffff8114d011>] ? __sb_start_write+0x10f/0x143
      [ 1106.400020]  [<ffffffff811687e8>] ? mnt_want_write+0x21/0x45
      [ 1106.400020]  [<ffffffff811687c0>] ? __mnt_want_write+0x48/0x4f
      [ 1106.400020]  [<ffffffff8116d3e6>] SyS_setxattr+0x6e/0xb0
      [ 1106.400020]  [<ffffffff81529da9>] system_call_fastpath+0x16/0x1b
      [ 1106.400020] Code: c3 0f 1f 44 00 00 55 48 89 e5 41 55 49 89 d5 41 54 49 89 fc 53 48 89 f3 48 c7 c6 d3 36 81 81 48 89 df e8 18 22 04 00 85 c0 75 07 <41> 80 7d 00 02 74 0d 48 89 de 4c 89 e7 e8 5a fe ff ff eb 03 83
      [ 1106.400020] RIP  [<ffffffff812af7b8>] evm_inode_setxattr+0x2a/0x48
      [ 1106.400020]  RSP <ffff88002917fd50>
      [ 1106.400020] CR2: 0000000000000000
      [ 1106.428061] ---[ end trace ae08331628ba3050 ]---
      Reported-by: NJan Kara <jack@suse.cz>
      Signed-off-by: NDmitry Kasatkin <d.kasatkin@samsung.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      3b1deef6
  26. 08 10月, 2014 1 次提交
  27. 09 9月, 2014 1 次提交
    • D
      integrity: base integrity subsystem kconfig options on integrity · 7ef84e65
      Dmitry Kasatkin 提交于
      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: NDmitry Kasatkin <d.kasatkin@samsung.com>
      Signed-off-by: NMimi Zohar <zohar@linux.vnet.ibm.com>
      7ef84e65