Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add confidential inference for penetration testing #208

Open
wants to merge 71 commits into
base: branch-dev/pentests
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
db38527
Add Ubuntu 20.04 support, upgrade gramine to v1.2 and update doc
RodgerZhu Aug 23, 2022
325ffd7
Update doc
RodgerZhu Aug 23, 2022
c792789
Modify the image path
Hsy-Intel Aug 25, 2022
d5550a8
enable gramine in anolisos and update docs and readme
billionairiam Sep 7, 2022
d24c517
fixup! enable gramine in anolisos and update docs and readme
billionairiam Sep 15, 2022
41e7f8d
Add support for Ubuntu 20.04 and gramine v1.2
Hsy-Intel Aug 26, 2022
d511a5f
Update dockerfiles in common folder
Hsy-Intel Aug 26, 2022
5540ad4
Update image
Hsy-Intel Aug 26, 2022
47ec19a
Support docker
liangintel Sep 13, 2022
73d3021
add the script to support tencent ccp
liangintel Oct 19, 2022
0c8574c
add parameters and revise Readme
hhr293 Oct 17, 2022
9ef0124
Merge pull request #146 from liangintel/ccp
liangintel Oct 19, 2022
bab9f81
Merge pull request #145 from hhr293/main
liangintel Oct 20, 2022
1131d61
Fix bugs in parameter parsing
liangintel Oct 20, 2022
785e189
Merge pull request #148 from liangintel/branch-dev/cross_lang_framework
liangintel Oct 20, 2022
62699f3
Merge branch 'intel:main' into branch-dev/cross_lang
hhr293 Oct 21, 2022
cf078fc
revise dockerfile and convert_docker file
invalid-email-address Oct 21, 2022
9807f5b
Merge pull request #149 from hhr293/branch-dev/cross_lang
liangintel Oct 21, 2022
885bae2
add clf_server ccp template
liangintel Oct 21, 2022
11814f4
Fix bug: mrenclave checking is broken by last commit
liangintel Oct 26, 2022
d2b85a2
Merge pull request #155 from liangintel/branch-dev/cross_lang_framework
liangintel Oct 26, 2022
ac1de23
revise convert_docker file and add readme for ccp
invalid-email-address Oct 26, 2022
28b0c60
Merge branch 'branch-dev/cross_lang_framework' into branch-dev/cross_…
liangintel Oct 26, 2022
28de148
Merge pull request #156 from hhr293/branch-dev/cross_lang
liangintel Oct 26, 2022
3c22473
Update README_for_clf_server.md
liangintel Oct 27, 2022
2c6ab28
Update README_for_clf_client.md
liangintel Oct 27, 2022
5fd8990
Merge pull request #157 from liangintel/branch-dev/cross_lang_framework
liangintel Oct 27, 2022
749e620
Enable psi in anolisos (#135)
billionairiam Oct 27, 2022
0061c91
Merge branch 'main' into branch-dev/psi
RodgerZhu Oct 27, 2022
4bd27bc
Add script to generate certification
liangintel Nov 1, 2022
bf99312
Merge branch 'branch-dev/cross_lang_framework' of https://github.com/…
liangintel Nov 1, 2022
1dc27c5
add commandline option to gen_cert.sh
liangintel Nov 2, 2022
a90f2b6
Merge pull request #163 from liangintel/branch-dev/cross_lang_framework
liangintel Nov 2, 2022
af09e01
revert to last commit - graminev1.2 (#167)
liangintel Nov 10, 2022
776179d
Upgrade gramine from v1.2 to v1.3.1 (#164)
billionairiam Nov 14, 2022
feb3126
Support for Gramine v1.2 and update docs (#172)
Hsy-Intel Nov 15, 2022
ca36aab
remove cryptography from dockerfile
liangintel Nov 18, 2022
a4c58b6
remove cryptography from dockerfile (#178)
liangintel Nov 18, 2022
f3b9ce8
Merge branch 'main' into branch-dev/psi
RodgerZhu Nov 22, 2022
305f61d
Sync dev/pentests to main (#187)
RodgerZhu Nov 25, 2022
8836a41
Added some miss components (#188)
billionairiam Nov 30, 2022
9889b34
Fix app version (#191)
pengyuabc Dec 6, 2022
34e8095
Revert "Fix app version (#191)" (#192)
RodgerZhu Dec 6, 2022
95e900b
Work around python extract tarfile error in encrypted file system (#195)
BuJianlin Dec 6, 2022
8fa009c
Submit HTTPA solution (#198)
hanboa Dec 20, 2022
d2c29c3
add tootip for clf_server and clf_client (#158)
hhr293 Dec 20, 2022
25432d2
Sync branch-dev/cross_lang_framework to main
Dec 20, 2022
df7ade9
Update README.md
RodgerZhu Dec 20, 2022
3c9f391
Merge branch 'intel:branch-dev/cross_lang_framework' into branch-dev/…
liangintel Dec 20, 2022
60363e0
fix typo in readme
liangintel Dec 20, 2022
244cc30
Merge pull request #199 from liangintel/branch-dev/cross_lang_framework
liangintel Dec 20, 2022
85f08e0
Update VFL and tf-serving documentation (#200)
shui1 Dec 21, 2022
bf0e9f2
Fixed app version (#194)
pengyuabc Dec 21, 2022
b993fc0
Add Private Set Intersection support for Azure deployments (#185)
shui1 Dec 21, 2022
840c19d
Sync branch0.1/tf serving cluster to main (#202)
RodgerZhu Dec 22, 2022
ae3f479
Update ccp-tf-serving documentation (#201)
pengyuabc Dec 22, 2022
01a28b7
Sync branch 'hfl-tensorlfow' to main
RodgerZhu Dec 22, 2022
d9276f2
Merge branch 'main' of https://github.com/intel/confidential-computin…
RodgerZhu Dec 22, 2022
3c1fb05
Merge branch 'clf'
RodgerZhu Dec 22, 2022
e1a7b9e
Merge branch 'psi'
RodgerZhu Dec 22, 2022
1ecd729
Sync branch dev/machine binding root key backup to main (#206)
RodgerZhu Dec 22, 2022
d793740
Update encryption tool & key
0400H Dec 22, 2022
ecd2f04
Update tensorflow_model_server.toml
RodgerZhu Dec 22, 2022
c6587ef
Update cert
0400H Dec 23, 2022
13f0b4a
Update tf_serving.dockerfile
RodgerZhu Dec 23, 2022
93769ec
Update tf_serving.dockerfile
RodgerZhu Dec 23, 2022
c0a356b
Add files via upload
RodgerZhu Dec 23, 2022
ae4f92f
Update tensorflow_model_server.toml
RodgerZhu Dec 26, 2022
515b602
Update tf_serving.dockerfile
RodgerZhu Dec 26, 2022
6f6c874
Update tensorflow_model_server.toml
RodgerZhu Dec 27, 2022
ebf5bce
Add confidential inference for penetration testing
BuJianlin Jan 5, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 31 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ document section that explains the corresponding details and then guides you to
(RA-gRPC)</span>
</td>
<td>
<span class="md-plain"><a href="https://cczoo.readthedocs.io/en/latest/Solutions/vertical-federated-learning/vfl.html" target="_blank">ByteDance Cloud</a></span>
<span class="md-plain">
<a href="https://cczoo.readthedocs.io/en/latest/Solutions/psi/PSI.html" target="_blank">ByteDance Cloud</a>, <br />
<a href="https://cczoo.readthedocs.io/en/latest/Solutions/psi/PSI.html" target="_blank">Microsoft Azure</a></span>
</td>
<td>
<strong><span style="font-family:Arial;">Published</span></strong>
Expand Down Expand Up @@ -713,25 +715,25 @@ of them is proven useful enough and stable enough via a thorough validation with
CCZoo reference solutions running on various public cloud services, it will graduate
from CCZoo and evolve to a standalone project.

<table border="1" bordercolor="#000000" cellpadding="2" cellspacing="0" style="width:100%;">
<table border="1">
<tbody>
<tr>
<td colspan="1" rowspan="1">
<strong>Incubating Component Project <span style="font-size:22px;">'*'</span></strong>
Incubating Component Project'*'
</td>
<td colspan="1" rowspan="1">
<span style="color:#333333;font-family:Arial;"><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Description</strong></span>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Description
</td>
<td rowspan="1">
<strong>Status</strong>
Status
</td>
<td colspan="1" rowspan="1">
<span style="color:#333333;font-family:Arial;"><strong>Validated in Public Cloud</strong></span>
Validated in Public Cloud
</td>
</tr>
<tr>
<td colspan="1">
<a href="https://cczoo.readthedocs.io/en/main/Solutions/rats-tls/index.html"><strong>RATS-TLS</strong></a>
<a href="https://cczoo.readthedocs.io/en/main/Solutions/rats-tls/index.html">RATS-TLS</a>
</td>
<td>
This project provides a proof-of-concept implementation on how to integrate Intel SGX and TDX remote attestation into the TLS connection setup. Conceptually, it extends the standard X.509 certificate&nbsp;with SGX and TDX related information. It also provides two non-SGX clients (Wolfssl and OpenSSL)&nbsp;to show how seamless remote attestation works with different TLS libraries.&nbsp;
Expand All @@ -740,12 +742,12 @@ from CCZoo and evolve to a standalone project.
Published
</td>
<td>
<span class="md-plain"><span><a href="https://cczoo.readthedocs.io/en/main/Solutions/grpc-ra-tls/index.html#aliyun-ecs">Alibaba Cloud</a></span></span>
<a href="https://cczoo.readthedocs.io/en/main/Solutions/grpc-ra-tls/index.html#aliyun-ecs">Alibaba Cloud</a>
</td>
</tr>
<tr>
<td colspan="1">
<a href="https://cczoo.readthedocs.io/en/latest/Solutions/grpc-ra-tls/index.html"><strong>RA-TLS Enhanced gRPC</strong></a>
<a href="https://cczoo.readthedocs.io/en/latest/Solutions/grpc-ra-tls/index.html">RA-TLS Enhanced gRPC</a>
</td>
<td>
This project provides an enhanced&nbsp;<a href="https://grpc.io/">gRPC</a>&nbsp;(Remote Procedure Call) framework to guarantee security during transmission and runtime via two-way&nbsp;<a href="https://arxiv.org/pdf/1801.05863">RA-TLS</a>&nbsp;(Intel SGX Remote Attestation with Transport Layer Security) based on&nbsp;<a href="https://en.wikipedia.org/wiki/Trusted_execution_environment">TEE</a>&nbsp;(Trusted Execution Environment).
Expand All @@ -754,15 +756,28 @@ from CCZoo and evolve to a standalone project.
Published
</td>
<td>
<span class="md-plain"><span><a href="https://cczoo.readthedocs.io/en/main/Solutions/grpc-ra-tls/index.html#aliyun-ecs">Alibaba Cloud</a>, <br />
<a href="https://cczoo.readthedocs.io/en/main/Solutions/grpc-ra-tls/index.html#aliyun-ecs">Alibaba Cloud</a>, <br />
<a href="https://cczoo.readthedocs.io/en/main/Solutions/grpc-ra-tls/index.html#tencent-cloud">Tencent Cloud</a>,<br />
<a href="https://cczoo.readthedocs.io/en/main/Solutions/grpc-ra-tls/index.html#bytedance-cloud" target="_blank">ByteDance Cloud</a></span></span>
<a href="https://cczoo.readthedocs.io/en/main/Solutions/grpc-ra-tls/index.html#bytedance-cloud" target="_blank">ByteDance Cloud</a>
</td>
</tr>
<tr>
<td>
<a href="https://cczoo.readthedocs.io/en/latest/Solutions/httpa/index.html" target="_blank">HTTPA</a>
</td>
<td>
&nbsp;HTTPA aims for two purposes. First, help perform remote attestation on the web application running inside the TEE in which the flow can be unilateral (one-way HTTPA) or bilateral (mutual HTTPA) by verifying attestation evidence with a verifier such as a trusted authority (TA). Second, help build secure communication directly with the web application at L7 running inside the TEE.&nbsp;<br />
</td>
<td>
Published
</td>
<td>
/
</td>
</tr>
</tbody>
</table>


---

# Cloud Deployment
Expand Down Expand Up @@ -896,7 +911,7 @@ Below table shows solutions and component projects validated in public clouds. A
</div>
</td>
<td>
/
N/A
</td>
<td>
<a href="https://cloud.tencent.com/document/product/213/63353">sgx-dcap-server-tc.sh.tencent.cn&nbsp;</a>
Expand Down Expand Up @@ -975,6 +990,9 @@ Set Intersection (PSI)</a><br />
<li>
<a href="https://cczoo.readthedocs.io/en/latest/Solutions/logistic-regression-inference-HE-SGX/index.html" target="_blank">Secure Logistic Logical Regression Inference with HE and SGX</a>
</li>
<li>
<a href="https://cczoo.readthedocs.io/en/latest/Solutions/psi/PSI.html" target="_blank">Private Set Intersection (PSI)</a>
</li>
</ul>
<p>
<br />
Expand Down
5 changes: 3 additions & 2 deletions cczoo/common/docker/gramine/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Execute the following command to build this docker image:
```
base_image=ubuntu:20.04
image_tag=gramine-sgx-dev:v1.2-ubuntu20.04-latest
./build_docker_image.sh ${base_image} ${image_tag}
build_type=release
./build_docker_image.sh ${base_image} ${image_tag} ${build_type}
```

`ubuntu:18.04` and `ubuntu:20.04` could be selected as base_image.
`ubuntu:18.04`, `ubuntu:20.04` and `anolisos` could be selected as base_image.
36 changes: 29 additions & 7 deletions cczoo/common/docker/gramine/build_docker_image.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,55 @@
#!/bin/bash
set -e

if [ "$1" == "anolisos" ] ; then
function usage_help() {
echo -e "usage_help:"
echo -e ' ./build_docker_image.sh ${base_image} ${image_tag} ${build_type}'
echo -e " {base_image}"
echo -e " ubuntu:18.04 | ubuntu20.04 | anolisos"
echo -e " {image_tag}"
echo -e " customed image tag"
echo -e " {build_type}"
echo -e " release | debug"
}

usage_help

if [ -n "$1" ] ; then
base_image=$1
else
base_image=ubuntu:20.04

fi

if [ -n "$2" ] ; then
if [ "$2" == "anolisos" ] ; then
image_tag=gramine-sgx-dev:v1.2-anolisos
elif [ -n "$2" ] ; then
image_tag=$2
else
image_tag=gramine-sgx-dev:v1.2-ubuntu20.04-latest
fi

if [ -n "$3" ] ; then
build_type=$3
else
build_type=release
fi

# You can remove no_proxy and proxy_server if your network doesn't need it
no_proxy="localhost,127.0.0.1"
proxy_server="" # your http proxy server
# proxy_server="" # your http proxy server

cd `dirname $0`

if [ ${base_image} == "anolisos" ] ; then
if [ "${base_image}" == "anolisos" ] ; then
DOCKER_BUILDKIT=0 docker build \
--build-arg no_proxy=${no_proxy} \
--build-arg http_proxy=${proxy_server} \
--build-arg https_proxy=${proxy_server} \
--build-arg base_image=${base_image} \
--build-arg BASE_IMAGE=${base_image} \
--build-arg BUILD_TYPE=${build_type} \
-f gramine-sgx-dev:v1.2-anolisos.dockerfile \
-t gramine-sgx-dev:v1.2-anolisos \
-t ${image_tag} \
.
else
DOCKER_BUILDKIT=0 docker build \
Expand All @@ -52,8 +73,9 @@ DOCKER_BUILDKIT=0 docker build \
--build-arg https_proxy=${proxy_server} \
--build-arg base_image=${base_image} \
--build-arg BASE_IMAGE=${base_image} \
--build-arg BUILD_TYPE=${build_type} \
-f gramine-sgx-dev.dockerfile \
-t gramine-sgx-dev:v1.2-ubuntu20.04-latest \
-t ${image_tag} \
.
fi
cd -
13 changes: 3 additions & 10 deletions cczoo/common/docker/gramine/gramine-sgx-dev.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@ RUN git clone https://github.com/intel/SGXDataCenterAttestationPrimitives.git ${
# COPY gramine/patches ${GRAMINEDIR}
# RUN cd ${GRAMINEDIR} \
# && git apply *.diff

# RUN openssl genrsa -3 -out ${SGX_SIGNER_KEY} 3072

ARG BUILD_TYPE=release
RUN cd ${GRAMINEDIR} \
&& LD_LIBRARY_PATH="" meson setup build/ --buildtype=debug -Dprefix=${INSTALL_PREFIX} -Ddirect=enabled -Dsgx=enabled -Ddcap=enabled -Dsgx_driver=dcap1.10 -Dsgx_driver_include_path=${ISGX_DRIVER_PATH}/driver/linux/include \
&& LD_LIBRARY_PATH="" meson setup build/ --buildtype=${BUILD_TYPE} -Dprefix=${INSTALL_PREFIX} -Ddirect=enabled -Dsgx=enabled -Ddcap=enabled -Dsgx_driver=dcap1.10 -Dsgx_driver_include_path=${ISGX_DRIVER_PATH}/driver/linux/include \
&& LD_LIBRARY_PATH="" ninja -C build/ \
&& LD_LIBRARY_PATH="" ninja -C build/ install

Expand Down Expand Up @@ -122,14 +123,6 @@ RUN gramine-sgx-gen-private-key

COPY configs /

RUN gramine-sgx-gen-private-key

COPY configs /

RUN gramine-sgx-gen-private-key

COPY configs /

# Use it to ignore packages authenticate in apt-get
# ENV apt_arg="-o Acquire::AllowInsecureRepositories=true \
# -o Acquire::AllowDowngradeToInsecureRepositories=true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ RUN mkdir /opt/intel && cd /opt/intel \
&& sha256sum sgx_rpm_local_repo.tar.gz \
&& tar xvf sgx_rpm_local_repo.tar.gz \
&& yum-config-manager --add-repo file:///opt/intel/sgx_rpm_local_repo \
&& yum -y --nogpgcheck install libsgx-urts libsgx-launch libsgx-epid libsgx-quote-ex libsgx-dcap-ql libsgx-uae-service libsgx-dcap-quote-verify-devel
&& yum -y --nogpgcheck install libsgx-urts libsgx-launch libsgx-epid libsgx-quote-ex libsgx-dcap-ql libsgx-uae-service libsgx-dcap-quote-verify-devel \
&& yum -y groupinstall 'Development Tools'

# COPY patches/libsgx_dcap_quoteverify.so /usr/lib64/
Expand Down Expand Up @@ -67,9 +67,9 @@ RUN git clone https://github.com/intel/SGXDataCenterAttestationPrimitives.git ${
&& cd ${ISGX_DRIVER_PATH} \
&& git checkout ${SGX_DCAP_VERSION}

ENV LD_LIBRARY_PATH=${INSTALL_PREFIX}/lib:${INSTALL_PREFIX}/lib64:${LD_LIBRARY_PATH}
ARG BUILD_TYPE=release
RUN cd ${GRAMINEDIR} \
&& LD_LIBRARY_PATH="" meson setup build/ --buildtype=debug -Dprefix=${INSTALL_PREFIX} -Ddirect=enabled -Dsgx=enabled -Ddcap=enabled -Dsgx_driver=dcap1.10 -Dsgx_driver_include_path=${ISGX_DRIVER_PATH}/driver/linux/include \
&& LD_LIBRARY_PATH="" meson setup build/ --buildtype=${BUILD_TYPE} -Dprefix=${INSTALL_PREFIX} -Ddirect=enabled -Dsgx=enabled -Ddcap=enabled -Dsgx_driver=dcap1.10 -Dsgx_driver_include_path=${ISGX_DRIVER_PATH}/driver/linux/include \
&& LD_LIBRARY_PATH="" ninja -C build/ \
&& LD_LIBRARY_PATH="" ninja -C build/ install
RUN gramine-sgx-gen-private-key
Expand Down
57 changes: 57 additions & 0 deletions cczoo/cross_lang_framework/ccp/README_for_clf_client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# 在CCP平台上运行clf_client服务
本文档是关于在CCP平台上构建CLF框架中的clf_server镜像并运行该镜像的说明文档,阐述了用户在CCP平台上运行clf_server镜像服务的过程.

## CLF技术架构
Cross language Framework(CLF),基于Gramine和Intel SGX技术,是提供不同机器之间的非C语言程序的远程认证和数据/密钥读写和传输服务的框架. 多个参与方各自拥有部分机密数据进行合作共同运算而不泄露数据给对方,做到数据可用不可见. CLF框架主要由clf_server端和clf_client端两部分构成:
- **clf_client端**,具备Intel SGX功能的可以提供可信执行环境的为clf_client端, clf_client端只有一个, 运行着多方机密计算的程序;
- **clf_server端**,保存有机密数据的为clf_server端,供clf_client读写数据。每次读写数据都会先自动验证clf_client的合法性,即为SGX的可信执行环境(enclave),认证通过之后才会运行数据的读写。一套解决方案中可以同时存在多个clf_server端

## 环境配置信息
- Kernel: 版本5.11及以上.
- 需安装Docker: 请参考 [引导](https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script)来安装Docker服务.
- 规格: 选择内存型中的M6ce机型,加密内存>=4G

## 基于CCP部署CLF框架之客户端
### 1. 准备工作
在机器上,首先下载如下开源库:
```
git clone https://github.com/intel/confidential-computing-zoo.git
```

### 2. 创建clf_client镜像
```
cd <confidential-computing-zoo dir>/confidential-computing-zoo/cczoo/cross_lang_framework/docker/
./build_clf_client_docker_image.sh #生成clf_client sdk镜像
./build_clf_client_app_docker_image.sh #生成sample app镜像,**实际应用中此处应该替换成用户实际的基于clf_client sdk开发的app**
```

### 3. 打包成CCP镜像
```
ccp-cli pack --app-entry="/usr/bin/java"
--memsize=8192M --thread=64
--tmpl=clf_client
--secret-id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
--secret-key=kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
--capp-id=capp-ODdjZWZhOWYt
--app-image=clf-client:gramine1.3-ubuntu20.04
--app-type=image
--start=/clf/cczoo/cross_lang_framework/clf_client/app
```
- `memsize`和`thread`可以根据用户APP实际需求自己定义
- `secret-key`,`secret-id`,`capp-id`根据用户在CCP平台上的账户和实例ID填写
- 其余参数保持默认即可

### 4. 运行clf_client镜像
```
docker run -ti --device /dev/sgx_enclave --device /dev/sgx_provision
-v <your_ca_cert>:/app_repo/cczoo/cross_lang_framework/clf_client/app/certs/ca_cert.crt
--add-host=<clf_server_hostname>:<clf_server_ip> sec_clf-client:gramine1.3-ubuntu20.04
-Xmx4G clf_test <clf_server_hostname>
```
这个指令的作用是将CCP平台上的clf-client镜像运行起来
- `--device`, CCP镜像依赖于intel的SGX, 需要将设备`/dev/sgx_enclave和/dev/sgx_provision`映射进container.
- `-v`,将根证书映射进container。此证书用于验证server证书的合法性。证书的生成可以参考使用tools/gen_cert.sh,将生成的ca_cert.crt映射进container.
- `--add-host`,为了让容器识别clf_server的主机名, 需要根据自己的需要将主机名和ip地址的匹配关系映射进container
- ` -Xmx4G clf_test <clf_server_hostname>` app具体需要的参数, 用户需要根据自己的APP参数对这部分进行修改

CLF开发和配置细节请参考 [CLF文档](https://github.com/intel/confidential-computing-zoo/blob/main/cczoo/cross_lang_framework/README.md)
55 changes: 55 additions & 0 deletions cczoo/cross_lang_framework/ccp/README_for_clf_server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# 在CCP平台上运行clf_server服务
本文档是关于在CCP平台上构建CLF框架中的clf_server镜像并运行该镜像的说明文档,阐述了用户在CCP平台上运行clf_server镜像服务的过程.

## CLF技术架构
Cross language Framework(CLF),基于Gramine和Intel SGX技术,是提供不同机器之间的非C语言程序的远程认证和数据/密钥读写和传输服务的框架. 多个参与方各自拥有部分机密数据进行合作共同运算而不泄露数据给对方,做到数据可用不可见. CLF框架主要由clf_server端和clf_client端两部分构成:
- **clf_client端**,具备Intel SGX功能的可以提供可信执行环境的为clf_client端, clf_client端只有一个, 运行着多方机密计算的程序;
- **clf_server端**,保存有机密数据的为clf_server端,供clf_client读写数据。每次读写数据都会先自动验证clf_client的合法性,即为SGX的可信执行环境(enclave),认证通过之后才会运行数据的读写。一套解决方案中可以同时存在多个clf_server端

## 环境配置信息
- Kernel: 版本5.11及以上.
- 需安装Docker: 请参考 [引导](https://docs.docker.com/engine/install/ubuntu/#install-using-the-convenience-script)来安装Docker服务.
- 规格: 选择内存型中的M6ce机型,加密内存>=4G

## 基于CCP部署clf_server镜像
### 1. 准备工作
在机器上,首先下载如下开源库:
```
git clone https://github.com/intel/confidential-computing-zoo.git
```

### 2. 创建clf_server镜像
```
cd <confidential-computing-zoo dir>/confidential-computing-zoo/cczoo/cross_lang_framework/docker/
./build_clf_server_docker_image.sh
```

### 3. 打包成CCP镜像
```
ccp-cli pack --app-entry="/clf/cczoo/cross_lang_framework/clf_server/clf_server"
--memsize=8192M --thread=64
--tmpl=default
--secret-id=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
--secret-key=kkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
--capp-id=capp-Y2IyNGM1YzAt
--app-image=clf-server:gramine1.3-ubuntu20.04
--app-type=image
--start=/clf/cczoo/cross_lang_framework/clf_server
```
参数`secret-key`,`secret-id`,`capp-id`替换成用户实际有效的值,参数`app-image`是用户之间创建的`clf-server`镜像的标签, 默认是`clf-server:gramine1.3-ubuntu20.04`,其他参数保持参考指令里的值即可。

### 4. 运行clf_server镜像
```
docker run -it -p 4433:4433 --device /dev/sgx_enclave --device /dev/sgx_provision
-v <your_certs_folder>:/clf/cczoo/cross_lang_framework/clf_server/certs
-v <your_clf_server.conf>:/clf/cczoo/cross_lang_framework/clf_server/clf_server.conf
sec_clf-server:gramine1.3-ubuntu20.04
```
这个指令的作用是将打包好的clf-server的CCP镜像运行起来

- `-p`端口号, 默认是4433端口
- `--device`, CCP镜像依赖于intel的SGX, 需要将设备`/dev/sgx_enclave和/dev/sgx_provision`映射进container.
- `-v`, 将证书文件夹映射进container:`/clf/cczoo/cross_lang_framework/clf_server/certs`, 证书的生成可以参考使用tools/gen_cert.sh,将生成的server_private_key.pem和server_signed_cert.crt映射进container。
- `-v`, 将配置文件映射进container: `/clf/cczoo/cross_lang_framework/clf_server/clf_server.conf`

配置细节请参考 [CLF文档](https://github.com/intel/confidential-computing-zoo/blob/main/cczoo/cross_lang_framework/README.md)
18 changes: 18 additions & 0 deletions cczoo/cross_lang_framework/ccp/Tooltip_for_clf_client.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## 应用名称
Cross-language Framework client
## 应用版本
1.0
## 分类
机密计算
## 描述
基于Gramine和Intel SGX技术,是提供不同机器之间的非C语言程序的远程认证和数据/密钥读写和传输服务的框架.
多个参与方各自拥有部分机密数据进行合作共同运算而不泄露数据给对方,做到数据可用不可见, 主要由clf_server端和clf_client端两部分构成
clf_client端,具备Intel SGX功能的可以提供可信执行环境的,运行着多方机密计算的程序;
## 参考链接
https://github.com/intel/confidential-computing-zoo/tree/main/cczoo/cross_lang_framework/ccp
## 官方网站
https://github.com/intel/confidential-computing-zoo/tree/main/cczoo/cross_lang_framework/
## 创建时间
2022-10-27 14:06:28
## 使用次数
0
18 changes: 18 additions & 0 deletions cczoo/cross_lang_framework/ccp/Tooltip_for_clf_server.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
## 应用名称
Cross-language Framework server
## 应用版本
1.0
## 分类
机密计算
## 描述
基于Gramine和Intel SGX技术,是提供不同机器之间的非C语言程序的远程认证和数据/密钥读写和传输服务的框架.
可以在多个参与方各自拥有部分机密数据进行合作的场景下进行共同运算,做到数据可用不可见, 主要由clf_server端和clf_client端两部分构成
clf_server端保存有机密数据,供clf_client读写
## 参考链接
https://github.com/intel/confidential-computing-zoo/tree/main/cczoo/cross_lang_framework/ccp
## 官方网站
https://github.com/intel/confidential-computing-zoo/tree/main/cczoo/cross_lang_framework
## 创建时间
2022-10-27 14:06:28
## 使用次数
0
Loading