Commit Graph

210 Commits

Author SHA1 Message Date
Alex Carter
1b86be65f2 osbuilder: Switch to online_sev_kbc
Adds AA_KBC option in rootfs builder to specify online_sev_kbc into the initrd.
Guid and secret type for sev updated in shim makefile to generate default config
KBC URI will be specified via kernel_params
Also changing the default option for sev in the local build scipts
Making sure sev guest kernel module is copied into the initrd. Will also eventually be needed for SNP

Fixes: #5650
Signed-off-by: Alex Carter <Alex.Carter@ibm.com>
2023-01-04 04:04:13 +00:00
Megan Wright
e2341c1b33 CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #5932
Signed-off-by: Megan Wright <megan.wright@ibm.com>
2022-12-20 09:34:27 +00:00
Georgina Kinge
332a425145 CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #5905
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2022-12-14 14:55:23 +00:00
Binbin Zhang
ae0dcacd4a tools: Add some new gitignore items
Add some new ignore items to avoid local builds that cause git to track a lot of files

Fixes: #5900

Signed-off-by: Binbin Zhang <binbin36520@gmail.com>
2022-12-14 11:38:23 +08:00
stevenhorsman
578ee62da2 CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #5824
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-12-02 16:15:39 +00:00
Manabu Sugimoto
a75f99d20d osbuilder: Create guest image for SELinux
Create a guest image to support SELinux for containers inside the guest
if `SELINUX=yes` is specified. This works only if the guest rootfs is
CentOS and the init service is systemd, not the agent init. To enable
labeling the guest image on the host, selinuxfs must be mounted on the
host. The kata-agent will be labeled as `container_runtime_exec_t` type.

Fixes: #4812

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2022-11-29 13:32:26 +09:00
Fabiano Fidêncio
05db886e27 osbuilder: Remove non-needed packages at the end
Instead of removing the non-needed packages under `/usr/share` and then
installing new components, let's make sure we do the removal at the end
of our script.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-03 11:35:45 +01:00
Fabiano Fidêncio
af75ce04c1 osbuilder: Manually add universe repo
Let's do that instead of updating and installing the
`software-properties-common` package, as it reduces the final size of
the image.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-03 11:35:45 +01:00
Fabiano Fidêncio
68956ad127 osbuilder: Add /etc/tdx-attest.conf when using eaa_kbc
First of all, EAA KBC is only used with TDX, thus we can safely assume
that eaa_kbc means TDX, at least for now.

A `/etc/tdx-attest.conf` file, with the data "port=4050" is needed as
that's the default configuration for the Quote Generation Service (QGS)
which is present on the guest side.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-03 11:35:45 +01:00
Steve Horsman
5f5b4f7da9 Merge pull request #5374 from Alex-Carter01/AA-tag-version
osbuilder: specify Attestation Agent tag for rootfs build
2022-11-01 17:42:35 +00:00
Fabiano Fidêncio
a1571721dd osbuilder: Install rats-tls-tdx
Inclavare released a rats-tls-tdx package, which we depend on for using
verdictd.

Let's install it when using EAA_KBC, as already done for the rats-tls
package.

One thin to note here is that rats-tls-tdx depends on libtdx-attest,
which depends on libprotobuf-c1, thus we had to add the intel-sgx repo
together with enabling the universe channel.

Fixes: #5543

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-10-31 13:11:37 +01:00
Fabiano Fidêncio
5885f005f1 ubuntu: 20.04 is focal, not bionic
Let's use the correct OS version name for Ubuntu 20.04.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-10-31 10:46:41 +01:00
Fabiano Fidêncio
30990872f1 ubuntu: Ensure RATS-TLS is only installed on 20.04
We're currently using Ubuntu 20.04 as the base for the Ubuntu rootfs,
meaning that right now there's no issue with the approach currently
taken.  However, if we do a bump of an Ubuntu version, we could face
issues as the rats-tls package is only provided for Ubuntu 20.04.

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-10-31 09:26:23 +01:00
Alex Carter
63e6abfa9d osbuilder: specify Attestation Agent tag for rootfs build
Add tag entry to the attestation agent entry of the versions file.
Checkout tag commit after cloning AA in rootfs builder.

Fixes: #5373
Fixes: kata-containers#5373
Signed-Off-By: Alex Carter <alex.carter@ibm.com>
2022-10-27 16:21:37 +00:00
Yuan-Zhuo
d7bb4b5512 agent: support systemd cgroup for kata agent
1. Implemented a rust module for operating cgroups through systemd with the help of zbus (src/agent/rustjail/src/cgroups/systemd).
2. Add support for optional cgroup configuration through fs and systemd at agent (src/agent/rustjail/src/container.rs).
3. Described the usage and supported properties of the agent systemd cgroup (docs/design/agent-systemd-cgroup.md).

Fixes: #4336

Signed-off-by: Yuan-Zhuo <yuanzhuo0118@outlook.com>
2022-10-25 13:57:09 +08:00
Fabiano Fidêncio
53bcaf0547 Merge pull request #5314 from anakrish/anakrish-ccv0-optimize-integrity-no-wipe
CCv0: Optimize integrity device creation by avoiding a full device clear
2022-10-21 09:37:44 +02:00
Anand Krishnamoorthi
4906228701 CCv0: Optimize integrity device creation by avoiding full device clear
Based on https://gitlab.com/cryptsetup/cryptsetup/-/issues/525

1. When --no-wipe is used, the device will have invalid checksums
2. mkfs.ext4 would fail on an un-wiped device due to reads of pages with
   invalid checksums
3. To make mkfs.ext4 work
   - Perform a dry run to figure out which sectors (pages) mkfs.ext4 will
     write to.
   - Perform directe writes to these pages to ensure that they will have
     valid checksums
   - Invoke mkfs.ext4 again to perform initialization
4 Use lazy_journal_init option with mkfs.ext4 to lazily initialize the journal.
  According to the man pages,
  "This speeds up file system initialization  noticeably, but carries some small
   risk if the system crashes before the  journal  has  been overwritten  entirely
   one time."
  Since the storage is ephemeral, not expected to survive a system crash/power cycle,
  it is safe to use lazy_journal_init.

Fixes #5329

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
2022-10-05 12:29:54 -07:00
Georgina Kinge
8c3846d431 CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #5327
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2022-10-05 16:34:02 +01:00
stevenhorsman
c9af89d094 osbuilder: don't pull in umoci with attestation
Umoci is not longer required if we have the attestation-agent, so don't
override the user input

Fixes: #5237
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-09-23 09:33:35 +01:00
Gabriela Cervantes
a4a23457ca osbuilder: Export directory variables for libseccomp
To avoid the random failures when we are building the rootfs as it seems
that it does not find the value for the libseccomp and gperf directory,
this PR export these variables.

Fixes #5232

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2022-09-22 21:45:20 +00:00
Alex Carter
59537ceb2d osbuilder: CC, add kmod to rootfs builder docker environment
To use depmod in the rootfs builder, the docker environment will require kmod.

Fixes: kata-containers#5125

Signed-Off-By: Alex Carter <alex.carter@ibm.com>
2022-09-16 10:13:10 -04:00
Alex Carter
50a959e6cf osbuilder: CC use depmod in rootfs builder for kernel modules
Using depmod when adding kernel modules to get dependencies.

Needed for the efi secret module for sev.

Fixes: #5125

Signed-Off-By: Alex Carter <alex.carter@ibm.com>
2022-09-16 10:12:49 -04:00
Wainer Moschetta
c53f063acd Merge pull request #5024 from Alex-Carter01/rootfs-agent-config
CC | rootfs builder: add agent config file to rootfs for offline_sev_kbc
2022-09-16 10:25:30 -03:00
Alex Carter
9f643ac9c8 osbuilder: add CC's agent config file to rootfs for offline_sev_kbc
Adds default config file.
Adds case in rootfs.sh to copy config.

Fixes kata-containers#5023

Fixes: #5023

Signed-Off-By: Alex Carter <alex.carter@ibm.com>
2022-09-15 18:26:29 +00:00
Georgina Kinge
9931d4cbf0 CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #5054
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2022-08-31 15:01:40 +01:00
Fabiano Fidêncio
1b92a946d6 Merge pull request #4987 from ryansavino/initrd-fixes-for-ubuntu-systemd
Initrd fixes for ubuntu systemd
2022-08-30 09:16:43 +02:00
Ryan Savino
dc32c4622f osbuilder: fix ubuntu initrd /dev/ttyS0 hang
Guest log is showing a hang on systemd getty start.
Adding symlink for /dev/ttyS0 resolves issue.

Fixes: #4932

Signed-Off-By: Ryan Savino <ryan.savino@amd.com>
2022-08-26 04:59:36 -05:00
Ryan Savino
cc5f91dac7 osbuilder: add systemd symlinks for kata-agent
AGENT_INIT=no (systemd) add symlinks for kata-agent service.

Fixes: #4932

Signed-Off-By: Ryan Savino <ryan.savino@amd.com>
2022-08-26 04:59:36 -05:00
Wang, Arron
2611779255 image-build: generate root hash as an separate partition for rootfs
Generate rootfs hash data during creating the kata rootfs,
current kata image only have one partition, we add another
partition as hash device to save hash data of rootfs data blocks.

Fixes: #4966

Signed-off-by: Wang, Arron <arron.wang@intel.com>
2022-08-23 19:44:57 +08:00
Wang, Arron
4831193bde agent: initialize trusted storage device
Initialize the trusted stroage when the device is defined
as "/dev/trusted_store" with shell script as first step.

Fixes: #4882

Signed-off-by: Wang, Arron <arron.wang@intel.com>
2022-08-19 11:25:36 +02:00
Manabu Sugimoto
92f7d6bf8f ci: Use versions.yaml for the libseccomp
It would be nice to use `versions.yaml` for the maintainability.
Previously, we have been specified the `libseccomp` and the `gperf` version
directly in this script without using the `versions.yaml` because the current
snap workflow is incomplete and fails.
This is because snap CI environment does not have kata-cotnainers repository
under ${GOPATH}. To avoid the failure, the `rootfs.sh` extracts the libseccomp
version and url in advance and pass them to the `install_libseccomp.sh` as
environment variables.

Fixes: #4941

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2022-08-19 09:05:08 +09:00
Fabiano Fidêncio
bb196d56ca Merge pull request #4762 from arronwy/cryptsetup
CC | Add cryptsetup support in Guest kernel and rootfs
2022-08-17 08:51:14 +02:00
Arron Wang
edf3cba463 CCv0: Add cryptsetup support in Guest kernel and rootfs
Add required kernel config for dm-crypt/dm-integrity/dm-verity
and related crypto config.

Add userspace command line tools for disk encryption support
and ext4 file system utilities.

Fixes: #4761

Signed-off-by: Arron Wang <arron.wang@intel.com>
2022-08-15 10:55:41 +08:00
Wang, Arron
75b9f3fa3c osbuilder: Integrate pause image inside rootfs
For CoCo stack, the pause image is managed by host side,
then it may configure a malicious pause image, we need package
a pause image inside the rootfs and don't the pause image from host.

Fixes: #4768

Signed-off-by: Wang, Arron <arron.wang@intel.com>
2022-08-15 10:38:17 +08:00
Megan Wright
f4979a9aa5 CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #4651
Signed-off-by: Megan Wright <megan.wright@ibm.com>
2022-07-13 14:32:08 +01:00
Derek Lee
0e40ecf383 tools/snap: simplify nproc
Replaces calls of nproc	with nproc with

nproc ${CI:+--ignore 1}

to run nproc with one less processing unit than the maximum to prevent
DOS-ing the local machine.

If process is being run in a container (determined via whether $CI is
null), all processing units avaliable will be used.

Fixes #3967

Signed-off-by: Derek Lee <derlee@redhat.com>
2022-07-06 15:04:08 -07:00
Georgina Kinge
4f80ea1962 CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #4507
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2022-06-22 10:06:27 +01:00
James O. D. Hunt
e11fcf7d3c Merge pull request #4168 from Champ-Goblem/patch/fix-chronyd-failure-on-boot
rootfs: Fix chronyd.service failing on boot
2022-06-21 09:43:13 +01:00
Georgina Kinge
cfa3e1e933 Merge pull request #4354 from GeorginaKin/CCv0
CCv0: Refactor signature verification PoC changes
2022-06-20 13:01:07 +01:00
Georgina Kinge
a1e16ff6e0 CCv0: Refactor signature verification PoC changes
Removes signature verficiation files and related code

Fixes: #4111

Signed-off-by: Georgina Kinge <Georgina.Kinge@ibm.com>
Co-authored-by: Megan Wright <megan.wright@ibm.com>
2022-06-20 10:58:36 +01:00
stevenhorsman
9c73babdb2 osbuilder: Fix attestation-agent build
Fix of the attestation-agent build and install issue in rootfs.sh

Fixes: #4465
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-06-16 14:24:09 +01:00
Megan Wright
aa9d875a8d CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #4424
Signed-off-by: Megan Wright <megan.wright@ibm.com>
2022-06-08 15:51:18 +01:00
Eric Ernst
7c4049aabb osbuilder: add iptables package
Since we are introducing an agent API for interacting with guest
iptables, let's ensure that our example rootfs' have iptables-save/restore
installed.

Fixes: #4356

Signed-off-by: Eric Ernst <eric_ernst@apple.com>
2022-05-31 09:21:02 -07:00
Gabriela Cervantes
756a07537c docs: Remove clear containers reference in README
This PR removes the clear containers reference as this is not longer
being used and is deprecated at the rootfs builder README.

Fixes #4278

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2022-05-30 16:02:29 +02:00
Gabriela Cervantes
24a2b0f6a2 docs: Remove clear containers reference in README
This PR removes the clear containers reference as this is not longer
being used and is deprecated at the rootfs builder README.

Fixes #4278

Signed-off-by: Gabriela Cervantes <gabriela.cervantes.tellez@intel.com>
2022-05-18 14:53:17 +00:00
Champ-Goblem
1b7fd19acb rootfs: Fix chronyd.service failing on boot
In at least kata versions 2.3.3 and 2.4.0 it was noticed that the guest
operating system's clock would drift out of sync slowly over time
whilst the pod was running.

This had previously been raised and fixed in the old reposity via [1].
In essence kvm_ptp and chrony were paired together in order to
keep the system clock up to date with the host.

In the recent versions of kata metioned above,
the chronyd.service fails upon boot with status `266/NAMESPACE`
which seems to be due to the fact that the `/var/lib/chrony`
directory no longer exists.

This change sets the `/var/lib/chrony` directory for the `ReadWritePaths`
to be ignored when the directory does not exist, as per [2].

[1] https://github.com/kata-containers/runtime/issues/1279
[2] https://www.freedesktop.org/software/systemd
/man/systemd.exec.html#ReadWritePaths=

Fixes: #4167
Signed-off-by: Champ-Goblem <cameron_mcdermott@yahoo.co.uk>
2022-04-29 17:15:29 +01:00
Georgina Kinge
8add48d759 CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #4047
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2022-04-07 10:58:17 +01:00
Jakob Naucke
8fbf6c4e14 osbuilder: Multistrap Ubuntu
Use `multistrap` for building Ubuntu rootfs. Adds support for building
for foreign architectures using the `ARCH` environment variable
(including umoci).
In the process, the Ubuntu rootfs workflow is vastly simplified.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-28 16:13:00 +02:00
GabyCT
a07956a369 Merge pull request #3966 from devimc/2022-03-22/fixOsbuilderQAT
osbuilder/qat: don't pull kata sources if exist
2022-03-25 15:12:03 -06:00
Jakob Naucke
527d741c07 osbuilder: Fix use of LIBC in rootfs.sh
- Add a doc comment
- Pass to build container, e.g. to build x86_64 with glibc (would
  always use musl)

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-25 17:57:47 +01:00