46 Commits

Author SHA1 Message Date
Fabiano Fidêncio
aef93c7aaf Merge pull request #7576 from surajssd/update-aa-imagers-tdshim
Update AA, image-rs td-shim
2023-08-24 08:38:29 +02:00
ChengyuZhu6
d053f848b4 tools: Install the dependencies with dm-verity
Fixes #7636

Signed-off-by: ChengyuZhu6 <chengyu.zhu@intel.com>
2023-08-16 21:47:52 +08:00
Suraj Deshmukh
32d347aa25 tools/static-checks: Install clang
Without this library the builds are failing with the following error:

```
...
error: failed to run custom build command for `devicemapper-sys v0.1.5`

Caused by: process didn't exit successfully:
    `/kata-containers/src/agent/target/release/build/devicemapper-sys-d8eae524a127e049/build-script-build`
    (exit status: 101) --- stderr thread 'main' panicked at 'Unable to
    find libclang: "couldn't find any valid shared libraries matching:
    ['libclang.so', 'libclang-*.so', 'libclang.so.*', 'libclang-*.so.*'],
    set the `LIBCLANG_PATH` environment variable to a path where one of
    these files can be found (invalid: [])"',
    /root/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.63.0/./lib.rs:2338:31
```

Fixes: #7580

Signed-off-by: Suraj Deshmukh <suraj.deshmukh@microsoft.com>
2023-08-16 13:12:49 +00:00
Fabiano Fidêncio
5f5e05a77f CC: Merge from main to CCv0 - Aug 7th, 2023
Conflicts:
	src/runtime/pkg/containerd-shim-v2/create.go
	tools/packaging/kata-deploy/local-build/kata-deploy-binaries.sh
	tools/packaging/scripts/lib.sh

Fixes: #7563
Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-08-07 11:12:04 +02:00
Jianyong Wu
35d6d86ab5 static-build: enable cross-build for image build
It's too long a time to cross build agent based on docker buildx, thus
we cross build rootfs based on a container with cross compile toolchain
of gcc and rust with musl libc. Then we get fast build just like native
build.

rootfs initrd cross build is disabled as no cross compile tolchain for
rust with musl lib if found for alpine and based on docker buildx takes
too long a time.

Fixes: #6557
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2023-08-01 23:28:52 +02:00
stevenhorsman
64a27d962b CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #7083
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-06-19 11:24:03 +01:00
Arron Wang
31c0ad2076 packaging: 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: #6674

Signed-off-by: Arron Wang <arron.wang@intel.com>
2023-06-06 12:30:07 +02:00
Xynnn007
38037dbe1f osbuilder: Support attestation-agent[cc_kbc] TDX dependencies
attestation-agent depends on tdx-attest-rs when cc_kbc is enabled, which
depends on libtdx-attest.so. Include the dev package in build container,
and the runtime package in the built rootfs.

The build of tdx-attest-sys (which is a dep of tdx-attest-rs) uses
bindgen, which requires libclang so install that in the build container
as well.

We specify the tdx stack DCAP v1.15

Fixes: #6519

Signed-off-by: Xynnn007 <xynnn@linux.alibaba.com>
2023-04-04 10:26:57 +02:00
Fabiano Fidêncio
bda8160224 rootfs: Ensure we use a compatible version of dcap with rats-tls
DCAP has upgraded to 1.16, which is not compatible with the host OS used
as part of our CI (2022ww44).  Let's ensure DCAP 1.15 is used instead.

Fixes: #6529

Signed-off-by: Wang, Arron <arron.wang@intel.com>
Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2023-03-27 17:07:17 +02:00
Georgina Kinge
ec6ce46e7e CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #6428
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2023-03-09 16:14:53 +00:00
Jeremi Piotrowski
76e926453a osbuilder: Include minimal set of device nodes in ubuntu initrd
When starting an initrd the kernel expects to find /dev/console in the initrd,
so that it can connect it as stdin/stdout/stderr to the /init process. If the
device node is missing the kernel will complain that it was unable to open an
initial console. If kata-agent is the initrd init process, it will also result
in log messages not being logged to console and thus not forwarded to host
syslog.

Add a set of standard device nodes for completeness, so that console logging
works. To do that we install the makedev packge which provides a MAKEDEV helper
that knows the major/minor numbers. Unfortunately the debian package tries to
create devnodes from postinst, which can be suppressed if systemd-detect-virt
is present. That's why we create a small dummy script that matches what
systemd-detect-virt would output (anything is enough to suppress mknod).

Fixes: #6261
Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
2023-02-20 11:15:56 +01:00
stevenhorsman
e777860a0c osbuilder: Make skopeo version externalised
- Remove the hardcoded skopeo version arg
- Switch to read from version.yaml and pass via --build-arg

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-01-25 11:37:56 +00:00
stevenhorsman
dd2d6a94f1 osbuilder: Remove option to build skopeo, umoci
Now we don't need to have skopeo and umoci in the rootfs
remove the code that optionally builds and installs them

Fixes: #3970
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2023-01-25 11:37:56 +00: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
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
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
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
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
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
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
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
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
Jakob Naucke
77ea087ae7 osbuilder: Remove musl installations
Remove a lot of cruft of musl installations -- we needed those for the
Go agent, but Rustup just takes care of everything. aarch64 on
Debian-based & Alpine is an exception -- create a symlink
`aarch64-linux-musl-gcc` to `musl-tools`'s `musl-gcc` or `gcc` on
Alpine. This is unified -- arch-specific Dockerfiles are removed.

Furthermore, we should keep it in Ubuntu for supporting the offline SEV
KBC. We also keep it in Clear Linux, as that runs our internal checks,
but it is e.g. not shipped in CentOS Stream 9.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-25 17:57:47 +01:00
Jakob Naucke
72f7e9e300 osbuilder: Multistrap Ubuntu
Use `multistrap` for building Ubuntu rootfs. Adds support for building
for foreign architectures using the `ARCH` environment variable.
In the process, the Ubuntu rootfs workflow is vastly simplified.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-07 11:58:46 +01:00
Jakob Naucke
0072cc2b66 osbuilder: Remove musl installations
Remove a lot of cruft of musl installations -- we needed those for the
Go agent, but Rustup just takes care of everything. aarch64 on
Debian-based & Alpine is an exception -- create a symlink
`aarch64-linux-musl-gcc` to `musl-tools`'s `musl-gcc` or `gcc` on
Alpine. This is unified -- arch-specific Dockerfiles are removed.

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2022-03-07 11:58:46 +01:00
stevenhorsman
5f7115eca8 CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #3376
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-01-04 10:29:03 +00:00
Wainer dos Santos Moschetta
aeb2b673b3 osbuilder: delint dockerfiles
Removed all errors/warnings pointed out by hadolint version 2.7.0, except for the following
ignored rules:
  - "DL3008 warning: Pin versions in apt get install"
  - "DL3041 warning: Specify version with `dnf install -y <package>-<version>`"
  - "DL3033 warning: Specify version with `yum install -y <package>-<version>`"
  - "DL3048 style: Invalid label key"
  - "DL3003 warning: Use WORKDIR to switch to a directory"
  - "DL3018 warning: Pin versions in apk add. Instead of apk add <package> use apk add <package>=<version>"
  - "DL3037 warning: Specify version with zypper install -y <package>[=]<version>"

Fixes #3107
Signed-off-by: Wainer dos Santos Moschetta <wainersm@redhat.com>
2021-12-21 09:54:44 -05:00
stevenhorsman
15494d7e06 CCv0: Merge main into CCv0 branch
Resolve merge conflicts during merge

Fixes: #3209
Depends-on: github.com/kata-containers/tests#4256

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2021-12-06 11:12:47 +00:00
stevenhorsman
bb66dbdccc osbuilder: Stop skopeo being installed by default
With the new rust image pull service skopeo we can parameterise whether to build
and install skopeo and turn it off by default if we don't need
signature verification support

Fixes: #3170

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2021-12-03 14:53:39 +00:00
zhouliang121
365acda643 CCv0|osbuilder: add EAA KBC into ubuntu rootfs
Integrate EAA KBC into ubuntu rootfs image.
Fix build failure if build with AA_KBC=eaa_kbc option.

Fixes: #3167
Signed-off-by: zhouliang121 <liang.a.zhou@linux.alibaba.com>
2021-12-02 12:07:45 +08:00
Peng Tao
f59d3ff600 osbuilder: add coreutils to guest rootfs
So that the debug console is more useful. In the meantime, remove
iptables as it is not used by kata-agent any more.

Fixes: #3138
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2021-11-29 11:22:07 +08:00
Jakob Naucke
13f6418c46 osbuilder: Build Skopeo, umoci, attestation-agent
When the environment variable $SKOPEO_UMOCI is set to "yes", Skopeo and
umoci are built inside the guest build container and installed to the
guest rootfs. The respective build- and runtime dependencies are added.
This respects the (existing) $LIBC variable (gnu/musl) and avoids issues
with glibc mismatches.
This is currently only supported for Ubuntu guests, as the system Golang
packages included in the versions of other distros that we use are too
old to build these packages, and re-enabling installing Golang from
golang.org is cumbersome, given especially that it is unclear how long
we will keep using Skopeo and umoci.

Additionally, when the environment variable $AA_KBC is set,
attestation-agent (with that KBC) is included.

This replaces some logic in ccv0.sh that is removed.

Fixes: #2907
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-11-09 18:04:21 +01:00
Jakob Naucke
7effbdebcb osbuilder: Upgrade Ubuntu guest to 20.04
- no need to create `/usr/lib/systemd/systemd` link any more
- install `chrony` as extra package and install extra packages in chroot
  rather than `debootstrap`, because `chrony` provides `time-daemon`,
  which under 20.04 is provided by `systemd-timesyncd`, which is
  required by `systemd`, and `debootstrap`'s conflict resolvement can't
  handle this, but `apt`'s can.

Fixes: #2147
Depends-on: github.com/kata-containers/tests#3636
Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-08-10 16:31:21 +02:00
bin
b12b21f337 osbuilder: Skip installing golang for building rootfs
Building rootfs does not depend on golang, delete intalling
golang may save build time.

And there is only rust agent now, the code for golang agent should
be deleted too.

Fixes: #2170

Signed-off-by: bin <bin@hyper.sh>
2021-07-15 23:59:15 +08:00
Eric Ernst
935460e549 osbuilder: update dockerfiles to utilize IMAGE_REGISTRY
While we introduced IMAGE_REGISTRY, we didn't actually update the
corresponding Dockerfiles to utilize it. Let's add

Fixes: #1622

Signed-off-by: Eric Ernst <eric.g.ernst@gmail.com>
2021-04-02 09:46:16 -07:00
Jakob-Naucke
11fe6a3552 osbuilder: Fix USE_DOCKER on s390x
- Install the required protobuf-compiler on Ubuntu
- Install correct libc Rust target (glibc on s390x)
- Do not skip Rust installation on s390x

Fixes: #1266

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-02-09 12:37:24 +01:00
David Gibson
3718df69c2 osbuilder: Remove leftover pieces related to cmake
The osbuilder scripts include a bunch of code for installing cmake, even
though cmake is never invoked.  versions.yaml claims it's needed to build
grpc-rs, but that doesn't appear to be in our dependency graph.

Presumably, we used to need this, but don't any more.  So, remove all cmake
references.

Fixes #1309

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2021-01-23 15:24:25 +11:00
Julio Montes
9897238f3a rootfs: reduce size of debian image
Improve Kata Containers memory footprint by reducing debian
image size.

Without this change:
Debian image -> 256MB

With this change:
Debian image -> 128MB

Note: this change *will not* impact ubuntu image.

fixes #1188

Signed-off-by: Julio Montes <julio.montes@intel.com>
2020-12-10 09:23:48 -06:00
Salvador Fuentes
715d342519 osbuilder: move code into tools directory
move all osbuilder files into `tools` directory to be able
to merge this into kata-containers repo.

Signed-off-by: Salvador Fuentes <salvador.fuentes@intel.com>
2020-04-29 16:45:00 -05:00