Skip to content

Commit

Permalink
Merge pull request #87 from dongx1x/rename
Browse files Browse the repository at this point in the history
  • Loading branch information
wenhuizhang authored Jul 29, 2024
2 parents 36d01b4 + c8ae3fd commit e8c9393
Show file tree
Hide file tree
Showing 115 changed files with 1,032 additions and 1,031 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Bug Report
description: Create a bug report to help improve CCNP
description: Create a bug report to help improve CIMA
labels: kind/bug
body:
- type: textarea
Expand Down
2 changes: 1 addition & 1 deletion .github/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dictionarydefinitions": [],
"dictionaries": [],
"words": [
"ccnp",
"cima",
"containerd",
"daemonset",
"Eventlog",
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/e2e-test-k8s.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run CCNP E2E test
name: Run CIMA E2E test
on:
schedule:
- cron: '0 7 * * *'
Expand All @@ -16,15 +16,15 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4.1.1
- name: Build and push CCNP images
- name: Build and push CIMA images
run: |
sudo ./container/build.sh -r gar-registry.caas.intel.com/cpio -g latest
- name: Deploy CCNP server
- name: Deploy CIMA server
run: |
sudo ./deployment/kubernetes/script/deploy-ccnp.sh -r gar-registry.caas.intel.com/cpio -g latest -d
- name: Deploy CCNP test pod
sudo ./deployment/kubernetes/script/deploy-cima.sh -r gar-registry.caas.intel.com/cpio -g latest -d
- name: Deploy CIMA test pod
run: |
sudo ./deployment/kubernetes/script/deploy-ccnp-example.sh -r gar-registry.caas.intel.com/cpio -g latest -d
sudo ./deployment/kubernetes/script/deploy-cima-example.sh -r gar-registry.caas.intel.com/cpio -g latest -d
- name: Run Test
run: |
sudo ./test/ci-test/ci-e2e-test.sh
6 changes: 3 additions & 3 deletions .github/workflows/pr-check-rust.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ on:
branches:
- main
paths:
- 'service/ccnp-server/**.rs'
- 'service/cima-server/**.rs'
- '.github/workflows/pr-check-rust.yaml'
pull_request:
paths:
- 'service/ccnp-server/**.rs'
- 'service/cima-server/**.rs'
- '.github/workflows/pr-check-rust.yaml'
workflow_dispatch:

Expand All @@ -32,7 +32,7 @@ jobs:
sudo mv bin/protoc /usr/bin/protoc && sudo mv include/google/protobuf/* /usr/include/google/protobuf/
- name: Run cargo check
run: |
cd service/ccnp-server
cd service/cima-server
cargo check
cargo fmt -- --check
cargo clippy
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pr-golang-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ on:
- '.github/workflows/pr-golang-check.yaml'
- 'service/eventlog-server/**.go'
- 'service/measurement-server/**.go'
- 'sdk/golang/ccnp/measurement/**.go'
- 'sdk/golang/ccnp/quote/**.go'
- 'sdk/golang/ccnp/eventlog/**.go'
- 'sdk/golang/cima/measurement/**.go'
- 'sdk/golang/cima/quote/**.go'
- 'sdk/golang/cima/eventlog/**.go'
pull_request:
paths:
- '.github/workflows/pr-golang-check.yaml'
- 'service/eventlog-server/**.go'
- 'service/measurement-server/**.go'
- 'sdk/golang/ccnp/measurement/**.go'
- 'sdk/golang/ccnp/quote/**.go'
- 'sdk/golang/ccnp/eventlog/**.go'
- 'sdk/golang/cima/measurement/**.go'
- 'sdk/golang/cima/quote/**.go'
- 'sdk/golang/cima/eventlog/**.go'
workflow_dispatch:

permissions:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr-pylint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ on:
branches:
- main
paths:
- 'sdk/python3/ccnp/**.py'
- 'sdk/python3/cima/**.py'
pull_request:
paths:
- 'sdk/python3/ccnp/**.py'
- 'sdk/python3/cima/**.py'
workflow_dispatch:

jobs:
Expand All @@ -31,7 +31,7 @@ jobs:
- name: Analyze python code
run: |
set -ex
export PYTHONPATH=$PWD/ccnp:$PYTHONPATH
export PYTHONPATH=$PWD/cima:$PYTHONPATH
python_files=$(find . -path ./sdk/python3/tests -prune -o -name "*.py" -print)
if [[ -n "$python_files" ]]; then
echo "$python_files" | xargs -n 1 python3 -m pylint --rcfile=.github/pylintrc
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish-ccnp.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: Publish ccnp package to PyPI
name: Publish cima package to PyPI

on:
workflow_dispatch:

jobs:
publish_pypi:
name: Publish ccnp package
name: Publish cima package
runs-on: ubuntu-latest
steps:
- name: Checkout Code
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ tools/cvm-image-rewriter/pre-stage/05-readonly-data/cloud-init/x-shellscript/01-
tools/cvm-image-rewriter/pre-stage/07-install-mvp-guest/cloud-init/
tools/cvm-image-rewriter/pre-stage/07-install-mvp-guest/artifacts/*

service/ccnp-server/target/
service/ccnp-server/Cargo.lock
service/ccnp-server/.cargo
service/cima-server/target/
service/cima-server/Cargo.lock
service/cima-server/.cargo
46 changes: 23 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Confidential Cloud-Native Primitives (CCNP)

![CI Check License](https://github.com/cc-api/confidential-cloud-native-primitives/actions/workflows/pr-license-python.yaml/badge.svg)
![CI Check Spelling](https://github.com/cc-api/confidential-cloud-native-primitives/actions/workflows/pr-doclint.yaml/badge.svg)
![CI Check Python](https://github.com/cc-api/confidential-cloud-native-primitives/actions/workflows/pr-pylint.yaml/badge.svg)
![CI Check Shell](https://github.com/cc-api/confidential-cloud-native-primitives/actions/workflows/pr-shell-check.yaml/badge.svg)
![CI Check Rust](https://github.com/cc-api/confidential-cloud-native-primitives/actions/workflows/pr-check-rust.yaml/badge.svg)
![CI Check Golang](https://github.com/cc-api/confidential-cloud-native-primitives/actions/workflows/pr-golang-check.yaml/badge.svg)
![CI Check Container](https://github.com/cc-api/confidential-cloud-native-primitives/actions/workflows/pr-container-check.yaml/badge.svg)
# Container Integrity Measurement Agent (CIMA)

![CI Check License](https://github.com/cc-api/container-integrity-measurement-agent/actions/workflows/pr-license-python.yaml/badge.svg)
![CI Check Spelling](https://github.com/cc-api/container-integrity-measurement-agent/actions/workflows/pr-doclint.yaml/badge.svg)
![CI Check Python](https://github.com/cc-api/container-integrity-measurement-agent/actions/workflows/pr-pylint.yaml/badge.svg)
![CI Check Shell](https://github.com/cc-api/container-integrity-measurement-agent/actions/workflows/pr-shell-check.yaml/badge.svg)
![CI Check Rust](https://github.com/cc-api/container-integrity-measurement-agent/actions/workflows/pr-check-rust.yaml/badge.svg)
![CI Check Golang](https://github.com/cc-api/container-integrity-measurement-agent/actions/workflows/pr-golang-check.yaml/badge.svg)
![CI Check Container](https://github.com/cc-api/container-integrity-measurement-agent/actions/workflows/pr-container-check.yaml/badge.svg)
[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/8325/badge)](https://www.bestpractices.dev/projects/8325)

## Introduction
Expand All @@ -17,34 +17,34 @@ It requires a full chain integrity measurement on the launch-time or runtime env
to guarantee "consistent behavior in an expected way" of confidential
computing environment for tenant's zero-trust use case.

CCNP aims to help users establish a chain of trust for cloud-native workloads by providing
cloud-native level confidential computing primitives, including container measurements,
CIMA aims to help users establish a chain of trust for cloud-native workloads by providing
container level evidence, including container measurements,
event logs, and confidential computing (CC) reports.

Find out more in [CCNP Design and Architecture](https://cc-api.github.io/confidential-cloud-native-primitives/) and [Container Measurement Design](docs/container-measurement-design.md).
Find out more in [CIMA Design and Architecture](https://cc-api.github.io/container-integrity-measurement-agent/) and [Container Measurement Design](docs/container-measurement-design.md).


## How to Install CCNP
## How to Install CIMA

### Configuration

CCNP support to run on Intel® TDX guest. Thus, you will need TDX host and guest for CCNP deployment and usage. Please see below recommended configuration.
CIMA support to run on Intel® TDX guest. Thus, you will need TDX host and guest for CIMA deployment and usage. Please see below recommended configuration.

| CPU | Host OS | Host packages | Guest OS | Guest packages | Attestation packages | CCNP Tag |
| CPU | Host OS | Host packages | Guest OS | Guest packages | Attestation packages | CIMA Tag |
|---|---|---|---|---|---|---|
| Intel 4th Gen (only TDX SKUs) and 5th Gen Xeon Scalable Processors | Ubuntu 23.10| TDX early preview referring to [here](https://github.com/canonical/tdx?tab=readme-ov-file#4-setup-tdx-host) | Ubuntu 23.10 | Build a guest image for CCNP using [CVM image rewriter](https://github.com/cc-api/confidential-cloud-native-primitives/tree/v0.4.0/deployment#prepare-tdx-guest-image) | Setup remote attestation on host referring to [here](https://github.com/canonical/tdx?tab=readme-ov-file#8-setup-remote-attestation-on-host-and-td-guest)| [v0.4.0](https://github.com/cc-api/confidential-cloud-native-primitives/releases/tag/v0.4.0)
| Intel 4th Gen (only TDX SKUs) and 5th Gen Xeon Scalable Processors | Ubuntu 24.04| TDX early preview referring to [here](https://github.com/canonical/tdx/tree/2.0?tab=readme-ov-file#setup-tdx-host) | Ubuntu 24.04 | Build a guest image for CCNP using [CVM image rewriter](https://github.com/cc-api/confidential-cloud-native-primitives/tree/v0.5.0/deployment#prepare-tdx-guest-image) | Setup remote attestation on host referring to [here](https://github.com/cc-api/confidential-cloud-native-primitives/blob/v0.5.0/container/pccs/README.md) and [here](https://github.com/cc-api/confidential-cloud-native-primitives/blob/v0.5.0/container/qgs/README.md)| [v0.5.0](https://github.com/cc-api/confidential-cloud-native-primitives/releases/tag/v0.5.0)
| Intel 4th Gen (only TDX SKUs) and 5th Gen Xeon Scalable Processors | Ubuntu 23.10| TDX early preview referring to [here](https://github.com/canonical/tdx?tab=readme-ov-file#4-setup-tdx-host) | Ubuntu 23.10 | Build a guest image for CIMA using [CVM image rewriter](https://github.com/cc-api/container-integrity-measurement-agent/tree/v0.4.0/deployment#prepare-tdx-guest-image) | Setup remote attestation on host referring to [here](https://github.com/canonical/tdx?tab=readme-ov-file#8-setup-remote-attestation-on-host-and-td-guest)| [v0.4.0](https://github.com/cc-api/container-integrity-measurement-agent/releases/tag/v0.4.0)
| Intel 4th Gen (only TDX SKUs) and 5th Gen Xeon Scalable Processors | Ubuntu 24.04| TDX early preview referring to [here](https://github.com/canonical/tdx/tree/2.0?tab=readme-ov-file#setup-tdx-host) | Ubuntu 24.04 | Build a guest image for CIMA using [CVM image rewriter](https://github.com/cc-api/container-integrity-measurement-agent/tree/v0.5.0/deployment#prepare-tdx-guest-image) | Setup remote attestation on host referring to [here](https://github.com/cc-api/container-integrity-measurement-agent/blob/v0.5.0/container/pccs/README.md) and [here](https://github.com/cc-api/container-integrity-measurement-agent/blob/v0.5.0/container/qgs/README.md)| [v0.5.0](https://github.com/cc-api/container-integrity-measurement-agent/releases/tag/v0.5.0)



### CCNP Service Deployment in Confidential VM
### CIMA Service Deployment in Confidential VM

CCNP will run as a DaemonSet in a Kubernetes cluster or as a container in a docker environment on a single confidential VM (CVM).
Refer to [CCNP deployment guide](deployment/README.md) and choose a deployment model.
CIMA will run as a DaemonSet in a Kubernetes cluster or as a container in a docker environment on a single confidential VM (CVM).
Refer to [CIMA deployment guide](deployment/README.md) and choose a deployment model.

### CCNP SDK Usage
### CIMA SDK Usage

If you want to integrate CCNP SDK in the workload to get measurement and event logs, refer to [py_sdk_example.py](/sdk/python3/example/py_sdk_example.py). It is an example of using CCNP Python SDK. There are also Golang SDK and Rust SDK. Please see more details in [CCNP SDK](https://cc-api.github.io/confidential-cloud-native-primitives/sdk.html).
If you want to integrate CIMA SDK in the workload to get measurement and event logs, refer to [py_sdk_example.py](/sdk/python3/example/py_sdk_example.py). It is an example of using CIMA Python SDK. There are also Golang SDK and Rust SDK. Please see more details in [CIMA SDK](https://cc-api.github.io/container-integrity-measurement-agent/sdk.html).


## Contributing
Expand All @@ -71,7 +71,7 @@ _Note: This is pre-production software. As such, it may be substantially modifie

## Reference

[CCNP Design and Architecture](https://cc-api.github.io/confidential-cloud-native-primitives/)
[CIMA Design and Architecture](https://cc-api.github.io/container-integrity-measurement-agent/)

[Container Measurement Design](docs/container-measurement-design.md)

Expand Down
24 changes: 12 additions & 12 deletions container/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ There are several docker image files in the sub directories of current directory

| Sub directory | Image name | Description |
|---|---|---|
| ccnp-webhook | ccnp-webhook | CCNP webhook |
| ccnp-server | ccnp-server | CCNP server |
| ccnp-example | ccnp-example | Example image of getting eventlog and measurement using CCNP SDK |
| pccs | pccs | PCCS docker image for Intel® TDX remote attestation. Not required for CCNP usage.|
| qgs | qgs | QGS docker image for Intel® TDX remote attestation. Not required for CCNP usage. |
| cima-webhook | cima-webhook | CIMA webhook |
| cima-server | cima-server | CIMA server |
| cima-example | cima-example | Example image of getting eventlog and measurement using CIMA SDK |
| pccs | pccs | PCCS docker image for Intel® TDX remote attestation. Not required for CIMA usage.|
| qgs | qgs | QGS docker image for Intel® TDX remote attestation. Not required for CIMA usage. |


### Build Docker images
Expand All @@ -33,14 +33,14 @@ _NOTE: please set `HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY` in docker daemon if th
Below are usage examples for different scenarios. Please replace the parameters with your input.

```
# Build all CCNP images with tag latest and push them to remote registry test-registry.intel.com
# Build all CIMA images with tag latest and push them to remote registry test-registry.intel.com
$ sudo ./build.sh -r test-registry.intel.com/test -g latest
# Build images only with tag latest
$ sudo ./build.sh -a build -g latest
# Build ccnp-measurement-server image with tag latest and push them to remote registry test-registry.intel.com
$ sudo ./build.sh -c ccnp-measurement-server -r test-registry.intel.com/test -g latest
# Build cima-measurement-server image with tag latest and push them to remote registry test-registry.intel.com
$ sudo ./build.sh -c cima-measurement-server -r test-registry.intel.com/test -g latest
# Build pccs image with tag latest and push it to remote registry test-registry.intel.com
$ sudo ./build.sh -c pccs -r test-registry.intel.com/test -g latest -p
Expand All @@ -51,11 +51,11 @@ $ sudo ./build.sh -c qgs -r test-registry.intel.com/test -g latest -q

Note: For detailed PCCS and QGS service usage guide, please refer [PCCS Guide](pccs/README.md) and [QGS Guide](qgs/README.md).

After the script is running successfully, it's supposed to see corresponding CCNP docker images.
After the script is running successfully, it's supposed to see corresponding CIMA docker images.

```
$ sudo docker images
ccnp-example <your image tag>
ccnp-server <your image tag>
ccnp-webhook <your image tag>
cima-example <your image tag>
cima-server <your image tag>
cima-webhook <your image tag>
```
8 changes: 4 additions & 4 deletions container/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ function process_args {
fi

if [[ "$registry" == "" ]]; then
if [[ -z "$CCNP_REGISTRY" ]]; then
echo "Error: Please specify your docker registry via -r <registry prefix> or set environment variable CCNP_REGISTRY."
if [[ -z "$CIMA_REGISTRY" ]]; then
echo "Error: Please specify your docker registry via -r <registry prefix> or set environment variable CIMA_REGISTRY."
exit 1
else
registry=$CCNP_REGISTRY
registry=$CIMA_REGISTRY
fi
fi
}
Expand Down Expand Up @@ -147,7 +147,7 @@ function build_images {
}

#
# Publish a container image to given registry via "-r" or environment variable CCNP_REGISTRY
# Publish a container image to given registry via "-r" or environment variable CIMA_REGISTRY
#
# @param $1 the name of container
#
Expand Down
16 changes: 0 additions & 16 deletions container/ccnp-webhook/Dockerfile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,42 +8,43 @@ RUN git clone https://github.com/cc-api/cc-trusted-api && \
cd cc-trusted-api/common/python && \
python3 -m build

COPY sdk/python3 ccnp-sdk
RUN cd ccnp-sdk && python3 -m build
COPY sdk/python3 cima-sdk
RUN cd cima-sdk && python3 -m build

# Build golang example
FROM golang:1.22.1-alpine3.19 AS golang-builder
COPY sdk/golang ccnp-sdk
RUN cd ccnp-sdk/example && go mod tidy && go build -o go-sdk-example
RUN apk update && apk add git
COPY sdk/golang cima-sdk
RUN cd cima-sdk/example && go mod tidy && go build -o go-sdk-example

# Build rust example
FROM rust:1.77.1-alpine3.19 AS rust-builder
RUN apk update && apk add --no-cache make protobuf-dev musl-dev wget
COPY sdk/rust ccnp-sdk
COPY service/ccnp-server/proto/ccnp-server.proto ccnp-sdk/ccnp/proto/ccnp-server.proto
RUN cd ccnp-sdk/example && cargo build --release
COPY sdk/rust cima-sdk
COPY service/cima-server/proto/cima-server.proto cima-sdk/cima/proto/cima-server.proto
RUN cd cima-sdk/example && cargo build --release

# Copy/Install
FROM python:3.12.3-alpine3.19
ARG USER=ccnp
ARG USER=cima
ARG UID=1000
ARG GID=1000
ARG GROUP=ccnp
ARG GROUP=cima

WORKDIR /run/ccnp
WORKDIR /run/cima
RUN addgroup -S -g $GID $GROUP && adduser -S -u $UID -D -G $GROUP $USER
RUN chown $USER:$GROUP /run/ccnp
RUN chown $USER:$GROUP /run/cima

COPY test ./
COPY sdk/python3/example/py_sdk_example.py ./
COPY --from=python-builder cc-trusted-api/common/python/dist/cctrusted_base*.whl ./
COPY --from=python-builder ccnp-sdk/dist/ccnp*.whl ./
COPY --from=python-builder cima-sdk/dist/cima*.whl ./

COPY --from=golang-builder /go/ccnp-sdk/example/go-sdk-example ./
COPY --from=rust-builder ccnp-sdk/example/target/release/rust-sdk-example ./
COPY --from=golang-builder /go/cima-sdk/example/go-sdk-example ./
COPY --from=rust-builder cima-sdk/example/target/release/rust-sdk-example ./

RUN apk update && apk add bash vim tar wget libexpat=2.6.2-r0
RUN pip install ./cctrusted_base*.whl ./ccnp*.whl pytest && rm -f *.whl
RUN pip install ./cctrusted_base*.whl ./cima*.whl pytest && rm -f *.whl

USER ${USER}
ENTRYPOINT ["tail", "-f", "/dev/null"]
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ RUN git clone https://github.com/cc-api/cc-trusted-api && \
cd cc-trusted-api/common/python && \
python3 -m build

COPY sdk/python3 ccnp-sdk
RUN cd ccnp-sdk && python3 -m build
COPY sdk/python3 cima-sdk
RUN cd cima-sdk && python3 -m build

# ======================================================================================================================

FROM python:alpine

WORKDIR /run/ccnp
WORKDIR /run/cima

COPY container/ccnp-perf/ccnp_perf.py ./
COPY container/cima-perf/cima_perf.py ./
COPY --from=python-builder cc-trusted-api/common/python/dist/cctrusted_base*.whl ./
COPY --from=python-builder ccnp-sdk/dist/ccnp*.whl ./
COPY --from=python-builder cima-sdk/dist/cima*.whl ./

RUN apk update && apk add bash vim
RUN python3 -m pip install pytest
RUN pip install ./cctrusted_base*.whl ./ccnp*.whl && rm -f *.whl
RUN pip install ./cctrusted_base*.whl ./cima*.whl && rm -f *.whl

ENTRYPOINT ["tail", "-f", "/dev/null"]
Loading

0 comments on commit e8c9393

Please sign in to comment.