Skip to content

Commit 06499d3

Browse files
BuJianlinpengyuabcRodgerZhushui1
authored
Add TDX MRs support for gRPC-RATLS (#244)
* Remove some useless files and fix evfs commit * Update the code of clf (#234) * Add HFL with CoCo (#235) * Update for TDX (#231) * Add Bazel compiling system and TDX support for gRPC-RA-TLS * Add TDX docker support for tdx-encrypted-vfs * Add hfl-tdx-coco solution Signed-off-by: Bu Jianlin <jianlinx.bu@intel.com> * Remove some useless files && update tdx-dev docker * Update evfs commit --------- Signed-off-by: Bu Jianlin <jianlinx.bu@intel.com> * Remove some useless files and fix evfs commit (#233) --------- Signed-off-by: Bu Jianlin <jianlinx.bu@intel.com> Co-authored-by: 0400H <jianlinx.bu@intel.com> * Update index.rst * Create tdxcoco.md * Update TDX coco images * Update index.rst * Update tdxcoco.md * Add TD Encrypted Image (#236) * Add Solution - Attested boot with encrypted tdvm OS image Signed-off-by: RodgerZhu <yunge.zhu@intel.com> * Update TD encrypted image --------- Signed-off-by: RodgerZhu <yunge.zhu@intel.com> * Update index.rst * Updates to tf-serving/hfl (SGX) dockerfiles (#238) * Update tf-serving (SGX) dockerfiles * Update hfl (SGX) dockerfiles * Update hfl.md * Updates to patches/secret_prov_pf files * Add Security.md * Update tf-serving (SGX) dockerfiles (#239) * Update tf-serving/hfl (SGX) documentation (#240) * Update TF Serving (SGX) documentation (#241) * Add tdx_report_parser tool (#243) * Add tdx_report_parser tool Signed-off-by: Bu Jianlin <jianlinx.bu@intel.com> * Update README.md --------- Signed-off-by: Bu Jianlin <jianlinx.bu@intel.com> * Add Third party programs * Add TDX MRs support for grpc-ratls Signed-off-by: Bu Jianlin <jianlinx.bu@intel.com> --------- Signed-off-by: Bu Jianlin <jianlinx.bu@intel.com> Signed-off-by: RodgerZhu <yunge.zhu@intel.com> Co-authored-by: pengyuabc <pengyux.ji@intel.com> Co-authored-by: Zhu Yunge <yunge.zhu@intel.com> Co-authored-by: shui1 <sammy.hui@intel.com>
1 parent 0f93c10 commit 06499d3

File tree

62 files changed

+3600
-1786
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+3600
-1786
lines changed

Security.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Security Policy
2+
Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation.
3+
4+
## Reporting a Vulnerability
5+
Please report any security vulnerabilities in this project [utilizing the guidelines here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).
6+

THIRD-PARTY-PROGRAMS.txt

Lines changed: 1510 additions & 0 deletions
Large diffs are not rendered by default.

cczoo/common/docker/tdx/README.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ to do software development.
1313

1414
Execute the following command to build this docker image:
1515
```
16-
base_image=centos:8
1716
image_tag=tdx-dev:dcap1.15-centos8-latest
18-
./build_docker_image.sh ${base_image} ${image_tag}
17+
docker_file=tdx-dev.centos.dockerfile
18+
./build_docker_image.sh ${image_tag} ${docker_file}
1919
```
20-
21-
`centos:8` could be selected as base_image.

cczoo/common/docker/tdx/build_docker_image.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
set -e
1818

1919
if [ -n "$1" ] ; then
20-
base_image=$1
20+
image_tag=$1
2121
else
22-
base_image=centos:8
22+
image_tag=tdx-dev:dcap1.15-centos8-latest
2323
fi
2424

2525
if [ -n "$2" ] ; then
26-
image_tag=$2
26+
docker_file=$2
2727
else
28-
image_tag=tdx-dev:dcap1.15-centos8-latest
28+
docker_file=tdx-dev.centos.dockerfile
2929
fi
3030

3131
# Use the host proxy as the default configuration, or specify a proxy_server
@@ -43,8 +43,7 @@ DOCKER_BUILDKIT=0 docker build \
4343
--build-arg no_proxy=${no_proxy} \
4444
--build-arg http_proxy=${http_proxy} \
4545
--build-arg https_proxy=${https_proxy} \
46-
--build-arg BASE_IMAGE=${base_image} \
47-
-f tdx-dev.dockerfile \
46+
-f ${docker_file} \
4847
-t ${image_tag} \
4948
.
5049

Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
1-
#!/usr/bin/expect
21
#
32
# Copyright (c) 2023 Intel Corporation
43
#
54
# Licensed under the Apache License, Version 2.0 (the "License");
65
# you may not use this file except in compliance with the License.
76
# You may obtain a copy of the License at
87
#
9-
# http://www.apache.org/licenses/LICENSE-2.0
8+
# http://www.apache.org/licenses/LICENSE-2.0
109
#
1110
# Unless required by applicable law or agreed to in writing, software
1211
# distributed under the License is distributed on an "AS IS" BASIS,
1312
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1413
# See the License for the specific language governing permissions and
1514
# limitations under the License.
1615

17-
spawn sh ./sgx_linux_x64_sdk_2.18.100.3.bin
18-
send "no\r"
19-
send "/opt/intel/\r"
20-
expect eof
16+
#!/bin/bash
17+
18+
$1 << EOF
19+
no
20+
/opt/intel
21+
EOF

cczoo/common/docker/tdx/tdx-dev.dockerfile renamed to cczoo/common/docker/tdx/tdx-dev.centos.dockerfile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RUN cd /etc/yum.repos.d/ && \
2929
RUN yum install -y yum-utils.noarch
3030
RUN yum groupinstall -y 'Development Tools'
3131

32-
RUN yum install -y python3 python3-devel && \
32+
RUN yum install -y python38 python38-devel python38-pip && \
3333
yum install -y python3-protobuf protobuf-c-devel protobuf-c-compiler openssl-devel libcurl-devel && \
3434
yum install -y cryptsetup e4fsprogs expect wget vim
3535

@@ -46,12 +46,16 @@ RUN wget https://download.01.org/intel-sgx/sgx-dcap/${DCAP_VERSION}/linux/distro
4646
yum install -y --nogpgcheck sgx_rpm_local_repo/libsgx-urts-*.el8.x86_64.rpm && \
4747
yum install -y --setopt=install_weak_deps=False --nogpgcheck tdx-qgs && \
4848
yum install -y --setopt=install_weak_deps=False --nogpgcheck libsgx-dcap-quote-verify-devel && \
49-
yum install -y --setopt=install_weak_deps=False --nogpgcheck libsgx-ae-qve
49+
yum install -y --setopt=install_weak_deps=False --nogpgcheck libsgx-ae-qve && \
50+
rm -f sgx_rpm_local_repo.tgz
5051

5152
COPY configs /
5253

53-
RUN wget https://download.01.org/intel-sgx/sgx-dcap/${DCAP_VERSION}/linux/distro/centos-stream/sgx_linux_x64_sdk_2.18.100.3.bin && \
54-
/install_sgx_sdk.sh
54+
RUN wget https://download.01.org/intel-sgx/sgx-dcap/${DCAP_VERSION}/linux/distro/centos-stream/sgx_linux_x64_sdk_2.18.100.3.bin -P /opt/intel && \
55+
chmod +x /opt/intel/sgx_linux_x64_sdk_2.18.100.3.bin && \
56+
/install_sgxsdk.sh /opt/intel/sgx_linux_x64_sdk_2.18.100.3.bin
57+
58+
ENV INTEL_SGXSDK_INCLUDE=/opt/intel/sgxsdk/include
5559

5660
# only for tdx vsock
5761
# RUN echo 'port=4050' | tee /etc/tdx-attest.conf

cczoo/cross_lang_framework/docker/start_clf_server_container.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ docker run -it \
4747
-v /home:/home/host-home \
4848
-v `pwd -P`/../tools/server_private_key.pem:/clf/cczoo/cross_lang_framework/clf_server/certs/server_private_key.pem \
4949
-v `pwd -P`/../tools/server_signed_cert.crt:/clf/cczoo/cross_lang_framework/clf_server/certs/server_signed_cert.crt \
50-
-v `pwd -P`/../clf_server/clf_server.conf:/clf/cczoo/cross_lang_framework/clf_server/clf_server.conf \
50+
-v `pwd -P`/../clf_server/clf_server.conf:/clf/cczoo/cross_lang_framework/clf_server/clf_server.conf \
5151
${image_tag} \
5252
bash
5353

cczoo/grpc-ra-tls/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
*.deb
2-
*.prm
2+
*.rpm
33
*.tar*

cczoo/grpc-ra-tls/README.md

Lines changed: 38 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ Intel SGX technology offers hardware-based memory encryption that isolates speci
6262
library OS Based on Intel SGX technology, designed to run a single application with minimal host
6363
requirements.
6464

65-
- [Occlum](https://github.com/occlum/occlum) (In progress)
65+
- [Occlum](https://github.com/occlum/occlum)
6666

67-
- [TDX](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html) (TODO)
67+
- [TDX](https://www.intel.com/content/www/us/en/developer/articles/technical/intel-trust-domain-extensions.html)
6868

6969
## Build and installation
7070

@@ -108,9 +108,9 @@ images for developing the gRPC RA-TLS application.
108108
```
109109
cd cczoo/common/docker/tdx
110110
111-
base_image=centos:8
112111
image_tag=tdx-dev:dcap1.15-centos8-latest
113-
./build_docker_image.sh ${base_image} ${image_tag}
112+
docker_file=tdx-dev.centos.dockerfile
113+
./build_docker_image.sh ${image_tag} ${docker_file}
114114
```
115115
116116
2. Build gRPC RA-TLS docker image based on TEE docker image
@@ -158,9 +158,10 @@ images for developing the gRPC RA-TLS application.
158158
For saving the expected measurement values of remote application enclave, we create a json template
159159
as following. It is loaded in gRPC server or client initialization.
160160
161-
Refer to `cczoo/grpc-ra-tls/grpc/common/dynamic_config.json`
161+
Refer to `cczoo/grpc-ra-tls/grpc/common/dynamic_config.<TEE TYPE>.json`
162162
163163
```json
164+
# dynamic_config.sgx.json
164165
{
165166
"verify_mr_enclave": "on",
166167
"verify_mr_signer": "on",
@@ -176,26 +177,43 @@ Refer to `cczoo/grpc-ra-tls/grpc/common/dynamic_config.json`
176177
],
177178
}
178179
```
179-
In Gramine examples, the mr_enclave and mr_signer are automatically parsed in `build.sh`.
180-
181-
Refer to `cczoo/grpc-ra-tls/gramine/CI-Examples/grpc/cpp/ratls/build.sh`
180+
In Gramine examples, the `mr_enclave` and `mr_signer` are automatically parsed in
181+
`cczoo/grpc-ra-tls/gramine/CI-Examples/grpc/cpp/ratls/build.sh`.
182182

183-
```bash
184-
function get_env() {
185-
gramine-sgx-get-token -s grpc.sig -o /dev/null | grep $1 | awk -F ":" '{print $2}' | xargs
186-
}
183+
For `isv_prod_id` and `isv_svn` value, please refer to the values defined in libOS configuration files.
184+
In Gramine, it is defined in the template file.
187185

188-
function generate_json() {
189-
cd ${RUNTIME_TMP_PATH}/$1
190-
jq ' .sgx_mrs[0].mr_enclave = ''"'`get_env mr_enclave`'" | .sgx_mrs[0].mr_signer = ''"'`get_env
191-
mr_signer`'" ' ${GRPC_PATH}/dynamic_config.json > ${RUNTIME_TMP_PATH}/$2/dynamic_config.json
192-
cd -
186+
```json
187+
# dynamic_config.tdx.json
188+
{
189+
"verify_mr_seam" : "off",
190+
"verify_mrsigner_seam" : "off",
191+
"verify_mr_td" : "on",
192+
"verify_mr_config_id" : "off",
193+
"verify_mr_owner" : "off",
194+
"verify_mr_owner_config" : "off",
195+
"verify_rt_mr0" : "on",
196+
"verify_rt_mr1" : "on",
197+
"verify_rt_mr2" : "on",
198+
"verify_rt_mr3" : "off",
199+
"tdx_mrs": [
200+
{
201+
"mr_seam" : "",
202+
"mrsigner_seam" : "",
203+
"mr_td" : "",
204+
"mr_config_id" : "",
205+
"mr_owner" : "",
206+
"mr_owner_config" : "",
207+
"rt_mr0" : "",
208+
"rt_mr1" : "",
209+
"rt_mr2" : "",
210+
"rt_mr3" : ""
211+
}
212+
]
193213
}
194214
```
195215

196-
For isv_prod_id and isv_svn value, please refer to the values defined in libOS configuration files.
197-
In Gramine, it is defined in the template file.
198-
216+
Please refer to [tdx_report_parser](https://github.com/intel/confidential-computing-zoo/tree/main/utilities/tdx/tdx_report_parser) tool to get mrs in TDX VM.
199217

200218
## Run examples
201219

@@ -296,9 +314,6 @@ In Gramine, it is defined in the template file.
296314
#start and enter the docker container
297315
image_tag=grpc-ratls-dev:tdx-dcap1.15-centos8-latest
298316
./start_container.sh ${pccs_service_ip} ${image_tag}
299-
300-
#Run the aesm service
301-
/root/start_aesm_service.sh
302317
```
303318

304319
Run the cpp example

cczoo/grpc-ra-tls/gramine/grpc-ratls-dev.dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ RUN ln -s ${GRPC_VERSION_PATH} ${GRPC_PATH}
4545
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3 1
4646

4747
RUN pip3 install --upgrade pip \
48-
&& pip3 install -r ${GRPC_PATH}/requirements.txt
48+
&& pip3 install -r ${GRPC_PATH}/requirements.txt \
49+
&& pip3 install cython==0.29.36
4950

5051
RUN apt-get update \
5152
&& apt-get install -y lsb-release golang strace gdb ctags curl zip\

cczoo/grpc-ra-tls/gramine/grpc-ratls-sgx-dev.dockerfile

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

cczoo/grpc-ra-tls/gramine/start_container.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
set -e
1818

1919
if [ -n "$1" ] ; then
20-
ip_addr=$1
20+
pccs_ip_addr=$1
2121
else
22-
ip_addr=127.0.0.1
22+
pccs_ip_addr=127.0.0.1
2323
fi
2424

2525
if [ -n "$2" ] ; then
@@ -41,11 +41,11 @@ docker run -it \
4141
--privileged=true \
4242
--cap-add=SYS_PTRACE \
4343
--security-opt seccomp=unconfined \
44-
--add-host=pccs.service.com:${ip_addr} \
44+
--add-host=pccs.service.com:${pccs_ip_addr} \
4545
--device=/dev/sgx_enclave:/dev/sgx/enclave \
4646
--device=/dev/sgx_provision:/dev/sgx/provision \
47+
-v /home:/mnt/home \
4748
-v /var/run/aesmd/aesm.socket:/var/run/aesmd/host-aesm.socket \
48-
-v /home:/home/host-home \
4949
-e no_proxy=${no_proxy} \
5050
-e http_proxy=${http_proxy} \
5151
-e https_proxy=${https_proxy} \

cczoo/grpc-ra-tls/grpc/common/bazel_build_cpp.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ if [ -z ${SGX_RA_TLS_BACKEND} ]; then
2525
export SGX_RA_TLS_BACKEND=GRAMINE # GRAMINE,OCCLUM,TDX,DUMMY
2626
fi
2727

28+
if [ "${SGX_RA_TLS_BACKEND}" == "TDX" ]; then
29+
cp ${GRPC_PATH}/dynamic_config.tdx.json ${GRPC_PATH}/dynamic_config.json
30+
else
31+
cp ${GRPC_PATH}/dynamic_config.sgx.json ${GRPC_PATH}/dynamic_config.json
32+
fi
33+
2834
cd ${GRPC_PATH}
2935

3036
echo 'RA_TLS_BACKEND = "'${SGX_RA_TLS_BACKEND}'"' > ${GRPC_PATH}/bazel/ratls.bzl

0 commit comments

Comments
 (0)