Commit Graph

461 Commits

Author SHA1 Message Date
jussike
f1447e3896 Typo fix: Don't enforce to use RPM 2021-01-14 22:39:03 +08:00
Bartłomiej Burdukiewicz
50a847007d conf/layer.conf: Add gatesgarth to LAYERSERIES_COMPAT
Signed-off-by: Bartłomiej Burdukiewicz <bartlomiej.burdukiewicz@gmail.com>
2020-12-09 09:17:12 +08:00
Yi Zhao
ca1c4bc784 user-key-store.bbclass: exclude ${GPG_PATH} from pseudo database
Adapt to recent psuedo changes.

Fixes:
ERROR: grub-efi-2.04-r0 do_sign: Failed to import gpg key
gpg: key 9E3086F96EEECC34/9E3086F96EEECC34: error sending to agent: End of file

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-12-09 09:16:54 +08:00
Corey Cothrum
8adff592ef create-user-key-store.sh: allow user to specify openssl x509 'days' param
allow openssl x509 '--days' parameter to be specified via command line argument

Signed-off-by: Corey Cothrum <contact@coreycothrum.com>
2020-12-09 09:16:29 +08:00
Yi Zhao
d6ca3fa224 rpm: apply signatures to config files
Since rpm 4.15, the users can control over the installation of
signatures on config files through a variable named
%_ima_sign_config_files. But this is disabled by default. Add a macro
configuration file to enable it.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-12-08 22:03:59 +08:00
Yongxin Liu
628949305c meta-encrypted-storage: set CONFIG_HW_RANDOM_TPM to "y"
CONFIG_HW_RANDOM_TPM is bool, not tristate, and thus it cannot be
set to "m"

Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
2020-11-11 15:15:40 +08:00
Yi Zhao
2747958070 grub-efi: refresh patch
Refresh mok2verify-support-to-verify-non-PE-file-with-PKCS-7.patch to
adapt the recent CVEs fixing.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-11-10 10:36:25 +08:00
Ovidiu Panait
a32ddd2b2a check_gpg_key: Fix gpg-agent.conf creation race condition
If GPG_PATH is already created by signing-keys do_get_public_keys task,
subsequent executions of do_package_write_rpm will not create the
gpg-agent.conf file anymore.

Therefore, the spawned gpg-agent will miss important features such as
auto-expand-secmem, leading to the following intermittent build errors:
....
Subprocess output:
gpg: signing failed: Cannot allocate memory
gpg: signing failed: Cannot allocate memory
error: gpg exec failed (2)
gpg: signing failed: Cannot allocate memory
gpg: signing failed: Cannot allocate memory
error: gpg exec failed (2)
...

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2020-10-19 19:32:49 +08:00
Hongxu Jia
696ee1495c grub-efi-efi-secure-boot.inc: Adapt to potential psuedo changes
If we do adopt path filtering for pseudo, we may filter out ${DEPLOY_DIR}
as not needing to be tracked for "root" permissions. but we do track
the data in ${D} though, when we copy file from ${D} to ${DEPLOY_DIR},
pseudo report a failure
...
|cp: failed to preserve ownership for 'tmp-glibc/work/corei7-64-wrs-linux/
grub-efi/2.04-r0/deploy-grub-efi/efi-unsigned/x86_64-efi/fdt.lst'
: Operation not permitted
...

Disable pseudo for the copy operation

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
2020-10-14 19:40:03 +08:00
Yongxin Liu
0233437224 ima: Fix badly formatted CONFIG_IMA_NG_TEMPLATE
Fix the following warning:

[INFO]: the following symbols were not found in the active configuration:

     - CONFIG_IMA_NG_TEMPLATE=y

Signed-off-by: Yongxin Liu <yongxin.liu@windriver.com>
2020-10-12 09:41:33 +08:00
Chen Qi
4d59dc3037 trousers: fix build failure for gcc-10
gcc-10 uses '-fno-common' by default, causing build error of
multiple definition. Use '-fcommon' to fix this problem.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
2020-09-23 15:57:43 +08:00
Mingli Yu
6c64d71334 tpm2-abrmd: Remove obsolete setting regarding the Standard Output
The Standard output type "syslog" is obsolete, causing a warning since systemd
version 246 [1].

Please consider using "journal" or "journal+console"

[1] https://github.com/systemd/systemd/blob/master/NEWS#L202

Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
2020-09-23 12:57:44 +08:00
David Dunlap
070f7359b5 create-user-key-store.sh: replace weak des3 encryption with aes256
Replace weak des3 encryption with more secure algorithm aes256 to
generate ima key in script create-user-key-store.sh.

Signed-off-by: David Dunlap <david.dunlap@windriver.com>
Signed-off-by: Kai Kang <kai.kang@windriver.com>
2020-09-15 10:05:40 +08:00
Yi Zhao
7ee985e53f trousers: update to latest git rev
Security fixes:

CVE-2020-24332
If the tcsd daemon is started with root privileges,
the creation of the system.data file is prone to symlink attacks

CVE-2020-24330
If the tcsd daemon is started with root privileges,
it fails to drop the root gid after it is no longer needed

CVE-2020-24331
If the tcsd daemon is started with root privileges,
the tss user has read and write access to the /etc/tcsd.conf file

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-09-01 09:12:59 +08:00
Yi Zhao
960cffb107 tpm2-tools: upgrade 4.1.1 -> 4.1.3
* License-Update: BSD -> BSD-3-Clause
* Add a patch to switch to python3 in test scripts

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-07-22 17:30:26 +08:00
Yi Zhao
6830825188 tpm2-tss: upgrade 2.3.2 -> 2.3.3
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-07-22 17:30:26 +08:00
Yi Zhao
d560bafc49 tpm2-abrmd: upgrade 2.3.0 -> 2.3.2
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-07-22 17:30:26 +08:00
Yi Zhao
0b1d3ee1d1 libsign: update to latest git revision
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-07-20 09:42:09 +08:00
Yi Zhao
ddbcb4722a cyrptfs-tpm2: set correct soname for libcryptfs-tpm2
The current soname of libcryptfs-tpm2 is libcryptfs-tpm2.so:
$ readelf -d libcryptfs-tpm2.so.0.7.0 | grep SONAME
0x000000000000000e (SONAME)    Library soname: [libcryptfs-tpm2.so]

The libcryptfs-tpm2.so is a symbolic link of libcryptfs-tmp2.so.0.7.0
and it is not installed by default because it is packaged to dev
package. Then we will encounter an error when run command cryptfs-tpm2:
$ cryptfs-tpm2
cryptfs-tpm2: error while loading shared libraries: libcryptfs-tpm2.so:
cannot open shared object file: No such file or directory
$ ldd cryptfs-tpm2 | grep libcryptfs-tpm2
    libcryptfs-tpm2.so => not found

Set the soname to libcryptfs-tpm2.so.$(MAJOR_VERSION) to fix the issue.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-07-18 20:46:44 +08:00
Yi Zhao
3801a7e716 tpm2-abrmd: rdepends on libtss2-tcti-device and libtss2-tcti-mssim
The tpm2-abrmd daemon needs TCTI library for TPM2 device or simulator.
But the libtss2-tcti-device and libtss2-tcti-mssim packages are not
installed by default which causes the tpm2-abrmd daemon startup failure:

systemd[1]: Starting TPM2 Access Broker and Resource Management Daemon...
tpm2-abrmd[459]: tcti_conf before: "device:/dev/tpm0"
tpm2-abrmd[459]: tcti_conf after: "device:/dev/tpm0"
tpm2-abrmd[459]: ERROR:tcti:../tpm2-tss-2.3.2/src/tss2-tcti/tctildr.c:418:Tss2_TctiLdr_Initialize_Ex() Failed to instantiate TCTI
tpm2-abrmd[459]: init_thread_func: failed to create TCTI with conf "device:/dev/tpm0"
tpm2-abrmd[459]: g_bus_unown_name: assertion 'owner_id > 0' failed

Add libtss2-tcti-device and libtss2-tcti-mssim to runtime dependencies.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-07-15 16:49:12 +08:00
Changqing Li
c61b8157fb tpm2-tss: support usrmerge
fix do_package_qa error:
ERROR: QA Issue: tpm2-tss package is not obeying usrmerge distro feature. /lib should be relocated to /usr. [usrmerge]

Signed-off-by: Changqing Li <changqing.li@windriver.com>
2020-07-02 22:16:43 +08:00
richard
3590e302df update tpm2-tools_3.2.1 -> tpm2-tools_4.1.1.bb, tpm2-abrmd_2.0.3 -> tpm2-abrmd_2.3.0, tpm2-tss_2.2.3.bb -> tpm2-tss_2.3.2.bb 2020-06-27 19:01:35 +08:00
Kai Kang
c39b30e99f key-store: fix rdepends with multilib
It shows qa issue when multilib is enabled:

| ERROR: lib32-key-store-0.1-r0 do_package: QA Issue:
   lib32-key-store package lib32-key-store-rpm-pubkey - suspicious values 'rpm' in RDEPENDS [multilib]

Prepend MLPREFIX to runtime dependency 'rpm' to fix the issue.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
2020-06-12 12:20:56 +08:00
Christophe Priouzeau
ac1ec689f2 conf/layer.conf: Add dunfell to LAYERSERIES_COMPAT
Signed-off-by: Christophe Priouzeau <christophe.priouzeau@st.com>
2020-05-27 08:22:24 +08:00
De Huo
fc8969af8a user-key-store.bbclass: Kill gpg agent daemon after gpg sign
The gpg-agent daemon will be triggered to run in function boot_sign,
This daemon will not exit even after building project.
So kill the gpg-agent daemon after gpg signing process
at the end of function boot_sign.

Signed-off-by: De Huo <De.Huo@windriver.com>
2020-04-27 18:48:43 +08:00
De Huo
33d90d92b0 create-user-key-store.sh: Fix defect about invalid option "--pinentry-mode=loopback"
The option --pinentry-mode is not supported in gpg 2.0.22 code.
so when the host gpg version is 2.0.22 the option will be removed.
Start gpg-agent daemon when gpg-connect-agent reload agent failed.
Otherwise there will be below failure message reported.
gpg: can't connect to the agent - trying fall back
gpg: can't connect to the agent: IPC connect call failed
gpg: problem with the agent: No agent running

Signed-off-by: De Huo <De.Huo@windriver.com>
2020-04-16 20:22:56 +08:00
Hongxu Jia
8834753407 Revert "Removed unneeded patch to fix compilation error in efi-tool's console.c"
The patch to fix compilation error in efi-tool's console.c is required

This reverts commit a6c3d9fcd2.

In <=gnu-efi-3.0.9 variable is named EFI_WARN_UNKOWN_GLYPH, and
in gnu-efi-3.0.11 is renamed in EFI_WARN_UNKNOWN_GLYPH. The patch is
only for users with installed >=gnu-efi-3.0.11 because is in this
version that variable has changed name from EFI_WARN_UNKOWN_GLYPH
to EFI_WARN_UNKNOWN_GLYPH. [1]

In oe-core master branch, the gnu-efi is 3.0.11, we need to add
the fix back

[1] https://bugs.gentoo.org/701152

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
2020-04-16 16:33:23 +08:00
Hongxu Jia
82c404fe33 ovmf_%.bbappend: tweak do_sign task order to avoid racing issue
If ovmf's do_deploy is run before do_sign, there is a failure
...
|install: cannot stat 'tmp-glibc/work/corei7-64-wrs-linux/ovmf/
edk2-stable201911-r0/ovmf/Pkcs7VerifyDxe.efi.signed': No such file or directory
...

Add do_sign before do_deploy

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
2020-04-10 16:12:35 +08:00
Abdelrahman Ibrahem
a6c3d9fcd2 Removed unneeded patch to fix compilation error in efi-tool's console.c 2020-04-08 21:52:18 +08:00
Yi Zhao
e8e80fb7c4 cryptfs-tpm2: convert the script to python3
Convert the script to python3 to fix the do_compile failure.

Fixes:
/buildarea/poky/build/tmp/work/core2-64-poky-linux/cryptfs-tpm2/0.7.0+gitAUTOINC+888c46c827-r0/git/scripts/encrypt_secret.py -i "H31i05" > "primary_key.secret" || exit 1
/usr/bin/env: ‘python’: No such file or directory
Makefile:64: recipe for target 'primary_key.secret' failed

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-03-19 10:47:24 +08:00
Yi Zhao
f2d06cda8d meta-tpm2: add dependency on meta-python2
Fixes:
ERROR: ParseError at
/buildarea/poky/meta-secure-core/meta-tpm2/recipes-devtools/python/python-beautifulsoup4_4.4.1.bb:19:
Could not inherit file classes/setuptools.bbclass

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-03-19 10:47:24 +08:00
Yi Zhao
6faa083706 tpm2-tools: only support python3 in test scripts
The python2 is removed from oe-core and there is no python symblic link
by default which will cause an error when running test scripts:

$ ./test_tpm2_activecredential.sh: line 66: python: command not found

So drop python2 support and only keep python3.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-03-13 20:29:08 +08:00
Yi Zhao
b0d0273ae2 tpm2-tools: fix yaml.load warning in test scripts
The yaml.load(f) is deprecated since pyyaml 5.1.
Use yaml.load(f, Loader=yaml.BaseLoader) instead of it.
See https://github.com/yaml/pyyaml/wiki/PyYAML-yaml.load(input)-Deprecation

Fixes warning:
YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated,
as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-03-13 20:29:08 +08:00
Yi Zhao
7db0fc79df tpm2simulator-native: update to latest git revision
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-03-10 10:22:02 +08:00
Yi Zhao
1989109180 tpm2-tools: upgrade 3.2.0 -> 3.2.1
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-03-10 10:22:02 +08:00
Ovidiu Panait
8f9f83a40a fixup! sign_rpm_ext: Use socket redirection to avoid GPG_PATH length limitation
If GPG_PATH is already created by signing-keys do_get_public_keys task,
subsequent executions of do_package_write_rpm will fail with "Filename too
long" errors (this only affects builds using GPG paths larger than 80
characters).

Fix this race condition by making sure that the redirection files are always
present in the gpg homedir even if the directory already exists when the first
package_write_rpm task executes.

Also, make sure this new approach does not affect GPG_PATHs smaller than 80
chars.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2020-03-03 22:47:06 +08:00
richard
d496407fc1 modified grub-efi-efi-secure-boot.inc to install also the grub configuration files in the DEPLOYDIR 2020-03-01 19:27:54 +08:00
Drew Moseley
b003c7fcea Add additional *_KEYS_DIR to keys.conf
Signed-off-by: Drew Moseley <drew.moseley@northern.tech>
2020-03-01 19:27:08 +08:00
Ovidiu Panait
b1dee36ce6 sign_rpm_ext: Use socket redirection to avoid GPG_PATH length limitation
Currently, an error will be thrown when trying to use a GPG homedir whose path
length exceeds 80 characters. This limitation can be worked around by providing
libassuan socket redirection files for "S.gpg-agent.yocto-native",
"S.gpg-agent.ssh", "S.gpg-agent.browser" and "S.gpg-agent.extra"
sockets. The redirection files will point to the real sockets in /tmp
directory. The sockets will be automatically cleaned up by gpg agent.

References:
[1] https://dev.gnupg.org/T1752
[2] https://gnupg.org/documentation/manuals/assuan.pdf

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2020-03-01 19:26:24 +08:00
Liwei Song
8853e39b1e initramfs: adjust task order to aviod initrd symlink unavailable
adjust task order to make sure initrd symlink is ready before
do package.

Signed-off-by: Liwei Song <liwei.song@windriver.com>
2020-02-27 16:24:34 +08:00
Kai Kang
c901ee5ff8 tpm-tools: inherit perlnative.bbclass
tpm-tools calls pod2man to produce manual files. But pod2man has been
removed from hosttools in oe-core. So it fails occasionally when in some
certain condition .pod file is newer than corresponding man page files
that man files need to be reproduced:

| make[3]: Entering directory 'TOPDIR/tmp-glibc/work/ppc7400-wrs-linux/tpm-tools/1.3.9.1+gitAUTOINC+bdf9f1bc8f-r0/git/man/man8'
| /bin/bash: pod2man: command not found
| make[3]: *** [Makefile:575: tpm_nvwrite.8] Error 127

Inherit perlnative to fix such issue.

Signed-off-by: Kai Kang <kai.kang@windriver.com>
2020-02-13 13:54:11 +08:00
Yi Zhao
8302e3c479 ima-inspect: upgrade 0.11 -> 0.13
Fixes:
* Use glibc header instead of libattr header because the attr/xattr.h
  has been removed from attr package.
* fix configure check for newer libimaevm versions.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2020-01-19 11:52:46 +08:00
Sandra Tobajas
84ee95f92a linux-yocto: remove unused FILESEXTRAPATHS_prepend
Signed-off-by: Sandra Tobajas <sandra.tobajas@savoirfairelinux.com>
2020-01-16 08:35:40 +08:00
Sandra Tobajas
561800fe3f grub-efi-efi-secure-boot.inc: append do_deploy instead overriding it
Append do_deploy function instead of overriding it.

Signed-off-by: Sandra Tobajas <sandra.tobajas@savoirfairelinux.com>
2020-01-16 08:35:40 +08:00
Sandra Tobajas
b2eb24569b user-key-store.bbclass: let MOK_SB be overrided
If efi-secure-boot distro feature is enabled, let the possibility to
enable only the UEFI SecureBoot (through UEFI_SB Bitbake variable)
without MOK_SB variable.

Allow explicitly overriding the MOK_SB Bitbake variable.

Signed-off-by: Sandra Tobajas <sandra.tobajas@savoirfairelinux.com>
2020-01-16 08:35:40 +08:00
Sandra Tobajas
44a12b93b1 grub-efi-efi-secure-boot.inc: let EFI_BOOT_PATH be overrided
Let the EFI_BOOT_PATH Bitbake variable be overrided if needed.

Signed-off-by: Sandra Tobajas <sandra.tobajas@savoirfairelinux.com>
2020-01-16 08:35:40 +08:00
Changqing Li
8a518a2054 mokutil: fix typo
Signed-off-by: Changqing Li <changqing.li@windriver.com>
2019-12-30 18:57:07 +08:00
Yi Zhao
c0e7d60718 grub-efi-efi-secure-boot.inc: use task_prepend instead of prefuncs for do_sign
The grub-efi-native build doesn't need to run do_sign task but there are
two prefuncs for do_sign still run in native build. This will cause a
build error when there is no gpg command on the host. Move the functions
to do_sign_prepend_class-target to make sure they only run in target
build.

Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
2019-12-13 18:50:47 +08:00
Jason Wessel
f59b77b257 user-key-store.bbclass: Depend on gnupg-native to always use provided gpg
On some host configuration such as ubuntu 16.04 the gnupg in /usr/bin
is the 1.x version.  This can cause problems between the import and
signing process if the gpg version is different.  The commands in the
user-key-store class assume gnupg is at least version 2.2 or newer.

To avoid the signing phase failing for the efitools and the kernel,
the user-key-store class should depend on the gnupg-native binaries.

It avoids this specific error:

ERROR: efitools-1.9.2+gitAUTOINC+392836a46c-r0 do_sign: Failed to sign: /opt/tmp-glibc/work/corei7-64-wrs-linux/efitools/1.9.2+gitAUTOINC+392836a46c-r0/image/boot/efi/EFI/BOOT/LockDown.efi
ERROR: Logfile of failure stored in: /opt/tmp-glibc/work/corei7-64-wrs-linux/efitools/1.9.2+gitAUTOINC+392836a46c-r0/temp/log.do_sign.22969
NOTE: recipe efitools-1.9.2+gitAUTOINC+392836a46c-r0: task do_sign: Failed

[ Issue: LIN1019-3757 ]

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
2019-12-13 09:02:14 +08:00
Ovidiu Panait
e4e766aa40 rpm-integrity: Use _append for PACKAGECONFIG
Currently, the PACKAGECONFIG assignment in rpm-integrity might overwrite
the previous contents of the variable.

Similar to systemd_%.bbappend and ovmf_%.bbappend, use _append to add
"imaevm" to PACKAGECONFIG when distro feature ima is enabled.

Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
2019-12-13 09:01:39 +08:00