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

cli: add recover command #634

Merged
merged 2 commits into from
Jun 26, 2024
Merged

cli: add recover command #634

merged 2 commits into from
Jun 26, 2024

Conversation

katexochen
Copy link
Member

@katexochen katexochen commented Jun 26, 2024

This introduces a new command recover that let's you recover the Coordinator state after a restart.

https://docs.edgeless.systems/contrast/architecture/secrets

@katexochen katexochen added the feature Shiny new feature for our users label Jun 26, 2024
Copy link
Contributor

@msanft msanft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have the expertise to review the actual recovery logic itself, so I only took a look at the Go code

cli/cmd/generate.go Outdated Show resolved Hide resolved
cli/cmd/generate.go Show resolved Hide resolved
cli/cmd/set.go Show resolved Hide resolved
@katexochen
Copy link
Member Author

I don't have the expertise to review the actual recovery logic itself, so I only took a look at the Go code

@msanft please take some time to familiarize yourself with the recovery logic.

cli/cmd/generate.go Outdated Show resolved Hide resolved
Comment on lines 408 to 421
var publicKey []byte
switch block.Type {
case "PUBLIC KEY":
publicKey = block.Bytes
case "RSA PRIVATE KEY":
privateKey, err := x509.ParsePKCS1PrivateKey(block.Bytes)
if err != nil {
return fmt.Errorf("parsing RSA private key: %w", err)
}
publicKey = x509.MarshalPKCS1PublicKey(&privateKey.PublicKey)
default:
return fmt.Errorf("unsupported PEM block type: %s", block.Type)
}
manifst.SeedshareOwnerPubKeys = append(manifst.SeedshareOwnerPubKeys, manifest.NewHexString(publicKey))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good if we could use manifest.MarshalSeedShareOwnerKey so that we have a single place where algorithms are chosen.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should follow up and also move the workload owner key stuff into the manifest package.

cli/cmd/generate.go Outdated Show resolved Hide resolved
cli/cmd/generate.go Show resolved Hide resolved
cli/cmd/recover.go Outdated Show resolved Hide resolved
cli/cmd/recover.go Outdated Show resolved Hide resolved
cli/cmd/set.go Outdated Show resolved Hide resolved
cli/cmd/recover.go Outdated Show resolved Hide resolved
@katexochen katexochen force-pushed the p/recoveryapi branch 3 times, most recently from fd25872 to d6b2606 Compare June 26, 2024 10:53
@katexochen katexochen requested a review from burgerdev June 26, 2024 11:13
cli/cmd/recover.go Outdated Show resolved Hide resolved
@davidweisse
Copy link
Contributor

I think we don't need this anymore: recoveryapi.Port.

cli/cmd/recover.go Outdated Show resolved Hide resolved
cli/cmd/set.go Show resolved Hide resolved
@katexochen katexochen merged commit 504564f into main Jun 26, 2024
8 checks passed
@katexochen katexochen deleted the p/recoveryapi branch June 26, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Shiny new feature for our users
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants