mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-06-01 12:34:27 -04:00
monorepo
Co-authored-by: Malte Poll <mp@edgeless.systems> Co-authored-by: katexochen <katexochen@users.noreply.github.com> Co-authored-by: Daniel Weiße <dw@edgeless.systems> Co-authored-by: Thomas Tendyck <tt@edgeless.systems> Co-authored-by: Benedict Schlueter <bs@edgeless.systems> Co-authored-by: leongross <leon.gross@rub.de> Co-authored-by: Moritz Eckert <m1gh7ym0@gmail.com>
This commit is contained in:
commit
2d8fcd9bf4
362 changed files with 50980 additions and 0 deletions
51
cli/cmd/verify_azure.go
Normal file
51
cli/cmd/verify_azure.go
Normal file
|
@ -0,0 +1,51 @@
|
|||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/edgelesssys/constellation/cli/file"
|
||||
"github.com/edgelesssys/constellation/coordinator/atls"
|
||||
"github.com/edgelesssys/constellation/coordinator/attestation/azure"
|
||||
"github.com/edgelesssys/constellation/internal/config"
|
||||
"github.com/spf13/afero"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
func newVerifyAzureCmd() *cobra.Command {
|
||||
cmd := &cobra.Command{
|
||||
Use: "azure IP PORT",
|
||||
Short: "Verify the confidential properties of your Constellation on Azure.",
|
||||
Long: "Verify the confidential properties of your Constellation on Azure.",
|
||||
Args: cobra.ExactArgs(2),
|
||||
ValidArgsFunction: verifyCompletion,
|
||||
RunE: runVerifyAzure,
|
||||
}
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
||||
func runVerifyAzure(cmd *cobra.Command, args []string) error {
|
||||
fileHandler := file.NewHandler(afero.NewOsFs())
|
||||
devConfigName, err := cmd.Flags().GetString("dev-config")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
config, err := config.FromFile(fileHandler, devConfigName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
validators, err := getAzureValidator(cmd, *config.Provider.GCP.PCRs)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return runVerify(cmd, args, *config.Provider.GCP.PCRs, validators)
|
||||
}
|
||||
|
||||
// getAzureValidator returns an Azure validator.
|
||||
func getAzureValidator(cmd *cobra.Command, pcrs map[uint32][]byte) (atls.Validator, error) {
|
||||
if err := prepareValidator(cmd, pcrs); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return azure.NewValidator(pcrs), nil
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue