~sforshee/ubuntu/+source/linux/+git/focal:lp1866909

Last commit made on 2020-04-02
Get this branch:
git clone -b lp1866909 https://git.launchpad.net/~sforshee/ubuntu/+source/linux/+git/focal
Only Seth Forshee can upload to this branch. If you are Seth Forshee please log in for upload directions.

Branch merges

Branch information

Name:
lp1866909
Repository:
lp:~sforshee/ubuntu/+source/linux/+git/focal

Recent commits

b716884... by Seth Forshee

UBUNTU: [Config] Enable configs for OpenPOWER NV Secure & Trusted Boot

BugLink: https://bugs.launchpad.net/bugs/1855668
BugLink: https://bugs.launchpad.net/bugs/1866909
Signed-off-by: Seth Forshee <email address hidden>

9e492d4... by Daniel Axtens

UBUNTU: SAUCE: (lockdown) powerpc: lock down kernel in secure/trusted boot

BugLink: https://bugs.launchpad.net/bugs/1855668

PowerNV has recently gained Secure and Trusted Boot support. If either of
these are enabled through the firmware and bootloader stack, then lock down
the kernel.

Signed-off-by: Daniel Axtens <email address hidden>
Signed-off-by: Seth Forshee <email address hidden>

532751e... by Nayna Jain <email address hidden>

powerpc: Load firmware trusted keys/hashes into kernel keyring

BugLink: https://bugs.launchpad.net/bugs/1866909

The keys used to verify the Host OS kernel are managed by firmware as
secure variables. This patch loads the verification keys into the
.platform keyring and revocation hashes into .blacklist keyring. This
enables verification and loading of the kernels signed by the boot
time keys which are trusted by firmware.

Signed-off-by: Nayna Jain <email address hidden>
Reviewed-by: Mimi Zohar <email address hidden>
Signed-off-by: Eric Richter <email address hidden>
[mpe: Search by compatible in load_powerpc_certs(), not using format]
Signed-off-by: Michael Ellerman <email address hidden>
Link: https://<email address hidden>
(cherry picked from commit 8220e22d11a05049aab9693839ab82e5e177ccde)
Signed-off-by: Seth Forshee <email address hidden>

d4005ef... by Nayna Jain <email address hidden>

x86/efi: move common keyring handler functions to new file

BugLink: https://bugs.launchpad.net/bugs/1866909

The handlers to add the keys to the .platform keyring and blacklisted
hashes to the .blacklist keyring is common for both the uefi and powerpc
mechanisms of loading the keys/hashes from the firmware.

This patch moves the common code from load_uefi.c to keyring_handler.c

Signed-off-by: Nayna Jain <email address hidden>
Acked-by: Mimi Zohar <email address hidden>
Signed-off-by: Eric Richter <email address hidden>
Signed-off-by: Michael Ellerman <email address hidden>
Link: https://<email address hidden>
(cherry picked from commit ad723674d6758478829ee766e3f1a2a24d56236f)
Signed-off-by: Seth Forshee <email address hidden>

9ce2004... by Nayna Jain <email address hidden>

powerpc: expose secure variables to userspace via sysfs

BugLink: https://bugs.launchpad.net/bugs/1866909

PowerNV secure variables, which store the keys used for OS kernel
verification, are managed by the firmware. These secure variables need to
be accessed by the userspace for addition/deletion of the certificates.

This patch adds the sysfs interface to expose secure variables for PowerNV
secureboot. The users shall use this interface for manipulating
the keys stored in the secure variables.

Signed-off-by: Nayna Jain <email address hidden>
Reviewed-by: Greg Kroah-Hartman <email address hidden>
Signed-off-by: Eric Richter <email address hidden>
Signed-off-by: Michael Ellerman <email address hidden>
Link: https://<email address hidden>
(cherry picked from commit bd5d9c743d38f67d64ea1b512a461f6b5a5f6bec)
Signed-off-by: Seth Forshee <email address hidden>

e1f0335... by Nayna Jain <email address hidden>

powerpc/powernv: Add OPAL API interface to access secure variable

BugLink: https://bugs.launchpad.net/bugs/1866909

The X.509 certificates trusted by the platform and required to secure
boot the OS kernel are wrapped in secure variables, which are
controlled by OPAL.

This patch adds firmware/kernel interface to read and write OPAL
secure variables based on the unique key.

This support can be enabled using CONFIG_OPAL_SECVAR.

Signed-off-by: Claudio Carvalho <email address hidden>
Signed-off-by: Nayna Jain <email address hidden>
Signed-off-by: Eric Richter <email address hidden>
[mpe: Make secvar_ops __ro_after_init, only build opal-secvar.c if PPC_SECURE_BOOT=y]
Signed-off-by: Michael Ellerman <email address hidden>
Link: https://<email address hidden>
(cherry picked from commit 9155e2341aa8b5df057dc1c77633b33d1a4f17d2)
Signed-off-by: Seth Forshee <email address hidden>

36da47e... by Mimi Zohar <email address hidden>

powerpc/ima: Indicate kernel modules appended signatures are enforced

BugLink: https://bugs.launchpad.net/bugs/1866909

The arch specific kernel module policy rule requires kernel modules to
be signed, either as an IMA signature, stored as an xattr, or as an
appended signature. As a result, kernel modules appended signatures
could be enforced without "sig_enforce" being set or reflected in
/sys/module/module/parameters/sig_enforce. This patch sets
"sig_enforce".

Signed-off-by: Mimi Zohar <email address hidden>
Signed-off-by: Michael Ellerman <email address hidden>
Link: https://<email address hidden>
(cherry picked from commit d72ea4915c7e6fa5e7b9022a34df66e375bfe46c)
Signed-off-by: Seth Forshee <email address hidden>

fcd2843... by Nayna Jain <email address hidden>

powerpc/ima: Update ima arch policy to check for blacklist

BugLink: https://bugs.launchpad.net/bugs/1866909

This patch updates the arch-specific policies for PowerNV system to
make sure that the binary hash is not blacklisted.

Signed-off-by: Nayna Jain <email address hidden>
Signed-off-by: Mimi Zohar <email address hidden>
Signed-off-by: Michael Ellerman <email address hidden>
Link: https://<email address hidden>
(cherry picked from commit dc87f18615db9dc74a75cfb4a57ed33b07a3903a)
Signed-off-by: Seth Forshee <email address hidden>

28e86b3... by Nayna Jain <email address hidden>

ima: Check against blacklisted hashes for files with modsig

BugLink: https://bugs.launchpad.net/bugs/1866909

Asymmetric private keys are used to sign multiple files. The kernel
currently supports checking against blacklisted keys. However, if the
public key is blacklisted, any file signed by the blacklisted key will
automatically fail signature verification. Blacklisting the public key
is not fine enough granularity, as we might want to only blacklist a
particular file.

This patch adds support for checking against the blacklisted hash of
the file, without the appended signature, based on the IMA policy. It
defines a new policy option "appraise_flag=check_blacklist".

In addition to the blacklisted binary hashes stored in the firmware
"dbx" variable, the Linux kernel may be configured to load blacklisted
binary hashes onto the .blacklist keyring as well. The following
example shows how to blacklist a specific kernel module hash.

  $ sha256sum kernel/kheaders.ko
  77fa889b35a05338ec52e51591c1b89d4c8d1c99a21251d7c22b1a8642a6bad3
  kernel/kheaders.ko

  $ grep BLACKLIST .config
  CONFIG_SYSTEM_BLACKLIST_KEYRING=y
  CONFIG_SYSTEM_BLACKLIST_HASH_LIST="blacklist-hash-list"

  $ cat certs/blacklist-hash-list
  "bin:77fa889b35a05338ec52e51591c1b89d4c8d1c99a21251d7c22b1a8642a6bad3"

Update the IMA custom measurement and appraisal policy
rules (/etc/ima-policy):

  measure func=MODULE_CHECK template=ima-modsig
  appraise func=MODULE_CHECK appraise_flag=check_blacklist
  appraise_type=imasig|modsig

After building, installing, and rebooting the kernel:

   545660333 ---lswrv 0 0 \_ blacklist:
  bin:77fa889b35a05338ec52e51591c1b89d4c8d1c99a21251d7c22b1a8642a6bad3

  measure func=MODULE_CHECK template=ima-modsig
  appraise func=MODULE_CHECK appraise_flag=check_blacklist
  appraise_type=imasig|modsig

  modprobe: ERROR: could not insert 'kheaders': Permission denied

  10 0c9834db5a0182c1fb0cdc5d3adcf11a11fd83dd ima-sig
  sha256:3bc6ed4f0b4d6e31bc1dbc9ef844605abc7afdc6d81a57d77a1ec9407997c40
  2 /usr/lib/modules/5.4.0-rc3+/kernel/kernel/kheaders.ko

  10 82aad2bcc3fa8ed94762356b5c14838f3bcfa6a0 ima-modsig
  sha256:3bc6ed4f0b4d6e31bc1dbc9ef844605abc7afdc6d81a57d77a1ec9407997c40
  2 /usr/lib/modules/5.4.0rc3+/kernel/kernel/kheaders.ko sha256:77fa889b3
  5a05338ec52e51591c1b89d4c8d1c99a21251d7c22b1a8642a6bad3
  3082029a06092a864886f70d010702a082028b30820287020101310d300b0609608648
  016503040201300b06092a864886f70d01070131820264....

  10 25b72217cc1152b44b134ce2cd68f12dfb71acb3 ima-buf
  sha256:8b58427fedcf8f4b20bc8dc007f2e232bf7285d7b93a66476321f9c2a3aa132
  b blacklisted-hash
  77fa889b35a05338ec52e51591c1b89d4c8d1c99a21251d7c22b1a8642a6bad3

Signed-off-by: Nayna Jain <email address hidden>
[<email address hidden>: updated patch description]
Signed-off-by: Mimi Zohar <email address hidden>
Signed-off-by: Michael Ellerman <email address hidden>
Link: https://<email address hidden>
(cherry picked from commit 273df864cf7466fb170b8dcc1abd672cd08ad8d3)
Signed-off-by: Seth Forshee <email address hidden>

37c8d78... by Nayna Jain <email address hidden>

certs: Add wrapper function to check blacklisted binary hash

BugLink: https://bugs.launchpad.net/bugs/1866909

The -EKEYREJECTED error returned by existing is_hash_blacklisted() is
misleading when called for checking against blacklisted hash of a
binary.

This patch adds a wrapper function is_binary_blacklisted() to return
-EPERM error if binary is blacklisted.

Signed-off-by: Nayna Jain <email address hidden>
Reviewed-by: Mimi Zohar <email address hidden>
Signed-off-by: Michael Ellerman <email address hidden>
Link: https://<email address hidden>
(cherry picked from commit 2434f7d2d488c3301ae81f1031e1c66c6f076fb7)
Signed-off-by: Seth Forshee <email address hidden>