-
-
Notifications
You must be signed in to change notification settings - Fork 636
add boulder-mtca service #8776
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
Merged
+582
−2
Merged
add boulder-mtca service #8776
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| package notmain | ||
|
|
||
| import ( | ||
| "context" | ||
| "flag" | ||
| "os" | ||
|
|
||
| "github.com/jmhodges/clock" | ||
|
|
||
| "github.com/letsencrypt/boulder/cmd" | ||
| bgrpc "github.com/letsencrypt/boulder/grpc" | ||
| "github.com/letsencrypt/boulder/issuance" | ||
| mtca "github.com/letsencrypt/boulder/mtca" | ||
| mtcapb "github.com/letsencrypt/boulder/mtca/proto" | ||
| ) | ||
|
|
||
| type Config struct { | ||
| MTCA struct { | ||
| cmd.ServiceConfig | ||
|
|
||
| GRPCMTCA *cmd.GRPCServerConfig | ||
|
|
||
| // Issuer holds the configuration for a single MTCA instance with a single mtcaID. | ||
| // We run a separate process for each issuer. | ||
| // TODO: the issuance package parses the CA certificate as a self-signed X.509 | ||
| // certificate, but per MTC draft, a CA SHOULD be represented by an RFC 9925 | ||
| // unsigned certificate: https://www.rfc-editor.org/rfc/rfc9925.html. | ||
| Issuer issuance.IssuerConfig | ||
| } | ||
|
|
||
| Syslog cmd.SyslogConfig | ||
| OpenTelemetry cmd.OpenTelemetryConfig | ||
| } | ||
|
|
||
| func main() { | ||
| grpcAddr := flag.String("addr", "", "gRPC listen address override") | ||
| debugAddr := flag.String("debug-addr", "", "Debug server address override") | ||
| configFile := flag.String("config", "", "File path to the configuration file for this service") | ||
| flag.Parse() | ||
| if *configFile == "" { | ||
| flag.Usage() | ||
| os.Exit(1) | ||
| } | ||
|
|
||
| var c Config | ||
| err := cmd.ReadConfigFile(*configFile, &c) | ||
| cmd.FailOnError(err, "Reading JSON config file into config structure") | ||
|
|
||
| if *grpcAddr != "" { | ||
| c.MTCA.GRPCMTCA.Address = *grpcAddr | ||
| } | ||
| if *debugAddr != "" { | ||
| c.MTCA.DebugAddr = *debugAddr | ||
| } | ||
|
|
||
| scope, logger, oTelShutdown := cmd.StatsAndLogging(c.Syslog, c.OpenTelemetry, c.MTCA.DebugAddr) | ||
| defer oTelShutdown(context.Background()) | ||
| cmd.LogStartup(logger) | ||
|
|
||
| tlsConfig, err := c.MTCA.TLS.Load(scope) | ||
| cmd.FailOnError(err, "Loading TLS config") | ||
|
|
||
| clk := clock.New() | ||
|
|
||
| issuer, err := issuance.LoadIssuer(c.MTCA.Issuer, clk) | ||
| cmd.FailOnError(err, "Loading issuer") | ||
|
|
||
| mtcaImpl := mtca.New(issuer) | ||
|
|
||
| srv := bgrpc.NewServer(c.MTCA.GRPCMTCA, logger).Add( | ||
| &mtcapb.MTCA_ServiceDesc, mtcaImpl) | ||
|
|
||
| start, err := srv.Build(tlsConfig, scope, clk) | ||
| cmd.FailOnError(err, "Unable to setup MTCA gRPC server") | ||
|
|
||
| cmd.FailOnError(start(), "MTCA gRPC service failed") | ||
| } | ||
|
|
||
| func init() { | ||
| cmd.RegisterCommand("boulder-mtca", main, &cmd.ConfigValidator{Config: &Config{}}) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| package mtca | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
|
|
||
| "github.com/letsencrypt/boulder/issuance" | ||
| mtcapb "github.com/letsencrypt/boulder/mtca/proto" | ||
| ) | ||
|
|
||
| var _ mtcapb.MTCAServer = &mtca{} | ||
|
|
||
| func New(issuer *issuance.Issuer) *mtca { | ||
| return &mtca{ | ||
| issuer: issuer, | ||
| } | ||
| } | ||
|
|
||
| type mtca struct { | ||
| mtcapb.UnimplementedMTCAServer | ||
| issuer *issuance.Issuer | ||
| } | ||
|
|
||
| func (m *mtca) Issue(ctx context.Context, req *mtcapb.IssueRequest) (*mtcapb.IssueResponse, error) { | ||
| return nil, fmt.Errorf("not implemented") | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| syntax = "proto3"; | ||
|
|
||
| package mtca; | ||
| option go_package = "github.com/letsencrypt/boulder/mtca/proto"; | ||
|
|
||
| import "core/proto/core.proto"; | ||
|
|
||
| // MTCA issues MTC certificates. | ||
| service MTCA { | ||
| // Issue requests that the CA start the process of creating a standalone certificate | ||
| // for the given request. It returns once a checkpoint has been signed that includes | ||
| // that certificate's TBSCertificateLogEntry, but does not wait for cosignatures. | ||
| rpc Issue(IssueRequest) returns (IssueResponse) {} | ||
| } | ||
|
|
||
| message IssueRequest { | ||
| // Next unused field number: 4 | ||
| bytes pubkey = 1; | ||
| repeated core.Identifier identifiers = 2; | ||
| string profile = 3; | ||
| } | ||
|
aarongable marked this conversation as resolved.
|
||
|
|
||
| message IssueResponse { | ||
| // Next unused field number: 4 | ||
| string mtcLogID = 1; | ||
| int64 mtcEntryIndex = 2; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"ATM machine"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is the future to which we are doomed. MT certificates feels wrong; "issues MTCs" is also ugly IMO. I think the path is to just make peace with saying ATM machine for the rest of our lives.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, "issues MTCs" doesn't sound bad to me personally. I'd also be fine with it just saying "issues Merkle Tree Certificates", given that this is sorta the entry-point into documentation for this package.
But also none of this matters, the point of language is to communicate and the current version is clear.