-
Notifications
You must be signed in to change notification settings - Fork 6
Delete instance.go #89
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
Conversation
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.
Just a few tiny nits/suggestions.
cmd/gcp/main.go
Outdated
signer, err := NewSecretManagerSigner(ctx, *signerPublicKeySecretName, *signerPrivateKeySecretName) | ||
if err != nil { | ||
klog.Exitf("Can't create secret manager signer: %v", err) | ||
} | ||
cpSigner, err := sctfe.NewCpSigner(signer, *origin, timeSource) | ||
if err != nil { | ||
klog.Exitf("failed to create checkpoint Signer: %v", err) |
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.
Nit: "Failed..."
cmd/gcp/main.go
Outdated
|
||
storage, err := newGCPStorage(ctx, cpSigner) | ||
if err != nil { | ||
klog.Exitf("failed to initiate storage backend: %v", err) |
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.
nit: "Failed...
cmd/gcp/main.go
Outdated
Validated: vCfg, | ||
Deadline: *httpDeadline, | ||
MetricFactory: prometheus.MetricFactory{}, | ||
RequestLog: new(sctfe.DefaultRequestLog), |
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.
nit: match style for MetricFactory
:
RequestLog: new(sctfe.DefaultRequestLog), | |
RequestLog: &sctfe.DefaultRequestLog{}, |
config.go
Outdated
|
||
// Validate signer that only ECDSA is supported. | ||
// TODO(phboneff): if this is a library this should also allow RSA as per RFC6962. |
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.
Devil's avocado: if it supports ECDSA then that's enough to build RFC6962-compliant logs; there's no requirement to support RSA (or, would we recommend anyone to use RSA for a new log, these days?)
config.go
Outdated
if rejectExtensions != "" { | ||
lRejectExtensions = strings.Split(rejectExtensions, ",") | ||
if rejectExpired && rejectUnexpired { | ||
return nil, errors.New("rejecting all certificates") |
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.
return nil, errors.New("rejecting all certificates") | |
return nil, errors.New("configuration would reject all certificates") |
config.go
Outdated
Signer: signer, | ||
// Validate the time interval. | ||
if notAfterStart != nil && notAfterLimit != nil && (notAfterLimit).Before(*notAfterStart) { | ||
return nil, errors.New("limit before start") |
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.
nit: worth doing fmt.Errorf
with the dates in?
config.go
Outdated
Signer: signer, | ||
// Validate the time interval. | ||
if notAfterStart != nil && notAfterLimit != nil && (notAfterLimit).Before(*notAfterStart) { | ||
return nil, fmt.Errorf("not_after limit %q before start %q", notAfterLimit.Format(time.RFC3339), notAfterStart.Format(time.RFC3339)) |
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.
return nil, fmt.Errorf("not_after limit %q before start %q", notAfterLimit.Format(time.RFC3339), notAfterStart.Format(time.RFC3339)) | |
return nil, fmt.Errorf("not_after_limit %q before not_after_start %q", notAfterLimit.Format(time.RFC3339), notAfterStart.Format(time.RFC3339)) |
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.
I had done this on purpose to allow for shorter messages, and not to mention the flag there since they belong in main.go. As a compromise to address your comment, I changed "not_after" to "'Not After'", thus matching the common name of this field on certificates.
Towards #5
This PR reorganizes the SCTFE code. It deletes
instance.go
, and migrate its content into:main.go
for everything related to setting up the log. Later PR will move some of this into the sctfe library.config.go
for everything related to CT log server logic.handlers.go
for everything related to http serving.It's a stepping stone, more simplifications are to come afterwards (private/public objets and libraries, file renamed, better structures, etc.). To start with, my goal is to architecture the code around three building blocks: