Service: CCNP Quote Service¶
This service will provide quote generated by underlying TEE platform for remote attestation service to verify the integrity and confidentiality of the trusted computing environment and required software environment.
Introduction¶
This service provides functionality to fetch quote of underlying TEE platform with nonce as mandatory input and a base64 encoded user data as optional input. The nonce and user data will be digested and added into quote for remote attestation to verify the freshness of the quote and the user specified data.
The quote server uses Unix domain socket based gRPC to serve the client SDK. And the proto buffer message is as bellow:
message HealthCheckRequest {
string service = 1;
}
message HealthCheckResponse {
enum ServingStatus {
UNKNOWN = 0;
SERVING = 1;
NOT_SERVING = 2;
SERVICE_UNKNOWN = 3;
}
ServingStatus status = 1;
}
service GetQuote {
rpc GetQuote (GetQuoteRequest) returns (GetQuoteResponse);
}
message GetQuoteRequest {
string user_data = 1;
string nonce = 2;
}
message GetQuoteResponse {
string quote = 1;
string quote_type = 2;
}
Installation¶
The quote service can be deployed as either DaemonSet or sidecar according to different user scenarios.
Prerequisite¶
User need to have a kubernetes cluster ready to deploy the services. To simplify the deployment process, we provide Helm as one of the options to deploy the service. Please install Helm by following the Helm official guide. However, user can also use the yaml files located in the manifests folder for deployment. Also, the ccnp device plugin need to installed before the installation of quote server. Please refer to its deployment guide for installation.
Build docker image¶
The Dockerfile for the service can be found under container/ccnp-quote-server
directory. Use the following command to build the image:
docker build -t ccnp-quote-server:<your image tag> -f container/ccnp-quote-server/Dockerfile .
Note: if you are using containerd as the default runtime for kubernetes, don’t forget to use the following commands to import the image into containerd first:
docker save -o ccnp-quote-server.tar ccnp-quote-server:<your image tag>
ctr -n=k8s.io image import ccnp-quote-server.tar
Deploy as DaemonSet in Kubernetes¶
deploy using helm chart
cd deployment/
# edit the value file for quote-server helm chart and run:
helm install charts/quote-server --generate-name
deploy using manifests yaml file
please check file deployment/manifests/quote-server-deployment.yaml
to confirm the container image to use and run:
kubectl apply -f deployment/manifests/quote-server-deployment.yaml
Testing¶
You can play with service on host by following the steps below:
Start the quote service
Tips: please make sure /run/ccnp/uds
directory exists with other user can write to it:
root@tdx-guest:~# ls -l /run/ccnp/
total 0
drwxr-xrwx 2 root root 60 Sep 1 05:05 uds
And then build and run the quote server with binary:
cd service/quote-server
make build
./target/release/quote_server
Play with the service
Use the grpcurl
as the tool to play with the service. Please follow the official documentation to install grpcurl
Get quote from the TDX platform:
grpcurl -authority "dummy" -d '{"user_data": "MTIzNDU2NzgxMjM0NTY3ODEyMzQ1Njc4MTIzNDU2NzgxMjM0NTY3ODEyMzQ1Njc4", "nonce":"IXUKoBO1UM3c1wopN4sY"}' -plaintext -unix /run/ccnp/uds/quote-server.sock quoteserver.GetQuote.GetQuote
and the output should be as bellow:
{
"quote": "\"BAACAIEAAAAAAAAAk5pyM/ecTKmUCg2zlX8GB6P8pz1eLkNLuYzlFq7gmQ4AAAAABAAGAAAAAAAAAAAAAAAAAEj6aZSdsIAC7oQlKEf1cpiLHW5WjsE1P2TLbA/ZBTdfaa2VnA6vd0escKOSeJMCoQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAADnAgYAAAAAAKSgAzRsWhmm/SUEcehyvQcdjJLXQxq9pGNBeAihc4OqDUKYeBS8kvX1nGBEtnf1FAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAO8sw2a5sIgf6+MgszlJcgpq4sP0tqpfKTspZny2PWPOYiJbt1aPe1rpeqDtoa+NreW8yD5Jj8ypKTGA+WfwPH77+negDf9ZWNeonsxRtNtsLoUabMeutZ+xSCbs5gUWwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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