Skip to content

Commit 2b35936

Browse files
committed
WIP: sgx: add QuoteVerification demo and cleanup hostNetwork dependency
Signed-off-by: Mikko Ylinen <[email protected]>
1 parent 3e79c68 commit 2b35936

File tree

8 files changed

+33
-27
lines changed

8 files changed

+33
-27
lines changed

.trivyignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,6 @@ AVD-DS-0002
99
# initcontainers require privileged access
1010
AVD-KSV-0017
1111

12-
# Sharing the host’s network namespace permits processes in the pod to communicate with
13-
# processes bound to the host’s loopback adapter.
14-
# sgx single-node demo deployment uses hostNetwork: true to be able to use the default setting for PCCS URL from containers
15-
AVD-KSV-0009
16-
1712
# Do not allow privilege escalation from node proxy
1813
# Check whether role permits privilege escalation from node proxy
1914
# gpu plugin in kubelet mode requires "nodes/proxy" resource access

demo/screencast-sgx.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ cleanup()
2727
out 'Cleanup demo artifacts' 20
2828
out 'delete node-feature-discovery deployment:' 20
2929
command 'kubectl delete -k https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/node-feature-rules?ref=main || true' 20
30-
command 'kubectl delete -k https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/sgx?ref=main || true' 20
30+
command 'kubectl delete -k https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd?ref=main || true' 20
3131
out 'delete SGX Device Plugin deployment:' 20
3232
command 'kubectl delete sgxdeviceplugin sgxdeviceplugin-sample || true' 20
3333
out 'delete Intel Device Plugin Operator deployment:' 20
@@ -69,10 +69,10 @@ screen3()
6969
clear
7070
out "2. Deploy node-feature-discovery for Kubernetes"
7171
out "It's used to label SGX capable nodes and register SGX EPC as an extended resource"
72-
command "kubectl apply -k https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/sgx?ref=main"
72+
command "kubectl apply -k https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd?ref=main"
7373
out "Check its pod is running"
7474
command "kubectl wait --for=condition=Ready pod/$(kubectl get --no-headers -l app=nfd-worker -o=jsonpath='{.items[0].metadata.name}' pods -n node-feature-discovery) -n node-feature-discovery"
75-
out "Create NodeFeatureRules for SGX specific labels"
75+
out "Create NodeFeatureRules for SGX specific labels and SGX EPC extended resource"
7676
command 'kubectl apply -k https://github.com/intel/intel-device-plugins-for-kubernetes/deployments/nfd/overlays/node-feature-rules?ref=main || true' 20
7777
}
7878

@@ -91,8 +91,8 @@ screen5()
9191
{
9292
clear
9393
out "4. Verify node resources"
94-
command "kubectl get nodes -o json | jq .items[].status.allocatable | grep sgx"
95-
command "kubectl get nodes -o json | jq .items[].metadata.labels | grep sgx"
94+
command "kubectl get nodes -o jsonpath='{.items[].status.allocatable}' | jq | grep sgx"
95+
command "kubectl get nodes -o jsonpath='{.items[].metadata.labels}' | jq | grep kubernetes.io\/sgx"
9696
out "Both node labels and resources for SGX are in place"
9797
}
9898

demo/sgx-sdk-demo/Dockerfile

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ RUN apt-get update && \
2323
# SGX SDK is installed in /opt/intel directory.
2424
WORKDIR /opt/intel
2525

26-
ARG DCAP_VERSION=DCAP_1.17
26+
ARG DCAP_VERSION=DCAP_1.18
2727

2828
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-sgx.gpg] https://download.01.org/intel-sgx/sgx_repo/ubuntu jammy main" | \
2929
tee -a /etc/apt/sources.list.d/intel-sgx.list \
@@ -32,11 +32,12 @@ RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-sgx.gpg] https://d
3232
&& apt-get update \
3333
&& env DEBIAN_FRONTEND=noninteractive apt-get install -y \
3434
libsgx-dcap-ql-dev \
35+
libsgx-dcap-quote-verify-dev \
3536
libsgx-dcap-default-qpl-dev \
3637
libsgx-quote-ex-dev
3738

3839
# Install SGX SDK
39-
ARG SGX_SDK_URL=https://download.01.org/intel-sgx/sgx-linux/2.20/distro/ubuntu22.04-server/sgx_linux_x64_sdk_2.20.100.4.bin
40+
ARG SGX_SDK_URL=https://download.01.org/intel-sgx/sgx-linux/2.21/distro/ubuntu22.04-server/sgx_linux_x64_sdk_2.21.100.1.bin
4041
RUN wget ${SGX_SDK_URL} \
4142
&& export SGX_SDK_INSTALLER=$(basename $SGX_SDK_URL) \
4243
&& chmod +x $SGX_SDK_INSTALLER \
@@ -55,6 +56,12 @@ RUN cd SGXDataCenterAttestationPrimitives/SampleCode/QuoteGenerationSample \
5556
&& make \
5657
&& cd -
5758

59+
RUN cd SGXDataCenterAttestationPrimitives/SampleCode/QuoteVerificationSample \
60+
&& . /opt/intel/sgxsdk/environment \
61+
&& make HW_RELEASE=1 \
62+
&& sgx_sign sign -key ../QuoteGenerationSample/Enclave/Enclave_private_sample.pem -enclave enclave.so -out enclave.signed.so -config Enclave/Enclave.config.xml \
63+
&& cd -
64+
5865
FROM ubuntu:22.04
5966

6067
RUN apt-get update && \
@@ -75,6 +82,7 @@ RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/intel-sgx.gpg] https://d
7582
libsgx-dcap-ql \
7683
libsgx-dcap-default-qpl \
7784
&& mkdir -p /opt/intel/sgx-sample-app/ \
85+
&& mkdir -p /opt/intel/sgx-quote-verification/ \
7886
&& mkdir -p /opt/intel/sgx-quote-generation/
7987

8088
COPY --from=builder /opt/intel/sgxsdk/SampleCode/SampleEnclave/app /opt/intel/sgx-sample-app/sgx-sample-app
@@ -83,4 +91,9 @@ COPY --from=builder /opt/intel/sgxsdk/SampleCode/SampleEnclave/enclave.signed.so
8391
COPY --from=builder /opt/intel/SGXDataCenterAttestationPrimitives/SampleCode/QuoteGenerationSample/app /opt/intel/sgx-quote-generation/sgx-quote-generation
8492
COPY --from=builder /opt/intel/SGXDataCenterAttestationPrimitives/SampleCode/QuoteGenerationSample/enclave.signed.so /opt/intel/sgx-quote-generation/enclave.signed.so
8593

94+
COPY --from=builder /opt/intel/SGXDataCenterAttestationPrimitives/SampleCode/QuoteVerificationSample/app /opt/intel/sgx-quote-verification/sgx-quote-verification
95+
COPY --from=builder /opt/intel/SGXDataCenterAttestationPrimitives/SampleCode/QuoteVerificationSample/enclave.signed.so /opt/intel/sgx-quote-verification/enclave.signed.so
96+
97+
COPY --chmod=555 run-dcap-flow /opt/intel
98+
8699
ENTRYPOINT /opt/intel/sgx-sample-app/sgx-sample-app

demo/sgx-sdk-demo/run-dcap-flow

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
pushd sgx-quote-generation
4+
5+
./sgx-quote-generation
6+
7+
popd
8+
9+
pushd sgx-quote-verification
10+
11+
./sgx-quote-verification -quote ../sgx-quote-generation/quote.dat

deployments/sgx_aesmd/base/intel-sgx-aesmd.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ spec:
1515
annotations:
1616
sgx.intel.com/quote-provider: "aesmd"
1717
spec:
18-
hostNetwork: true
1918
containers:
2019
- name: aesmd
2120
image: intel/sgx-aesmd-demo:devel
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[
2-
{"op": "replace", "path": "/spec/template/spec/containers/0/workingDir", "value": "/opt/intel/sgx-quote-generation/"},
3-
{"op": "replace", "path": "/spec/template/spec/containers/0/command", "value": ["/opt/intel/sgx-quote-generation/sgx-quote-generation"]}
2+
{"op": "replace", "path": "/spec/template/spec/containers/0/workingDir", "value": "/opt/intel/"},
3+
{"op": "replace", "path": "/spec/template/spec/containers/0/command", "value": ["/opt/intel/run-dcap-flow"]}
44
]

deployments/sgx_enclave_apps/overlays/sgx_ecdsa_inproc_quote/add_hostnetwork.yaml

Lines changed: 0 additions & 11 deletions
This file was deleted.

deployments/sgx_enclave_apps/overlays/sgx_ecdsa_inproc_quote/kustomization.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ configMapGenerator:
1010
- sgx_default_qcnl.conf
1111
name: sgx-attestation-conf
1212
patches:
13-
- path: add_hostnetwork.yaml
1413
- path: add_sgx_default_qcnl_conf.yaml

0 commit comments

Comments
 (0)