Skip to content

Latest commit

 

History

History
137 lines (107 loc) · 7.67 KB

File metadata and controls

137 lines (107 loc) · 7.67 KB

gRPC Attestation Service

grpc-as is an Attestation Service application based on gRPC protocol.

Now the following types of evidence are supported:

  • az-snp-vtpm: Azure SNP vTPM
  • sgx: Intel SGX
  • snp: AMD SNP
  • tdx: Intel TDX
  • cca: Arm CCA
  • sample: A fake platform. Only for test and sample
  • csv: Hygon CSV
  • az-tdx-vtpm: Azure TDX vTPM
  • se: IBM Secure Execution

Quick Start

Users can use a community version of gRPC CoCoAS image to verify attestation reports.

# run gRPC CoCoAS server locally
docker run -d \
  -v <path-to-attestation-service>/docs/sgx_default_qcnl.conf:/etc/sgx_default_qcnl.conf \ # this qcnl config is used when verifying SGX/TDX quotes
  -p 50004:50004 \
  ghcr.io/confidential-containers/staged-images/coco-as-grpc:latest

The sgx_default_qcnl.conf configures the PCS (Provisioning Certification Service) / PCCS (Provisioning Certification Cache Service) of Intel platforms. A workable file is given here which will directly connect to Intel's PCS without caching. This can be used for test. Users are expected to set the file to connect to another available PCCS which keeps cache. PCCS are usually supported by cloud providers, you can find the steps to configure /etc/sgx_default_qcnl.conf for

Then an attestation request can be used to request the server. We provide an example request of validating a SGX quote.

You can use the tool to generate a report on any supported platform.

# Use the following cmdline to install grpcurl
# go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest

cd <path-to-attestation-service>

REQ=$(cat tests/coco-as/request.json)
grpcurl \
  -plaintext \
  -import-path ../protos \
  -proto ../protos/attestation.proto \
  -d @ 127.0.0.1:50004 attestation.AttestationService/AttestationEvaluate <<EOF
$REQ
EOF

Then a response will be returned

{
  "attestationToken": "eyJhbGciOiJSUzM4NCIsInR5cCI6IkpXVCJ9.eyJjdXN0b21pemVkX2NsYWltcyI6eyJ0ZXN0X2tleSI6InRlc3RfdmFsdWUifSwiZXZhbHVhdGlvbi1yZXBvcnRzIjpbeyJldmFsdWF0aW9uLXJlc3VsdCI6IntcImFsbG93XCI6dHJ1ZX0iLCJw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jyRdu5ZkzoGVK_YQ"
}

The value is a base64 encoded JWT. The body of the JWT is showed in the example.token.json.

More configuration items please refer to the document.

Advanced Topic

Building from Source

For advanced developers, a gRPC CoCoAS can be built from source code. Here are the steps.

Binary Build and Run

Build and install binary

git clone https://github.com/confidential-containers/trustee
cd trustee/attestation-service
WORKDIR=$(pwd)
make VERIFIER=all-verifier && make install

# You can use different verifier by changing the value of VERIFIER
  • For help information, run:
grpc-as --help
  • For version information, run:
grpc-as --version

Start Attestation Service and specify the listen port of its gRPC service:

grpc-as --socket 127.0.0.1:50004

If you want to see the runtime log, run:

RUST_LOG=debug grpc-as --socket 127.0.0.1:50004

Or you can run the binary in a podman container:

# Build the grpc-as container image
podman build \
    -t grpc-as \
    -f attestation-service/docker/as-grpc/Dockerfile \
    .

# Run the grpc-as container
podman run \
    -d \
    -p 50004:50004 \
    --net host \
    grpc-as

Image Build

Build and run container image

git clone https://github.com/confidential-containers/trustee
cd trustee
docker build \
  -t coco-as:grpc \
  -f attestation-service/docker/as-grpc/Dockerfile \
  --build-arg VERIFIER=all-verifier \
  . 

API

The API of gRPC CoCo-AS is defined in the proto.