-
-
Notifications
You must be signed in to change notification settings - Fork 635
Replace CA-enforcement for MaxNames with Custom Lint #8739
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
base: main
Are you sure you want to change the base?
Changes from all commits
11027e3
7b01c25
156cf35
af0bac4
a3939d5
1286866
1d98fd0
e1d1858
b09b0f9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -67,13 +67,6 @@ type Config struct { | |
| // TODO(#7213): Replace `required_without` with `required` when SerialPrefix is removed. | ||
| SerialPrefixHex string `validate:"required_without=SerialPrefix,omitempty,hexadecimal,len=2"` | ||
|
|
||
| // MaxNames is the maximum number of subjectAltNames in a single cert. | ||
| // The value supplied MUST be greater than 0 and no more than 100. These | ||
| // limits are per section 7.1 of our combined CP/CPS, under "DV-SSL | ||
| // Subscriber Certificate". The value must match the RA and WFE | ||
| // configurations. | ||
| MaxNames int `validate:"required,min=1,max=100"` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We can't immediately delete this, because it's currently configured in prod. Deploying this change as-is would break, as the CA would refuse to load a config with an unrecognized key. Instead, update the comment to mark the field as deprecated, and update the config validation from "required" to "omitempty". |
||
|
|
||
| // GoodKey is an embedded config stanza for the goodkey library. | ||
| GoodKey goodkey.Config | ||
|
|
||
|
|
@@ -139,10 +132,6 @@ func main() { | |
| serialPrefix = byte(parsedSerialPrefix) | ||
| } | ||
|
|
||
| if c.CA.MaxNames == 0 { | ||
| cmd.Fail("Error in CA config: MaxNames must not be 0") | ||
| } | ||
|
|
||
| scope, logger, oTelShutdown := cmd.StatsAndLogging(c.Syslog, c.OpenTelemetry, c.CA.DebugAddr) | ||
| defer oTelShutdown(context.Background()) | ||
| cmd.LogStartup(logger) | ||
|
|
@@ -244,7 +233,6 @@ func main() { | |
| issuers, | ||
| profiles, | ||
| serialPrefix, | ||
| c.CA.MaxNames, | ||
| kp, | ||
| logger, | ||
| metrics, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| package cpcps | ||
|
|
||
| import ( | ||
| "github.com/zmap/zcrypto/x509" | ||
| "github.com/zmap/zlint/v3/lint" | ||
| "github.com/zmap/zlint/v3/util" | ||
|
|
||
| "github.com/letsencrypt/boulder/linter/lints" | ||
| ) | ||
|
|
||
| type certSubjectAltNamesCountOutOfBounds struct{} | ||
|
|
||
| func init() { | ||
| lint.RegisterCertificateLint(&lint.CertificateLint{ | ||
| LintMetadata: lint.LintMetadata{ | ||
| Name: "e_cert_has_san_count_out_of_bounds", | ||
| Description: "Let's Encrypt Subscriber Certificates subjectAlternativeName must be a sequence of 1 to 100 dNSNames or ipAddresses", | ||
| Citation: "CPS: 7.1", | ||
| Source: lints.LetsEncryptCPS, | ||
| EffectiveDate: lints.CPSV20Date, | ||
| }, | ||
| Lint: CertNamesCountOutOfBounds, | ||
| }) | ||
| } | ||
|
|
||
| func CertNamesCountOutOfBounds() lint.CertificateLintInterface { | ||
| return &certSubjectAltNamesCountOutOfBounds{} | ||
| } | ||
|
|
||
| func (l *certSubjectAltNamesCountOutOfBounds) CheckApplies(c *x509.Certificate) bool { | ||
| return util.IsSubscriberCert(c) | ||
| } | ||
|
|
||
| func (l *certSubjectAltNamesCountOutOfBounds) Execute(c *x509.Certificate) *lint.LintResult { | ||
| totalSANs := len(c.DNSNames) + len(c.IPAddresses) | ||
|
|
||
| // more likely to encounter certs with greater than 100 vs with fewer than 1 | ||
| // so testing that failure first | ||
| if totalSANs > 100 || totalSANs < 1 { | ||
| return &lint.LintResult{Status: lint.Error} | ||
| } | ||
|
|
||
| return &lint.LintResult{Status: lint.Pass} | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -181,7 +181,6 @@ | |
| ] | ||
| }, | ||
| "serialPrefixHex": "6e", | ||
| "maxNames": 100, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't remove this from test/config/ yet, since it's still configured in prod. We'll save that for a follow-up PR, after this initial change has been deployed and the prod configs have been updated. |
||
| "goodkey": {}, | ||
| "ocspLogMaxLength": 4000, | ||
| "ctLogListFile": "test/ct-test-srv/log_list.json", | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.