mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-18 20:34:35 -05:00
913b09aeb8
* terraform: enable creation of SEV-SNP VMs on GCP * variant: add SEV-SNP attestation variant * config: add SEV-SNP config options for GCP * measurements: add GCP SEV-SNP measurements * gcp: separate package for SEV-ES * attestation: add GCP SEV-SNP attestation logic * gcp: factor out common logic * choose: add GCP SEV-SNP * cli: add TF variable passthrough for GCP SEV-SNP variables * cli: support GCP SEV-SNP for `constellation verify` * Adjust usage of GCP SEV-SNP throughout codebase * ci: add GCP SEV-SNP * terraform-provider: support GCP SEV-SNP * docs: add GCP SEV-SNP reference * linter fixes * gcp: only run test with TPM simulator * gcp: remove nonsense test * Update cli/internal/cmd/verify.go Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com> * Update docs/docs/overview/clouds.md Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com> * Update terraform-provider-constellation/internal/provider/attestation_data_source_test.go Co-authored-by: Adrian Stobbe <stobbe.adrian@gmail.com> * linter fixes * terraform_provider: correctly pass down CC technology * config: mark attestationconfigapi as unimplemented * gcp: fix comments and typos * snp: use nonce and PK hash in SNP report * snp: ensure we never use ARK supplied by Issuer (#3025) * Make sure SNP ARK is always loaded from config, or fetched from AMD KDS * GCP: Set validator `reportData` correctly --------- Signed-off-by: Daniel Weiße <dw@edgeless.systems> Co-authored-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * attestationconfigapi: add GCP to uploading * snp: use correct cert Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> * terraform-provider: enable fetching of attestation config values for GCP SEV-SNP * linter fixes --------- Signed-off-by: Daniel Weiße <dw@edgeless.systems> Signed-off-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com> Co-authored-by: Adrian Stobbe <stobbe.adrian@gmail.com>
111 lines
3.9 KiB
YAML
111 lines
3.9 KiB
YAML
name: Constellation verify
|
|
description: "Verify a Constellation cluster."
|
|
|
|
inputs:
|
|
osImage:
|
|
description: "The OS image used in the cluster."
|
|
required: true
|
|
attestationVariant:
|
|
description: "The attestation variant used in the cluster."
|
|
required: true
|
|
kubeconfig:
|
|
description: "The kubeconfig file for the cluster."
|
|
required: true
|
|
cosignPassword:
|
|
required: true
|
|
description: "The password for the cosign private key."
|
|
cosignPrivateKey:
|
|
required: true
|
|
description: "The cosign private key."
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- name: Expand version path
|
|
id: expand-version
|
|
uses: ./.github/actions/shortname
|
|
with:
|
|
shortname: ${{ inputs.osImage }}
|
|
|
|
- name: Constellation fetch measurements
|
|
shell: bash
|
|
run: |
|
|
if [[ ${{ steps.expand-version.outputs.stream }} == "debug" ]]
|
|
then
|
|
constellation config fetch-measurements --insecure
|
|
else
|
|
constellation config fetch-measurements
|
|
fi
|
|
|
|
- name: Constellation verify
|
|
shell: bash
|
|
run: constellation verify --cluster-id $(yq -r ".clusterValues.clusterID" constellation-state.yaml)
|
|
|
|
- name: Verify all nodes
|
|
shell: bash
|
|
env:
|
|
KUBECONFIG: ${{ inputs.kubeconfig }}
|
|
run: |
|
|
clusterID=$(yq -r ".clusterValues.clusterID" constellation-state.yaml)
|
|
nodes=$(kubectl get nodes -o json | jq -r ".items[].metadata.name")
|
|
|
|
for node in $nodes ; do
|
|
verificationPod=$(kubectl get pods --field-selector spec.nodeName=${node} -n kube-system | grep "verification-service" | cut -d' ' -f1)
|
|
|
|
mapfile -t verificationPod <<< "$verificationPod"
|
|
|
|
if [[ ${#verificationPod[@]} -ne 1 ]]; then
|
|
echo "Expected 1 verification pod for node ${node}, found ${#verificationPodArray[@]}"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Verifying pod ${verificationPod} on node ${node}"
|
|
|
|
kubectl wait -n kube-system "pod/${verificationPod}" --for=condition=ready --timeout=5m
|
|
kubectl port-forward -n kube-system "pods/${verificationPod}" 9090:9090 &
|
|
forwarderPID=$!
|
|
sleep 5
|
|
|
|
if [[ ${{ inputs.attestationVariant }} == "azure-sev-snp" ]] || [[ ${{ inputs.attestationVariant }} == "aws-sev-snp" ]]; then
|
|
echo "Extracting TCB versions for API update"
|
|
constellation verify --cluster-id "${clusterID}" --node-endpoint localhost:9090 -o json > "snp-report-${node}.json"
|
|
else
|
|
constellation verify --cluster-id "${clusterID}" --node-endpoint localhost:9090
|
|
fi
|
|
|
|
kill $forwarderPID
|
|
done
|
|
|
|
- name: Login to AWS
|
|
if: github.ref_name == 'main'
|
|
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
|
|
with:
|
|
role-to-assume: arn:aws:iam::795746500882:role/GitHubConstellationImagePipeline
|
|
aws-region: eu-central-1
|
|
|
|
- name: Upload extracted TCBs
|
|
if: github.ref_name == 'main' && (inputs.attestationVariant == 'azure-sev-snp' || inputs.attestationVariant == 'aws-sev-snp' || inputs.attestationVariant == 'gcp-sev-snp')
|
|
shell: bash
|
|
env:
|
|
COSIGN_PASSWORD: ${{ inputs.cosignPassword }}
|
|
COSIGN_PRIVATE_KEY: ${{ inputs.cosignPrivateKey }}
|
|
run: |
|
|
if [[ ${{ inputs.attestationVariant }} == "aws-sev-snp" ]] && constellation version | grep -q "v2.13."; then
|
|
echo "Skipping TCB upload for AWS on CLI v2.13"
|
|
exit 0
|
|
fi
|
|
|
|
reports=(snp-report-*.json)
|
|
if [ -z ${#reports[@]} ]; then
|
|
exit 1
|
|
fi
|
|
|
|
attestationVariant=${{ inputs.attestationVariant }}
|
|
cloudProvider=${attestationVariant%%-*}
|
|
|
|
for file in "${reports[@]}"; do
|
|
path=$(realpath "${file}")
|
|
cat "${path}"
|
|
bazel run //internal/api/attestationconfigapi/cli -- upload "${cloudProvider}" snp-report "${path}"
|
|
done
|