Use TDX device to mark node as initialized (#1426)

Signed-off-by: Daniel Weiße <dw@edgeless.systems>
This commit is contained in:
Daniel Weiße 2023-03-14 14:17:36 +01:00 committed by Malte Poll
parent 9e987778e0
commit bda999d54e
3 changed files with 46 additions and 37 deletions

View file

@ -9,6 +9,7 @@ package main
import (
"context"
"flag"
"io"
"net"
"os"
"path/filepath"
@ -18,6 +19,7 @@ import (
"github.com/edgelesssys/constellation/v2/disk-mapper/internal/rejoinclient"
"github.com/edgelesssys/constellation/v2/disk-mapper/internal/setup"
"github.com/edgelesssys/constellation/v2/internal/attestation/choose"
"github.com/edgelesssys/constellation/v2/internal/attestation/tdx"
"github.com/edgelesssys/constellation/v2/internal/attestation/vtpm"
awscloud "github.com/edgelesssys/constellation/v2/internal/cloud/aws"
azurecloud "github.com/edgelesssys/constellation/v2/internal/cloud/azure"
@ -123,6 +125,13 @@ func main() {
}
defer mapper.Close()
// Use TDX if available
openDevice := vtpm.OpenVTPM
if attestVariant.OID().Equal(oid.QEMUTDX{}.OID()) {
openDevice = func() (io.ReadWriteCloser, error) {
return tdx.Open()
}
}
setupManger := setup.New(
log.Named("setupManager"),
*csp,
@ -130,7 +139,7 @@ func main() {
afero.Afero{Fs: afero.NewOsFs()},
mapper,
setup.DiskMounter{},
vtpm.OpenVTPM,
openDevice,
)
if err := setupManger.LogDevices(); err != nil {