Commit Graph

997 Commits

Author SHA1 Message Date
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
54e39dfcdf Merge pull request #5733 from Jordan9500/workdir-ccv0-fix
CC | agent: Update the merge_oci_process function to change cwd
2022-11-30 18:19:58 +01:00
Fabiano Fidêncio
94d0c3c97d Merge pull request #5767 from Megan-Wright/CCv0
CC: Merge main into CCv0 branch
2022-11-30 18:18:45 +01:00
Fabiano Fidêncio
e922c73f0c Merge pull request #5680 from stevenhorsman/authenticated-registry
CC | agent: Add auth reg support to the agent
2022-11-30 11:17:17 +01:00
Jordan Jackson
0264584935 agent: Update the merge_oci_process function to change cwd
Change the if statement to check if the CWD is set to /
Add unit tests for the correct merging of working directory
in the container and image process

Note: there is an outstanding question about one test case
Format code

Fixes: #5721

Co-authored-by: stevenhorsman <steven@uk.ibm.com>
Signed-off-by: Jordan Jackson <jordan.jackson@ibm.com>
2022-11-29 09:20:22 +00:00
Bin Liu
588f81a23c Merge pull request #5612 from openanolis/fix-iptables
fix(agent): fix iptables binary path in guest
2022-11-29 16:57:06 +08:00
GabyCT
013752667b Merge pull request #5776 from liubin/tmp/debug-static-check
ci: let static checks don't depend on build
2022-11-28 07:51:42 -06:00
Bin Liu
6af037d379 Merge pull request #5154 from Yuan-Zhuo/main
agent: support systemd cgroup for kata agent.
2022-11-28 18:40:10 +08:00
Bin Liu
e723bad0af ci: let static checks don't depend on build
Build is a time consumable operation, skip build while let
ci run faster.

Fixes: #5777

Signed-off-by: Bin Liu <bin@hyper.sh>
2022-11-28 15:26:04 +08:00
Jordan Jackson
5f2d81e490 agent: Update the merge_oci_process to properly manage the env variables
Loop through the images enviroment variables, checking if it exists
inside the target. If it does then do not append it.
Add unit tests for correctly merging the env variables of the pod yaml
and image itself in the container and image process
Format code

Fixes: #5730

Signed-off-by: Jordan Jackson <jordan.jackson@ibm.com>
2022-11-25 10:47:39 +00:00
Megan Wright
a8509821dd CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #5743
Signed-off-by: Megan Wright <megan.wright@ibm.com>
2022-11-25 09:55:44 +00:00
Ji-Xinyou
1d93a93468 fix(agent): fix iptables binary path in guest
Some rootfs put iptables-save and iptables-restore
under /usr/sbin instead of /sbin. This pr checks both
and returns the one exist.

Fixes: #5608
Signed-off-by: Ji-Xinyou <jerryji0414@outlook.com>
2022-11-25 11:57:34 +08:00
stevenhorsman
bd7266ba66 agent: Add auth reg support
If the attestation-agent is used then enable image_client_auth
to enable the attempt to get registry credentials for the pull

Fixes: #5652

Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-11-24 15:47:13 +00:00
Fabiano Fidêncio
5cbf879659 Merge pull request #5693 from jongwu/test_ip_table
agent: check if command exist before do ip_tables test
2022-11-23 08:15:08 +01:00
Jianyong Wu
b53171b605 agent: check command before do test_ip_tables
test_ip_tables test depends on iptables tools. But we can't
ensure these tools are exist. it's better to skip the test
if there is no such tools.

Fixes: #5697
Signed-off-by: Jianyong Wu <jianyong.wu@arm.com>
2022-11-21 14:56:51 +08:00
Georgina Kinge
5b5a1c3cb3 agent: fix Cargo.lock after merge
Fixing up the Cargo.lock file after some merge conflicts

Fixes: #5696
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2022-11-18 17:24:59 +00:00
Georgina Kinge
357da1f46d CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #5696
Signed-off-by: Georgina Kinge <georgina.kinge@ibm.com>
2022-11-18 14:13:41 +00:00
Zhongtao Hu
c46814b26a runtime-rs:support nydus v5 and v6
add nydus v5 snd v6 upport for container rootfs

Fixes:#5142
Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
2022-11-11 10:15:35 +08:00
Hyounggyu Choi
b4d3a79b56 CC: Make agent build differently for image-rs on s390x
This is just to keep the support for s390x without the cosign
verification while looking for a solution for #5582.

Fixes: #5599

Signed-off-by: Hyounggyu Choi <Hyounggyu.Choi@ibm.com>
2022-11-07 18:37:24 +01:00
Fabiano Fidêncio
4d0658e3fa agent: Bump image-rs to v0.2.0
image-rs tagged its v0.2.0 release, let's bump it here as we're about to
release the payload for the v0.2.0 Confidential Containers release.

Fixes: #5593

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
2022-11-07 12:45:15 +01:00
Zhongtao Hu
fef8e92af1 runtime-rs:add hypervisor interface capabilities
1. be able to check does hypervisor support use block device, block
device hotplug, multi-queue, and share file

2. be able to set the hypervisor capability of using block device, block
device hotplug, multi-queue, and share file

Fixes: #5569
Signed-off-by: Zhongtao Hu <zhongtaohu.tim@linux.alibaba.com>
2022-11-04 09:24:36 +08:00
stevenhorsman
360e01c0f4 agent: Set image_client security_validate
Replace hard-coded aa_kbc_param check to set the image_client's
security_validate, with reading the setting from the agent config

Fixes: #4888
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-11-02 21:28:33 +00:00
stevenhorsman
46a6c52ef4 agent: Add enable_signature_verification config
- Add a new agent config parameter enable_signature_verification which
defaults to true for security reasons
- Add unit tests to check parsing and defaults

Fixes: #4888
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-11-02 17:21:50 +00:00
Tobin Feldman-Fitzthum
d71e7bbd59 Agent: Allow agent config to be overwritten
Allows parameters in the agent config file to be overwritten
by the kernel commandline. Does not change trust model since
the commandline is measured.

Makes sure to set endpoints_allowed correctly.

Fixes: #5173

Signed-off-by: Tobin Feldman-Fitzthum <tobin@ibm.com>
Signed-off-by: stevenhorsman <steven@uk.ibm.com>
2022-11-02 13:27:23 +00:00
Megan Wright
3623c033c7 Merge pull request #5554 from Megan-Wright/CCv0
CCv0: Merge main into CCv0 branch
2022-11-01 16:42:45 +00:00
Fabiano Fidêncio
fe9ea1351f Merge pull request #5542 from arronwy/image-rs
CC | agent: Bump pinned version of image-rs to support cosign signature verification
2022-11-01 12:49:33 +01:00
Megan Wright
61ec234b6a CCv0: Merge main into CCv0 branch
Merge remote-tracking branch 'upstream/main' into CCv0

Fixes: #5553
Signed-off-by: Megan Wright <megan.wright@ibm.com>
2022-11-01 10:55:33 +00:00
Wang, Arron
112a3d2bae config: Export aa_kbc_params to be set in guest kernel command line
As we discussed in #5178, user need set aa_kbc_params config without
modify kata guest image, since kernel params is also measured in TEE
boot flow, we make aa_kbc_params can be parsed through kernel cmdline.

Fixes: #5178

Signed-off-by: Wang, Arron <arron.wang@intel.com>
2022-10-31 22:26:02 +08:00
Wang, Arron
27affb2a63 agent: Bump pinned version of image-rs to support cosign signature
To support cosign signature verification.

Fix build warning in signal.rs:
error: unused `tokio::sync::MutexGuard` that must be used
  --> src/signal.rs:27:9
   |
27 |         rustjail::container::WAIT_PID_LOCKER.lock().await;
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
   |
   = note: `-D unused-must-use` implied by `-D warnings`
   = note: if unused the Mutex will immediately unlock

Fixes: #5541

Signed-off-by: Wang, Arron <arron.wang@intel.com>
2022-10-31 14:44:15 +08: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
Bin Liu
4696eadfeb Merge pull request #5488 from ManaSugi/fix/update-libseccomp-crate
rustjail: Upgrade libseccomp crate to v0.3.0
2022-10-24 17:03:30 +08:00
Bin Liu
ab5f97759d Merge pull request #5497 from Rouzip/remove-redundant
agent: remove redundant checks
2022-10-24 16:41:49 +08:00
James O. D. Hunt
65ef2a0a0b Merge pull request #5089 from liubin/fix/4895-ignore-exit-error
agent: use NLM_F_REPLACE replace NLM_F_EXCL in rtnetlink
2022-10-24 08:46:54 +01:00
snir911
18283fd65a Merge pull request #5192 from kata-containers/CCv0-validate-hp-size
CCv0: agent: validate hugepage size is supported
2022-10-23 08:15:16 +03:00
snir911
ee189d2ebe Merge pull request #5455 from kata-containers/main-validate-hp-size
agent: validate hugepage size is supported
2022-10-23 08:15:05 +03:00
Rouzip
44d8de8923 agent: remove redundant checks
Remove redundant checks for executable files.

FIXes: #3730

Signed-off-by: Rouzip <1226015390@qq.com>
2022-10-22 23:31:18 +08:00
Bin Liu
081ee48713 agent: use NLM_F_REPLACE replace NLM_F_EXCL in rtnetlink
Sometimes we will face EEXIST error when adding arp neighbour.
Using NLM_F_REPLACE replace NLM_F_EXCL will avoid fail if the
entry exists.

See https://man7.org/linux/man-pages/man7/netlink.7.html

Fixes: #4895

Signed-off-by: Bin Liu <bin@hyper.sh>
2022-10-21 21:19:14 +08:00
Manabu Sugimoto
cbd84c3f5a rustjail: Upgrade libseccomp crate to v0.3.0
The libseccomp crate v0.3.0 has been released, so use it in the agent.

Fixes: #5487

Signed-off-by: Manabu Sugimoto <Manabu.Sugimoto@sony.com>
2022-10-21 15:40:05 +09:00
Snir Sheriber
72738dc11f agent: validate hugepage size is supported
before setting a limit, otherwise paths may not be found.
guest supporting different hugepage size is more likely with peer-pods where
podvm may use different flavor.

Fixes: #5191
Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
2022-10-19 09:55:33 +03:00
Fabiano Fidêncio
f0041f01ed Merge pull request #5422 from wedsonaf/verify_cid
image_rpc: always call `verify_cid` after determining the cid
2022-10-14 15:43:30 +02:00
Fabiano Fidêncio
e42fce6ece Merge pull request #5407 from wedsonaf/fail-gracefully
image_rpc: Make `init_attestation_agent` fail gracefully
2022-10-13 18:57:35 +02:00
Wedson Almeida Filho
cde438ceb7 image_rpc: always call verify_cid after determining the cid
Prior to this patch, we were missing a call to `verify_cid` when the cid
was derived from the image path, which meant that the host could specify
something like "prefix/..", and we would use ".." as the cid. Paths
derived from this (e.g., `bundle_path`) would not be at the intended
tree.

This patch factors the code out of `pull_image` so that it can be more
easily tested. Tests are added for a number of cases.

Fixes #5421

Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
2022-10-13 03:59:18 +01:00
Wedson Almeida Filho
c7e4548fc2 image_rpc: Make init_attestation_agent fail gracefully
Without this, a failure in `init_attestion_agent` would lead to a panic.

Fixes #5406

Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
2022-10-12 16:39:25 +01:00
Wedson Almeida Filho
2e90c62c31 image_rpc: avoid double and triple indirections
This also slightly improves readability by decluttering the function
declaration and call site.

Fixes #5405

Signed-off-by: Wedson Almeida Filho <walmeida@microsoft.com>
2022-10-12 16:24:05 +01:00
Georgina Kinge
7de2cecfff 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-10 11:12:22 +01:00
Bin Liu
4616363eec Merge pull request #5365 from fengwang666/mount-bug-fix
agent: reduce reference count for failed mount
2022-10-08 14:27:38 +08:00
Feng Wang
ef5a2dc3bf agent: don't exit early if signal fails due to ESRCH
ESRCH usually means the process has exited. In this case,
the execution should continue to kill remaining container processes.

Fixes: #5366

Signed-off-by: Feng Wang <feng.wang@databricks.com>
[Fix up cargo updates]
Signed-off-by: Peng Tao <bergwolf@hyper.sh>
2022-10-08 12:15:12 +08:00
Feng Wang
c31cf7269e agent: reduce reference count for failed mount
The kata agent adds a reference for each storage object before mount
and skip mount again if the storage object is known. We need to
remove the object reference if mount fails.

Fixes: #5364

Signed-off-by: Feng Wang <feng.wang@databricks.com>
2022-10-06 21:37:59 -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
Snir Sheriber
e410c04622 agent: validate hugepage size is supported
before setting a limit, otherwise paths may not be found.
guest supporting different hugepage size is more likely with peer-pods where
podvm may use different flavor.

Fixes: #5191
Signed-off-by: Snir Sheriber <ssheribe@redhat.com>
2022-09-28 17:23:46 +03:00