mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-12-28 17:09:30 -05:00
5a0234b3f2
* Convert enforceIDKeyDigest setting to enum * Use MAA fallback in Azure SNP attestation * Only create MAA provider if MAA fallback is enabled --------- Signed-off-by: Daniel Weiße <dw@edgeless.systems> Co-authored-by: Thomas Tendyck <tt@edgeless.systems>
36 lines
599 B
Go
36 lines
599 B
Go
/*
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
package snp
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/edgelesssys/constellation/v2/internal/cloud/azure"
|
|
)
|
|
|
|
const tagMAAURL = "constellation-maa-url"
|
|
|
|
type imdsClient struct {
|
|
imdsClient *azure.IMDSClient
|
|
}
|
|
|
|
func newIMDSClient() *imdsClient {
|
|
return &imdsClient{
|
|
imdsClient: azure.NewIMDSClient(),
|
|
}
|
|
}
|
|
|
|
func (c *imdsClient) getMAAURL(ctx context.Context) (string, error) {
|
|
tags, err := c.imdsClient.Tags(ctx)
|
|
if err != nil {
|
|
return "", fmt.Errorf("getting tags: %w", err)
|
|
}
|
|
|
|
return tags[tagMAAURL], nil
|
|
}
|