README.md 1.8 KB
Newer Older
1 2 3
The files in this directory are used to implement a skeleton enclave runtime,
in order to help to write your own enclave runtime.

4
# Install runectl
5
Refer to [this guide](https://github.com/alibaba/inclavare-containers/tree/master/runectl)
6

7 8
# Build liberpal-skeleton.so
```shell
9 10
cd "${path_to_inclavare_containers}/rune/libenclave/internal/runtime/pal/skeleton"
make
11 12 13 14
```

# Build skeleton docker image
```shell
15
cd "${path_to_inclavare_containers}/rune/libenclave/internal/runtime/pal/skeleton"
16 17 18 19 20 21 22 23
cat >Dockerfile <<EOF
FROM centos:7.2.1511

RUN mkdir -p /run/rune
WORKDIR /run/rune

RUN yum install -y libseccomp-devel
COPY liberpal-skeleton.so .
24 25 26 27
COPY encl.bin .
COPY encl.elf .
COPY encl.ss .
COPY encl.token .
28 29 30 31 32 33 34

RUN ldconfig
EOF
docker build . -t liberpal-skeleton
```

# Run skeleton docker image
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
## Build and install rune
`rune` is a CLI tool for spawning and running enclaves in containers according to the OCI specification.

Please refer to [this guide](https://github.com/alibaba/inclavare-containers#rune) to build `rune` from scratch.

## Configure Docker runtimes
Add the `rune` OCI runtime configuration in dockerd config file (`/etc/docker/daemon.json`) in your system.

``` JSON
{
	"runtimes": {
		"rune": {
			"path": "/usr/local/sbin/rune",
			"runtimeArgs": []
		}
	}
}
```

then restart docker service on your system.
> e.g. `sudo systemctl restart docker` for CentOS, or `sudo service docker restart` for Ubuntu

You can check whether `rune` is correctly added to container runtime or not with
``` shell
sudo docker info | grep rune
Runtimes: rune runc
```

## Run skeleton docker image with rune
64 65 66 67
```shell
docker run -it --rm --runtime=rune \
  -e ENCLAVE_TYPE=intelSgx \
  -e ENCLAVE_RUNTIME_PATH=/run/rune/liberpal-skeleton.so \
68
  -e ENCLAVE_RUNTIME_ARGS="debug" \
69 70
  liberpal-skeleton
```