Skip to content

Commit eb70e03

Browse files
author
Junxian.Xiao
committed
Provide a test docker image for quick start
1 parent ed239b8 commit eb70e03

File tree

4 files changed

+130
-18
lines changed

4 files changed

+130
-18
lines changed

README.md

Lines changed: 45 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,63 @@
33
Attestation based Enclave Configuration service
44

55

6-
## Introduction to KubeTEE AECS
7-
KubeTEE AECS is based on KubeTEE Trusted Function Framework, and provide the
8-
secret generation, management, storage and dispatch service to TEE applications.
9-
After bidirectional authentication based on remote attestation between AECS and
10-
all TEE-based application service, each service enclave instance will get the secrets
11-
from AECS server, and use the secrets for later data encryption or decryption.
6+
## 1 Introduction to KubeTEE AECS
7+
8+
KubeTEE AECS provides the secret generation, management, storage and dispatch
9+
service to TEE applications. After bidirectional authentication based on
10+
remote attestation between AECS and all TEE-based application service,
11+
each service enclave instance will share the secrets from AECS server,
12+
and use the secrets for later use cases.
1213

1314
![AECS](docs/aecs.jpg)
1415

16+
As far as now, we support the following type of secrets:
17+
18+
- AES-GCM 256 key
19+
- RSA key pair
20+
- SM2 key pair
21+
- Self-signed certificate and key
22+
- Secret imported by user (Bring your own seret)
23+
- Application sensitive configurations as key-value pair
24+
25+
26+
## 2 Quick Start
1527

16-
## Quick Start
1728

18-
## Update sub-modules
29+
### 2.1 Run prebuild AECS server for test only
30+
31+
We provide a public docker image for AECS server test only. It's runing in
32+
simulation mode and also has debug log messages. Try it simply like this:
33+
34+
```
35+
./deployment/start.sh start # stop command to stop it
36+
```
37+
38+
39+
### 2.2 Build the test AECS server from source code
40+
41+
In case you want to build the AECS and create the docker image by your self,
42+
please follow the steps (2.2.1 ~ 2.2.4) below.
43+
44+
45+
#### 2.2.1 Update sub-modules
1946

2047
If it's the first time you build the project after clone the source code,
2148
please update the sub-modules like the this.
2249

2350
```
24-
$ git submodule update --init --recursive
51+
git submodule update --init --recursive
2552
```
2653

27-
### Build Project in Docker Environment
54+
55+
#### 2.2.2 Build Project in Docker Environment
2856

2957
```
3058
./deployment/dockerbuild.sh [--build Debug]
3159
```
3260

33-
## Create the Docker Image
61+
62+
#### 2.2.3 Create the Docker Image
3463

3564
You need to generate the test certificates like this (for development and test only, should use formal certificates in product environment):
3665

@@ -44,13 +73,13 @@ Then create the image with test certificates and configurations.
4473
./deployment/create_image.sh
4574
```
4675

47-
### To Start the AECS server
76+
#### 2.2.4 Start the AECS server
4877

4978
```
5079
./deployment/run_image.sh ./aecs_server
5180
```
5281

53-
### Manage the Enclave Service
82+
### 2.3 Manage the Enclave Service
5483

5584
```
5685
# Save the AECS identity key into storage for backup for the first time to start the aecs server
@@ -62,22 +91,22 @@ Then create the image with test certificates and configurations.
6291
./deployment/run_image.sh ./aecsadmin --config /etc/kubetee/aecs_admin_test.kubeconfig --action list
6392
```
6493

65-
### Manage the Enclave Service Secrets
94+
### 2.4 Manage the Enclave Service Secrets
6695

6796
```
6897
# Create three test secrets for service1 and list all of them
6998
./deployment/run_image.sh ./serviceadmin --config /etc/kubetee/service_admin_test.kubeconfig --action create --policy /etc/kubetee/service_secret_policy.yaml
7099
./deployment/run_image.sh ./serviceadmin --config /etc/kubetee/service_admin_test.kubeconfig --action list
71100
```
72101

73-
## Contributing
102+
## 3 Contributing
74103

75104
KubeTEE AECS is not final stable at this moment. There will be some improvements or new feature updates later.
76105
Anyone is also welcome to provide any form of contribution, please see CONTRIBUTING.md for details.
77106

78107
For any security vulnerabilities or other problems, please contact us by [email](mailto:SOFAEnclaveSecurity@list.alibaba-inc.com).
79108

80109

81-
## License
110+
## 4 License
82111
KubeTEE AECS is released by Ant Group under Apache 2.0 License and also used some other opensource code.
83112
See the license information [here](LICENSE) for detail.

deployment/aecs_test.sh

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/usr/bin/env bash
2+
3+
THISDIR="$(readlink -f $(dirname $0))"
4+
5+
IMAGE="antkubetee/kubetee-aecs-test:2.0"
6+
CONTAINERNAME="kubetee-aecs-service-test"
7+
8+
check_aecs_image() {
9+
if sudo docker images | grep "antkubetee\/kubetee-aecs-test[\ ]*2.0" ; then
10+
echo "The aecs v2.0 test image is already existing!"
11+
else
12+
echo "Pulling aecs v2.0 test image ..."
13+
sudo docker pull antkubetee/kubetee-aecs-test:2.0
14+
fi
15+
}
16+
17+
start_aecs_server() {
18+
# Run aecs_server in background
19+
# Have not remove storage directory here to save history secrets
20+
echo "Create the aecs test container ..."
21+
sudo docker run -td \
22+
--name $CONTAINERNAME \
23+
--privileged \
24+
--net=host \
25+
--cap-add=SYS_PTRACE \
26+
--security-opt seccomp=unconfined \
27+
--env LD_LIBRARY_PATH=/opt/intel/sgxsdk/lib64/ \
28+
-v $THISDIR/storage:/root/storage \
29+
$IMAGE "./aecs_server"
30+
31+
echo "Waiting for aecs start ..."
32+
sleep 3
33+
}
34+
35+
stop_aecs_test() {
36+
echo "Destroy the aecs test container ..."
37+
sudo docker rm -f $CONTAINERNAME
38+
}
39+
40+
do_aecs_provison() {
41+
# Provison
42+
$THISDIR/run_image.sh ./aecsadmin \
43+
--config /etc/kubetee/aecs_admin_test.kubeconfig \
44+
--action provision \
45+
--hostname localtest
46+
}
47+
48+
register_aecs_test_service() {
49+
# Create the test service
50+
$THISDIR/run_image.sh ./aecsadmin \
51+
--config /etc/kubetee/aecs_admin_test.kubeconfig \
52+
--action register \
53+
--service service1 \
54+
--pubkey /etc/certs/service_admin_public.pem
55+
$THISDIR/run_image.sh ./aecsadmin \
56+
--config /etc/kubetee/aecs_admin_test.kubeconfig \
57+
--action list
58+
}
59+
60+
create_aecs_test_secrets() {
61+
# Create the test secrets for test service
62+
$THISDIR/run_image.sh ./serviceadmin \
63+
--config /etc/kubetee/service_admin_test.kubeconfig \
64+
--action create \
65+
--policy /etc/kubetee/service_secret_policy.yaml
66+
$THISDIR/run_image.sh ./serviceadmin \
67+
--config /etc/kubetee/service_admin_test.kubeconfig \
68+
--action list
69+
}
70+
71+
start_aecs_test() {
72+
check_aecs_image && \
73+
start_aecs_server && \
74+
do_aecs_provison && \
75+
register_aecs_test_service && \
76+
create_aecs_test_secrets
77+
}
78+
79+
case $1 in
80+
start) start_aecs_test ;;
81+
stop) stop_aecs_test ;;
82+
*) echo "Usage: $0 [start|stop]"
83+
esac

deployment/create_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
THISDIR="$(readlink -f $(dirname $0))"
44
DOCKERFILE="${1:-${THISDIR}/dockerfile/Dockerfile}"
5-
IMAGENAME="${2:-kubetee-aecs-service:1.0}"
5+
IMAGENAME="${2:-antkubetee/kubetee-aecs-test:2.0}"
66
#IMAGETAG="$(date +%F-%H%M%S)"
77

88
if [ ! -f "$DOCKERFILE" ] ; then

deployment/run_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
SCRIPTNAME="$(basename $0)"
44
THISDIR="$(dirname $(readlink -f $0))"
55

6-
IMAGE="kubetee-aecs-service:1.0"
6+
IMAGE="antkubetee/kubetee-aecs-test:2.0"
77
CONTAINERNAME="kubetee-aecs-service-$$"
88
if [ -z "$IMAGE" ] ; then
99
echo "Usage: $SCRIPTNAME <image:tag> [container-name]"

0 commit comments

Comments
 (0)