mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-02 14:26:23 -04:00
AB#2190 Verification service (#232)
* Add verification service * Update verify command to use new Constellation verification service * Deploy verification service on cluster init * Update pcr-reader to use verification service * Add verification service build workflow Signed-off-by: Daniel Weiße <dw@edgeless.systems> Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
parent
b10b13b173
commit
042f668d20
32 changed files with 1365 additions and 281 deletions
54
verify/cmd/main.go
Normal file
54
verify/cmd/main.go
Normal file
|
@ -0,0 +1,54 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"net"
|
||||
"strconv"
|
||||
|
||||
"github.com/edgelesssys/constellation/internal/attestation/azure"
|
||||
"github.com/edgelesssys/constellation/internal/attestation/gcp"
|
||||
"github.com/edgelesssys/constellation/internal/attestation/qemu"
|
||||
"github.com/edgelesssys/constellation/internal/constants"
|
||||
"github.com/edgelesssys/constellation/internal/logger"
|
||||
"github.com/edgelesssys/constellation/verify/server"
|
||||
"go.uber.org/zap"
|
||||
"go.uber.org/zap/zapcore"
|
||||
)
|
||||
|
||||
func main() {
|
||||
provider := flag.String("cloud-provider", "", "cloud service provider this binary is running on")
|
||||
flag.Parse()
|
||||
|
||||
log := logger.New(logger.JSONLog, zapcore.InfoLevel)
|
||||
|
||||
log.With(zap.String("version", constants.VersionInfo), zap.String("cloudProvider", *provider)).
|
||||
Infof("Constellation Verification Service")
|
||||
|
||||
var issuer server.AttestationIssuer
|
||||
switch *provider {
|
||||
case "gcp":
|
||||
issuer = gcp.NewIssuer()
|
||||
case "azure":
|
||||
issuer = azure.NewIssuer()
|
||||
case "qemu":
|
||||
issuer = qemu.NewIssuer()
|
||||
default:
|
||||
log.With(zap.String("cloudProvider", *provider)).Fatalf("Unknown cloud provider")
|
||||
}
|
||||
|
||||
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")
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue