1. 13 12月, 2018 12 次提交
  2. 11 12月, 2018 5 次提交
    • M
      ima: don't measure/appraise files on efivarfs · 060190fb
      Mimi Zohar 提交于
      Update the builtin IMA policies specified on the boot command line
      (eg. ima_policy="tcb|appraise_tcb") to permit accessing efivar files.
      Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
      060190fb
    • E
      x86/ima: define arch_get_ima_policy() for x86 · d958083a
      Eric Richter 提交于
      On x86, there are two methods of verifying a kexec'ed kernel image
      signature being loaded via the kexec_file_load syscall - an architecture
      specific implementaton or a IMA KEXEC_KERNEL_CHECK appraisal rule. Neither
      of these methods verify the kexec'ed kernel image signature being loaded
      via the kexec_load syscall.
      
      Secure boot enabled systems require kexec images to be signed. Therefore,
      this patch loads an IMA KEXEC_KERNEL_CHECK policy rule on secure boot
      enabled systems not configured with CONFIG_KEXEC_VERIFY_SIG enabled.
      
      When IMA_APPRAISE_BOOTPARAM is configured, different IMA appraise modes
      (eg. fix, log) can be specified on the boot command line, allowing unsigned
      or invalidly signed kernel images to be kexec'ed. This patch permits
      enabling IMA_APPRAISE_BOOTPARAM or IMA_ARCH_POLICY, but not both.
      Signed-off-by: NEric Richter <erichte@linux.ibm.com>
      Signed-off-by: NNayna Jain <nayna@linux.ibm.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: Dave Young <dyoung@redhat.com>
      Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
      d958083a
    • N
      ima: add support for arch specific policies · 61917062
      Nayna Jain 提交于
      Builtin IMA policies can be enabled on the boot command line, and replaced
      with a custom policy, normally during early boot in the initramfs. Build
      time IMA policy rules were recently added. These rules are automatically
      enabled on boot and persist after loading a custom policy.
      
      There is a need for yet another type of policy, an architecture specific
      policy, which is derived at runtime during kernel boot, based on the
      runtime secure boot flags.  Like the build time policy rules, these rules
      persist after loading a custom policy.
      
      This patch adds support for loading an architecture specific IMA policy.
      Signed-off-by: NNayna Jain <nayna@linux.ibm.com>
      Co-Developed-by: NMimi Zohar <zohar@linux.ibm.com>
      Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
      61917062
    • N
      ima: refactor ima_init_policy() · c52657d9
      Nayna Jain 提交于
      This patch removes the code duplication in ima_init_policy() by defining
      a new function named add_rules(). The new function adds the rules to the
      initial IMA policy, the custom policy or both based on the policy mask
      (IMA_DEFAULT_POLICY, IMA_CUSTOM_POLICY).
      Signed-off-by: NNayna Jain <nayna@linux.ibm.com>
      Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
      c52657d9
    • N
      ima: prevent kexec_load syscall based on runtime secureboot flag · b5ca1173
      Nayna Jain 提交于
      When CONFIG_KEXEC_VERIFY_SIG is enabled, the kexec_file_load syscall
      requires the kexec'd kernel image to be signed. Distros are concerned
      about totally disabling the kexec_load syscall. As a compromise, the
      kexec_load syscall will only be disabled when CONFIG_KEXEC_VERIFY_SIG
      is configured and the system is booted with secureboot enabled.
      
      This patch disables the kexec_load syscall only for systems booted with
      secureboot enabled.
      
      [zohar@linux.ibm.com: add missing mesage on kexec_load failure]
      Signed-off-by: NNayna Jain <nayna@linux.ibm.com>
      Cc: David Howells <dhowells@redhat.com>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: Peter Jones <pjones@redhat.com>
      Cc: Vivek Goyal <vgoyal@redhat.com>
      Cc: Dave Young <dyoung@redhat.com>
      Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
      b5ca1173
  3. 30 11月, 2018 1 次提交
  4. 14 11月, 2018 3 次提交
  5. 13 11月, 2018 1 次提交
    • M
      integrity: support new struct public_key_signature encoding field · 59637d5e
      Mimi Zohar 提交于
      On systems with IMA-appraisal enabled with a policy requiring file
      signatures, the "good" signature values are stored on the filesystem as
      extended attributes (security.ima).  Signature verification failure
      would normally be limited to just a particular file (eg. executable),
      but during boot signature verification failure could result in a system
      hang.
      
      Defining and requiring a new public_key_signature field requires all
      callers of asymmetric signature verification to be updated to reflect
      the change.  This patch updates the integrity asymmetric_verify()
      caller.
      
      Fixes: 82f94f24 ("KEYS: Provide software public key query function [ver #2]")
      Signed-off-by: NMimi Zohar <zohar@linux.ibm.com>
      Cc: David Howells <dhowells@redhat.com>
      Acked-by: NDenis Kenzior <denkenz@gmail.com>
      59637d5e
  6. 06 11月, 2018 1 次提交
  7. 02 11月, 2018 2 次提交
  8. 26 10月, 2018 3 次提交
    • D
    • D
      KEYS: trusted: Expose common functionality [ver #2] · e1ea9f86
      Denis Kenzior 提交于
      This patch exposes some common functionality needed to send TPM commands.
      Several functions from keys/trusted.c are exposed for use by the new tpm
      key subtype and a module dependency is introduced.
      
      In the future, common functionality between the trusted key type and the
      asym_tpm subtype should be factored out into a common utility library.
      Signed-off-by: NDenis Kenzior <denkenz@gmail.com>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Tested-by: NMarcel Holtmann <marcel@holtmann.org>
      Reviewed-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NJames Morris <james.morris@microsoft.com>
      e1ea9f86
    • D
      KEYS: Provide keyctls to drive the new key type ops for asymmetric keys [ver #2] · 00d60fd3
      David Howells 提交于
      Provide five keyctl functions that permit userspace to make use of the new
      key type ops for accessing and driving asymmetric keys.
      
       (*) Query an asymmetric key.
      
      	long keyctl(KEYCTL_PKEY_QUERY,
      		    key_serial_t key, unsigned long reserved,
      		    struct keyctl_pkey_query *info);
      
           Get information about an asymmetric key.  The information is returned
           in the keyctl_pkey_query struct:
      
      	__u32	supported_ops;
      
           A bit mask of flags indicating which ops are supported.  This is
           constructed from a bitwise-OR of:
      
      	KEYCTL_SUPPORTS_{ENCRYPT,DECRYPT,SIGN,VERIFY}
      
      	__u32	key_size;
      
           The size in bits of the key.
      
      	__u16	max_data_size;
      	__u16	max_sig_size;
      	__u16	max_enc_size;
      	__u16	max_dec_size;
      
           The maximum sizes in bytes of a blob of data to be signed, a signature
           blob, a blob to be encrypted and a blob to be decrypted.
      
           reserved must be set to 0.  This is intended for future use to hand
           over one or more passphrases needed unlock a key.
      
           If successful, 0 is returned.  If the key is not an asymmetric key,
           EOPNOTSUPP is returned.
      
       (*) Encrypt, decrypt, sign or verify a blob using an asymmetric key.
      
      	long keyctl(KEYCTL_PKEY_ENCRYPT,
      		    const struct keyctl_pkey_params *params,
      		    const char *info,
      		    const void *in,
      		    void *out);
      
      	long keyctl(KEYCTL_PKEY_DECRYPT,
      		    const struct keyctl_pkey_params *params,
      		    const char *info,
      		    const void *in,
      		    void *out);
      
      	long keyctl(KEYCTL_PKEY_SIGN,
      		    const struct keyctl_pkey_params *params,
      		    const char *info,
      		    const void *in,
      		    void *out);
      
      	long keyctl(KEYCTL_PKEY_VERIFY,
      		    const struct keyctl_pkey_params *params,
      		    const char *info,
      		    const void *in,
      		    const void *in2);
      
           Use an asymmetric key to perform a public-key cryptographic operation
           a blob of data.
      
           The parameter block pointed to by params contains a number of integer
           values:
      
      	__s32		key_id;
      	__u32		in_len;
      	__u32		out_len;
      	__u32		in2_len;
      
           For a given operation, the in and out buffers are used as follows:
      
      	Operation ID		in,in_len	out,out_len	in2,in2_len
      	=======================	===============	===============	===========
      	KEYCTL_PKEY_ENCRYPT	Raw data	Encrypted data	-
      	KEYCTL_PKEY_DECRYPT	Encrypted data	Raw data	-
      	KEYCTL_PKEY_SIGN	Raw data	Signature	-
      	KEYCTL_PKEY_VERIFY	Raw data	-		Signature
      
           info is a string of key=value pairs that supply supplementary
           information.
      
           The __spare space in the parameter block must be set to 0.  This is
           intended, amongst other things, to allow the passing of passphrases
           required to unlock a key.
      
           If successful, encrypt, decrypt and sign all return the amount of data
           written into the output buffer.  Verification returns 0 on success.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Tested-by: NMarcel Holtmann <marcel@holtmann.org>
      Reviewed-by: NMarcel Holtmann <marcel@holtmann.org>
      Reviewed-by: NDenis Kenzior <denkenz@gmail.com>
      Tested-by: NDenis Kenzior <denkenz@gmail.com>
      Signed-off-by: NJames Morris <james.morris@microsoft.com>
      00d60fd3
  9. 19 10月, 2018 2 次提交
  10. 13 10月, 2018 1 次提交
    • A
      apparmor: add #ifdef checks for secmark filtering · e1af4779
      Arnd Bergmann 提交于
      The newly added code fails to build when either SECMARK or
      NETFILTER are disabled:
      
      security/apparmor/lsm.c: In function 'apparmor_socket_sock_rcv_skb':
      security/apparmor/lsm.c:1138:12: error: 'struct sk_buff' has no member named 'secmark'; did you mean 'mark'?
      
      security/apparmor/lsm.c:1671:21: error: 'struct nf_hook_state' declared inside parameter list will not be visible outside of this definition or declaration [-Werror]
      
      Add a set of #ifdef checks around it to only enable the code that
      we can compile and that makes sense in that configuration.
      
      Fixes: ab9f2115 ("apparmor: Allow filtering based on secmark policy")
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJohn Johansen <john.johansen@canonical.com>
      e1af4779
  11. 11 10月, 2018 9 次提交