asterinas / trustflow-capsule-manager

The authorization and key management module of TrustedFlow
7 stars 6 forks source link
confidential-computing privacy-preserving secretflow tee trusted-execution-environment trustedflow

CapsuleManager

CircleCI

CapsuleManager is an Authorization Management Service, which is designed to manage metadata of user data and authorization information.

Features

Run Quickly by Docker Image

If you want to try CapsuleManager quickly, you can use the official Docker image directly.

At present, there are four official images: sim/sgx/tdx/csv, which correspond to Simulation mode, Intel SGX2 mode, Intel TDX mode, and Hygon Csv mode.

Simulation Mode

```bash
# pull docker image
docker pull secretflow/capsule-manager-sim-ubuntu22.04:latest

# enter docker container
docker run -it --name capsule-manager-sim --net host secretflow/capsule-manager-sim-ubuntu22.04:latest bash

# enable TLS(often skip in simulation mode)
# if you want to use the mTLS, you can refer to the mTLS part
# run service
./capsule_manager --tls_config.enable_tls false
```

SGX Mode

  1. Pull and run SGX docker image

    # pull docker image
    docker pull secretflow/capsule-manager-sgx-ubuntu22.04:latest
    
    # enter docker image
    
    docker run -it --name capsule-manager-sgx --net host \
        -v /dev/sgx_enclave:/dev/sgx/enclave \
        -v /dev/sgx_provision:/dev/sgx/provision \
        --privileged=true \
        secretflow/capsule-manager-sgx-ubuntu22.04:latest \
        bash
  2. Modify PCCS config

  1. Run Capsule Manager

    By default, --tls_config.enable_tls is true. You can configure mTLS by referring to Mutual TLS:

    occlum run /bin/capsule_manager --tls_config.enable_tls false

TDX Mode

  1. Pull and run TDX docker image

    # pull docker image
    docker pull secretflow/capsule-manager-tdx-ubuntu22.04:latest
    
    # enter docker image
    
    docker run -it --name capsule-manager-tdx --net host \
        -v /dev/tdx_guest:/dev/tdx_guest \
        --privileged=true \
        secretflow/capsule-manager-tdx-ubuntu22.04:latest \
        bash
  2. Modify PCCS config

    Set real pccs_url and set use_secure_cert to false in /etc/sgx_default_qcnl.conf.

  3. Run Capsule Manager By default, --tls_config.enable_tls is true. You can configure mTLS by referring to Mutual TLS:

    ./capsule_manager --tls_config.enable_tls false

CSV Mode

  1. Pull and run CSV docker image

    # pull docker image
    docker pull secretflow/capsule-manager-csv-ubuntu22.04:latest
    
    # enter docker image
    
    docker run -it --name capsule-manager-csv --net host \
        -v /dev/csv-guest:/dev/csv-guest \
        --privileged=true \
        secretflow/capsule-manager-csv-ubuntu22.04:latest \
        bash
  2. Run Capsule Manager

    By default, tls_config.enable_tls is true. You can configure mTLS by referring to Mutual TLS:

    ./capsule_manager --tls_config.enable_tls false

Mutual TLS

you must generate certificate if you want to use mTLS feature of CapsuleManager

Build And Run By Source Code

If you want to build from source code, you can refer to the following, which should be noted that the build process does not need to be hardware dependent, but the run process does need to be hardware dependent. So if you need to run the program after build, and you need to mount the device when creating the container, executing the following script will automatically detect the current machine device and mount the device into the container:

# create docker container
./env.sh

# enter docker container
./env.sh enter

Simulation Mode

Remote Attestation is not enabled for this mode

  1. Build
    ./script/build -p sim
  2. Run
    ./target/release/capsule_manager --tls_config.enable_tls false

    SGX Mode

  3. Build
    ./script/build -p sgx
  4. Run After entering 'script/occlum_instance', it runs in the same way as the chapter (Run Quickly by Docker Image#SGX mode)

TDX Mode

  1. Build

    ./script/build -p tdx
  2. Modify PCCS config

    Set real pccs_url and set use_secure_cert to false in /etc/sgx_default_qcnl.conf.

  3. Run

    ./target/release/capsule_manager --tls_config.enable_tls false

    CSV Mode

  4. Build

    ./script/build -p csv
  5. Run

    ./target/release/capsule_manager --tls_config.enable_tls false

Contributing

Please check CONTRIBUTING.md

License

This project is licensed under the Apache License