mirror of
https://github.com/edgelesssys/constellation.git
synced 2024-10-01 01:36:09 -04:00
8f21972aec
* variant: move into internal/attestation * attesation: move aws attesation into subfolder nitrotpm * config: add aws-sev-snp variant * cli: add tf option to enable AWS SNP For now the implementations in aws/nitrotpm and aws/snp are identical. They both contain the aws/nitrotpm impl. A separate commit will add the actual attestation logic.
57 lines
1.8 KiB
Go
57 lines
1.8 KiB
Go
/*
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
package main
|
|
|
|
import (
|
|
"flag"
|
|
"net"
|
|
"strconv"
|
|
|
|
"github.com/edgelesssys/constellation/v2/internal/attestation/choose"
|
|
"github.com/edgelesssys/constellation/v2/internal/attestation/variant"
|
|
"github.com/edgelesssys/constellation/v2/internal/constants"
|
|
"github.com/edgelesssys/constellation/v2/internal/logger"
|
|
"github.com/edgelesssys/constellation/v2/verify/server"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func main() {
|
|
attestationVariant := flag.String("attestation-variant", "", "attestation variant to use for aTLS connections")
|
|
verbosity := flag.Int("v", 0, logger.CmdLineVerbosityDescription)
|
|
|
|
flag.Parse()
|
|
log := logger.New(logger.JSONLog, logger.VerbosityFromInt(*verbosity))
|
|
|
|
log.With(zap.String("version", constants.VersionInfo()), zap.String("attestationVariant", *attestationVariant)).
|
|
Infof("Constellation Verification Service")
|
|
|
|
variant, err := variant.FromString(*attestationVariant)
|
|
if err != nil {
|
|
log.With(zap.Error(err)).Fatalf("Failed to parse attestation variant")
|
|
}
|
|
issuer, err := choose.Issuer(variant, log.Named("issuer"))
|
|
if err != nil {
|
|
log.With(zap.Error(err)).Fatalf("Failed to create issuer")
|
|
}
|
|
|
|
server := server.New(log.Named("server"), issuer)
|
|
httpListener, err := net.Listen("tcp", net.JoinHostPort("", strconv.Itoa(constants.VerifyServicePortHTTP)))
|
|
if err != nil {
|
|
log.With(zap.Error(err), zap.Int("port", constants.VerifyServicePortHTTP)).
|
|
Fatalf("Failed to listen")
|
|
}
|
|
grpcListener, err := net.Listen("tcp", net.JoinHostPort("", strconv.Itoa(constants.VerifyServicePortGRPC)))
|
|
if err != nil {
|
|
log.With(zap.Error(err), zap.Int("port", constants.VerifyServicePortGRPC)).
|
|
Fatalf("Failed to listen")
|
|
}
|
|
|
|
if err := server.Run(httpListener, grpcListener); err != nil {
|
|
log.With(zap.Error(err)).Fatalf("Failed to run server")
|
|
}
|
|
}
|