Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

verify: verify active manifest at Coordinator #615

Merged
merged 1 commit into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cli/cmd/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func runGenerate(cmd *cobra.Command, args []string) error {
if err != nil {
return fmt.Errorf("failed to marshal manifest: %w", err)
}
if err := os.WriteFile(flags.manifestPath, manifestData, 0o644); err != nil {
if err := os.WriteFile(flags.manifestPath, append(manifestData, '\n'), 0o644); err != nil {
return fmt.Errorf("failed to write manifest: %w", err)
}

Expand Down
10 changes: 9 additions & 1 deletion cli/cmd/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
package cmd

import (
"bytes"
"crypto/sha256"
"encoding/json"
"fmt"
Expand Down Expand Up @@ -99,7 +100,7 @@ func runVerify(cmd *cobra.Command, _ []string) error {
}
log.Debug("Got response")

fmt.Fprintln(cmd.OutOrStdout(), "✔️ Successfully verified coordinator")
davidweisse marked this conversation as resolved.
Show resolved Hide resolved
fmt.Fprintln(cmd.OutOrStdout(), "✔️ Successfully verified Coordinator CVM based on reference values from manifest")

filelist := map[string][]byte{
coordRootPEMFilename: resp.RootCA,
Expand All @@ -118,6 +119,13 @@ func runVerify(cmd *cobra.Command, _ []string) error {
}

fmt.Fprintf(cmd.OutOrStdout(), "✔️ Wrote Coordinator configuration and keys to %s\n", filepath.Join(flags.workspaceDir, verifyDir))
davidweisse marked this conversation as resolved.
Show resolved Hide resolved

currentManifest := resp.Manifests[len(resp.Manifests)-1]
if !bytes.Equal(currentManifest, manifestBytes) {
return fmt.Errorf("manifest active at Coordinator does not match expected manifest")
}

fmt.Fprintln(cmd.OutOrStdout(), "✔️ Manifest active at Coordinator matches expected manifest")
fmt.Fprintln(cmd.OutOrStdout(), " Please verify the manifest history and policies")

return nil
Expand Down