Skip to content

Commit 895961d

Browse files
authored
issuance: Remove last vestiges of OCSP support (#8398)
The AIA OCSP URI is always omitted, and therefore the CRLDistributionPoint URL is always included. This implicitly drops support for "temporal sharding" (mapping certs to CRLs by their notAfter, rather than by their baked-in CRLDP) but that had in fact already become unsupported when OmitOCSP was made non-functional. Fixes #8177
1 parent 53f82ec commit 895961d

File tree

5 files changed

+26
-33
lines changed

5 files changed

+26
-33
lines changed

crl/checker/checker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ func TestDiff(t *testing.T) {
6161
CertFile: "../../test/hierarchy/int-e1.cert.pem",
6262
},
6363
IssuerURL: "http://not-example.com/issuer-url",
64-
OCSPURL: "http://not-example.com/ocsp",
6564
CRLURLBase: "http://not-example.com/crl/",
65+
CRLShards: 1,
6666
}, clock.NewFake())
6767
test.AssertNotError(t, err, "loading test issuer")
6868

crl/storer/storer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ func setupTestUploadCRL(t *testing.T) (*crlStorer, *issuance.Issuer) {
6262
CertFile: "../../test/hierarchy/int-e1.cert.pem",
6363
},
6464
IssuerURL: "http://not-example.com/issuer-url",
65-
OCSPURL: "http://not-example.com/ocsp",
6665
CRLURLBase: "http://not-example.com/crl/",
66+
CRLShards: 1,
6767
}, clock.NewFake())
6868
test.AssertNotError(t, err, "loading fake ECDSA issuer cert")
6969

issuance/cert.go

Lines changed: 16 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ type ProfileConfig struct {
5959
OmitOCSP bool
6060
// IncludeCRLDistributionPoints causes the CRLDistributionPoints extension to
6161
// be added to all certificates issued by this profile.
62+
//
63+
// Deprecated: This has no effect; CRLDP is always included.
64+
// TODO(#8177): Remove this.
6265
IncludeCRLDistributionPoints bool
6366

6467
MaxValidityPeriod config.Duration
@@ -84,8 +87,6 @@ type Profile struct {
8487
omitClientAuth bool
8588
omitSKID bool
8689

87-
includeCRLDistributionPoints bool
88-
8990
maxBackdate time.Duration
9091
maxValidity time.Duration
9192

@@ -123,14 +124,13 @@ func NewProfile(profileConfig *ProfileConfig) (*Profile, error) {
123124
}
124125

125126
sp := &Profile{
126-
omitCommonName: profileConfig.OmitCommonName,
127-
omitKeyEncipherment: profileConfig.OmitKeyEncipherment,
128-
omitClientAuth: profileConfig.OmitClientAuth,
129-
omitSKID: profileConfig.OmitSKID,
130-
includeCRLDistributionPoints: profileConfig.IncludeCRLDistributionPoints,
131-
maxBackdate: profileConfig.MaxValidityBackdate.Duration,
132-
maxValidity: profileConfig.MaxValidityPeriod.Duration,
133-
lints: lints,
127+
omitCommonName: profileConfig.OmitCommonName,
128+
omitKeyEncipherment: profileConfig.OmitKeyEncipherment,
129+
omitClientAuth: profileConfig.OmitClientAuth,
130+
omitSKID: profileConfig.OmitSKID,
131+
maxBackdate: profileConfig.MaxValidityBackdate.Duration,
132+
maxValidity: profileConfig.MaxValidityPeriod.Duration,
133+
lints: lints,
134134
}
135135

136136
return sp, nil
@@ -381,18 +381,12 @@ func (i *Issuer) Prepare(prof *Profile, req *IssuanceRequest) ([]byte, *issuance
381381
return nil, nil, errors.New("invalid request contains neither sctList nor precertDER")
382382
}
383383

384-
// If explicit CRL sharding is enabled, pick a shard based on the serial number
385-
// modulus the number of shards. This gives us random distribution that is
386-
// nonetheless consistent between precert and cert.
387-
if prof.includeCRLDistributionPoints {
388-
if i.crlShards <= 0 {
389-
return nil, nil, errors.New("IncludeCRLDistributionPoints was set but CRLShards was not set")
390-
}
391-
shardZeroBased := big.NewInt(0).Mod(template.SerialNumber, big.NewInt(int64(i.crlShards)))
392-
shard := int(shardZeroBased.Int64()) + 1
393-
url := i.crlURL(shard)
394-
template.CRLDistributionPoints = []string{url}
395-
}
384+
// Pick a CRL shard based on the serial number modulo the number of shards.
385+
// This gives us random distribution that is nonetheless consistent between
386+
// precert and cert.
387+
shardZeroBased := big.NewInt(0).Mod(template.SerialNumber, big.NewInt(int64(i.crlShards)))
388+
shard := int(shardZeroBased.Int64()) + 1
389+
template.CRLDistributionPoints = []string{i.crlURL(shard)}
396390

397391
// check that the tbsCertificate is properly formed by signing it
398392
// with a throwaway key and then linting it using zlint

issuance/cert_test.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,8 +321,7 @@ func TestGenerateTemplate(t *testing.T) {
321321
SignatureAlgorithm: x509.SHA256WithRSA,
322322
IssuingCertificateURL: []string{"http://issuer"},
323323
Policies: []x509.OID{domainValidatedOID},
324-
// These fields are only included if specified in the profile.
325-
OCSPServer: nil,
324+
// This field is computed based on the serial, so is not included in the template.
326325
CRLDistributionPoints: nil,
327326
}
328327

@@ -488,7 +487,6 @@ func TestIssueWithCRLDP(t *testing.T) {
488487
t.Fatalf("ecdsa.GenerateKey: %s", err)
489488
}
490489
profile := defaultProfile()
491-
profile.includeCRLDistributionPoints = true
492490
_, issuanceToken, err := signer.Prepare(profile, &IssuanceRequest{
493491
PublicKey: MarshalablePublicKey{pk.Public()},
494492
SubjectKeyId: goodSKID,

issuance/issuer.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ func LoadChain(certFiles []string) ([]*Certificate, error) {
142142
type IssuerConfig struct {
143143
// Active determines if the issuer can be used to sign precertificates. All
144144
// issuers, regardless of this field, can be used to sign final certificates
145-
// (for which an issuance token is presented), OCSP responses, and CRLs.
145+
// (for which an issuance token is presented) and CRLs.
146146
// All Active issuers of a given key type (RSA or ECDSA) are part of a pool
147147
// and each precertificate will be issued randomly from a selected pool.
148148
// The selection of which pool depends on the precertificate's key algorithm.
@@ -154,10 +154,8 @@ type IssuerConfig struct {
154154
// TODO(#8177): Remove this.
155155
OCSPURL string `validate:"omitempty,url"`
156156

157-
// Number of CRL shards.
158-
// This must be nonzero if adding CRLDistributionPoints to certificates
159-
// (that is, if profile.IncludeCRLDistributionPoints is true).
160-
CRLShards int
157+
// Number of CRL shards. Must be positive, but can be 1 for no sharding.
158+
CRLShards int `validate:"required,min=1"`
161159

162160
Location IssuerLoc
163161
}
@@ -239,6 +237,9 @@ func newIssuer(config IssuerConfig, cert *Certificate, signer crypto.Signer, clk
239237
if !strings.HasSuffix(config.CRLURLBase, "/") {
240238
return nil, fmt.Errorf("crlURLBase must end with exactly one forward slash, got %q", config.CRLURLBase)
241239
}
240+
if config.CRLShards <= 0 {
241+
return nil, errors.New("Number of CRL shards is required")
242+
}
242243

243244
// We require that all of our issuers be capable of both issuing certs and
244245
// providing revocation information.
@@ -280,7 +281,7 @@ func (i *Issuer) KeyType() x509.PublicKeyAlgorithm {
280281
}
281282

282283
// IsActive is true if the issuer is willing to issue precertificates, and false
283-
// if the issuer is only willing to issue final certificates, OCSP, and CRLs.
284+
// if the issuer is only willing to issue final certificates and CRLs.
284285
func (i *Issuer) IsActive() bool {
285286
return i.active
286287
}

0 commit comments

Comments
 (0)