Skip to content

Commit e9b99ba

Browse files
authored
Merge branch 'main' into multiplat
2 parents 09027e8 + 895961d commit e9b99ba

File tree

26 files changed

+249
-859
lines changed

26 files changed

+249
-859
lines changed

cmd/admin/cert.go

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import (
1414
"sync/atomic"
1515
"unicode"
1616

17-
"golang.org/x/crypto/ocsp"
18-
1917
core "github.com/letsencrypt/boulder/core"
2018
berrors "github.com/letsencrypt/boulder/errors"
2119
rapb "github.com/letsencrypt/boulder/ra/proto"
@@ -76,24 +74,18 @@ func (s *subcommandRevokeCert) Run(ctx context.Context, a *admin) error {
7674
return fmt.Errorf("got unacceptable parallelism %d", s.parallelism)
7775
}
7876

79-
reasonCode := revocation.Reason(-1)
80-
for code := range revocation.AdminAllowedReasons {
81-
if s.reasonStr == revocation.ReasonToString[code] {
82-
reasonCode = code
83-
break
84-
}
85-
}
86-
if reasonCode == revocation.Reason(-1) {
87-
return fmt.Errorf("got unacceptable revocation reason %q", s.reasonStr)
77+
reasonCode, err := revocation.StringToReason(s.reasonStr)
78+
if err != nil {
79+
return fmt.Errorf("looking up revocation reason: %w", err)
8880
}
8981

90-
if s.skipBlock && reasonCode == ocsp.KeyCompromise {
82+
if s.skipBlock && reasonCode == revocation.KeyCompromise {
9183
// We would only add the SPKI hash of the pubkey to the blockedKeys table if
9284
// the revocation reason is keyCompromise.
9385
return errors.New("-skip-block-key only makes sense with -reason=1")
9486
}
9587

96-
if s.malformed && reasonCode == ocsp.KeyCompromise {
88+
if s.malformed && reasonCode == revocation.KeyCompromise {
9789
// This is because we can't extract and block the pubkey if we can't
9890
// parse the certificate.
9991
return errors.New("cannot revoke malformed certs for reason keyCompromise")

cmd/bad-key-revoker/main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99

1010
"github.com/jmhodges/clock"
1111
"github.com/prometheus/client_golang/prometheus"
12-
"golang.org/x/crypto/ocsp"
1312
"google.golang.org/grpc"
1413
"google.golang.org/protobuf/types/known/emptypb"
1514

@@ -20,6 +19,7 @@ import (
2019
bgrpc "github.com/letsencrypt/boulder/grpc"
2120
blog "github.com/letsencrypt/boulder/log"
2221
rapb "github.com/letsencrypt/boulder/ra/proto"
22+
"github.com/letsencrypt/boulder/revocation"
2323
"github.com/letsencrypt/boulder/sa"
2424
)
2525

@@ -190,7 +190,7 @@ func (bkr *badKeyRevoker) revokeCerts(certs []unrevokedCertificate) error {
190190
_, err := bkr.raClient.AdministrativelyRevokeCertificate(context.Background(), &rapb.AdministrativelyRevokeCertificateRequest{
191191
Cert: cert.DER,
192192
Serial: cert.Serial,
193-
Code: int64(ocsp.KeyCompromise),
193+
Code: int64(revocation.KeyCompromise),
194194
AdminName: "bad-key-revoker",
195195
})
196196
if err != nil {

cmd/ceremony/README.md

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ ceremony --config path/to/config.yml
1313
- `cross-csr`: creates a CSR for signing by a third party, outputting a PEM CSR.
1414
- `cross-certificate`: issues a certificate for one root, signed by another root. This is distinct from an intermediate because there is no path length constraint and there are no EKUs.
1515
- `key`: generates a signing key on HSM, outputting a PEM public key
16-
- `ocsp-response`: creates a OCSP response for the provided certificate and signs it using a signing key already on a HSM, outputting a base64 encoded response
1716
- `crl`: creates a CRL with the IDP extension and `onlyContainsCACerts = true` from the provided profile and signs it using a signing key already on a HSM, outputting a PEM CRL
1817

1918
These modes are set in the `ceremony-type` field of the configuration file.
@@ -128,7 +127,6 @@ certificate-profile:
128127
country: US
129128
not-before: 2020-01-01 12:00:00
130129
not-after: 2040-01-01 12:00:00
131-
ocsp-url: http://good-guys.com/ocsp
132130
crl-url: http://good-guys.com/crl
133131
issuer-url: http://good-guys.com/root
134132
policies:
@@ -193,7 +191,6 @@ certificate-profile:
193191
country: US
194192
not-before: 2020-01-01 12:00:00
195193
not-after: 2040-01-01 12:00:00
196-
ocsp-url: http://good-guys.com/ocsp
197194
crl-url: http://good-guys.com/crl
198195
issuer-url: http://good-guys.com/root
199196
policies:
@@ -296,61 +293,6 @@ outputs:
296293

297294
This config generates an ECDSA P-384 key in the HSM with the object label `intermediate signing key`. The public key is written to `/home/user/intermediate-signing-pub.pem`.
298295

299-
### OCSP Response ceremony
300-
301-
- `ceremony-type`: string describing the ceremony type, `ocsp-response`.
302-
- `pkcs11`: object containing PKCS#11 related fields.
303-
304-
| Field | Description |
305-
| --- | --- |
306-
| `module` | Path to the PKCS#11 module to use to communicate with a HSM. |
307-
| `pin` | Specifies the login PIN, should only be provided if the HSM device requires one to interact with the slot. |
308-
| `signing-key-slot` | Specifies which HSM object slot the signing key is in. |
309-
| `signing-key-label` | Specifies the HSM object label for the signing keypair's public key. |
310-
311-
- `inputs`: object containing paths for inputs
312-
313-
| Field | Description |
314-
| --- | --- |
315-
| `certificate-path` | Path to PEM certificate to create a response for. |
316-
| `issuer-certificate-path` | Path to PEM issuer certificate. |
317-
| `delegated-issuer-certificate-path` | Path to PEM delegated issuer certificate, if one is being used. |
318-
319-
- `outputs`: object containing paths to write outputs.
320-
321-
| Field | Description |
322-
| --- | --- |
323-
| `response-path` | Path to store signed base64 encoded response. |
324-
325-
- `ocsp-profile`: object containing profile for the OCSP response.
326-
327-
| Field | Description |
328-
| --- | --- |
329-
| `this-update` | Specifies the OCSP response thisUpdate date, in the format `2006-01-02 15:04:05`. The time will be interpreted as UTC. |
330-
| `next-update` | Specifies the OCSP response nextUpdate date, in the format `2006-01-02 15:04:05`. The time will be interpreted as UTC. |
331-
| `status` | Specifies the OCSP response status, either `good` or `revoked`. |
332-
333-
Example:
334-
335-
```yaml
336-
ceremony-type: ocsp-response
337-
pkcs11:
338-
module: /usr/lib/opensc-pkcs11.so
339-
signing-key-slot: 0
340-
signing-key-label: root signing key
341-
inputs:
342-
certificate-path: /home/user/certificate.pem
343-
issuer-certificate-path: /home/user/root-cert.pem
344-
outputs:
345-
response-path: /home/user/ocsp-resp.b64
346-
ocsp-profile:
347-
this-update: 2020-01-01 12:00:00
348-
next-update: 2021-01-01 12:00:00
349-
status: good
350-
```
351-
352-
This config generates a OCSP response signed by a key in the HSM, identified by the object label `root signing key` and object ID `ffff`. The response will be for the certificate in `/home/user/certificate.pem`, and will be written to `/home/user/ocsp-resp.b64`.
353-
354296
### CRL ceremony
355297

356298
- `ceremony-type`: string describing the ceremony type, `crl`.
@@ -419,7 +361,6 @@ The certificate profile defines a restricted set of fields that are used to gene
419361
| `country` | Specifies the subject country |
420362
| `not-before` | Specifies the certificate notBefore date, in the format `2006-01-02 15:04:05`. The time will be interpreted as UTC. |
421363
| `not-after` | Specifies the certificate notAfter date, in the format `2006-01-02 15:04:05`. The time will be interpreted as UTC. |
422-
| `ocsp-url` | Specifies the AIA OCSP responder URL |
423364
| `crl-url` | Specifies the cRLDistributionPoints URL |
424365
| `issuer-url` | Specifies the AIA caIssuer URL |
425366
| `policies` | Specifies contents of a certificatePolicies extension. Should contain a list of policies with the field `oid`, indicating the policy OID. |

cmd/ceremony/cert.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,6 @@ type certProfile struct {
4141
// always be UTC.
4242
NotAfter string `yaml:"not-after"`
4343

44-
// OCSPURL should contain the URL at which a OCSP responder that
45-
// can respond to OCSP requests for this certificate operates
46-
OCSPURL string `yaml:"ocsp-url"`
4744
// CRLURL should contain the URL at which CRLs for this certificate
4845
// can be found
4946
CRLURL string `yaml:"crl-url"`
@@ -100,9 +97,6 @@ func (profile *certProfile) verifyProfile(ct certType) error {
10097
if profile.SignatureAlgorithm != "" {
10198
return errors.New("signature-algorithm cannot be set for a CSR")
10299
}
103-
if profile.OCSPURL != "" {
104-
return errors.New("ocsp-url cannot be set for a CSR")
105-
}
106100
if profile.CRLURL != "" {
107101
return errors.New("crl-url cannot be set for a CSR")
108102
}
@@ -205,10 +199,6 @@ func makeTemplate(randReader io.Reader, profile *certProfile, pubKey []byte, tbc
205199
return nil, fmt.Errorf("toBeCrossSigned cert field was nil, but was required to gather EKUs for the lint cert")
206200
}
207201

208-
var ocspServer []string
209-
if profile.OCSPURL != "" {
210-
ocspServer = []string{profile.OCSPURL}
211-
}
212202
var crlDistributionPoints []string
213203
if profile.CRLURL != "" {
214204
crlDistributionPoints = []string{profile.CRLURL}
@@ -246,7 +236,6 @@ func makeTemplate(randReader io.Reader, profile *certProfile, pubKey []byte, tbc
246236
BasicConstraintsValid: true,
247237
IsCA: true,
248238
Subject: profile.Subject(),
249-
OCSPServer: ocspServer,
250239
CRLDistributionPoints: crlDistributionPoints,
251240
IssuingCertificateURL: issuingCertificateURL,
252241
KeyUsage: ku,

cmd/ceremony/cert_test.go

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ func TestMakeTemplateRoot(t *testing.T) {
109109
profile.CommonName = "common name"
110110
profile.Organization = "organization"
111111
profile.Country = "country"
112-
profile.OCSPURL = "ocsp"
113112
profile.CRLURL = "crl"
114113
profile.IssuerURL = "issuer"
115114
cert, err := makeTemplate(randReader, profile, pubKey, nil, rootCert)
@@ -119,8 +118,6 @@ func TestMakeTemplateRoot(t *testing.T) {
119118
test.AssertEquals(t, cert.Subject.Organization[0], profile.Organization)
120119
test.AssertEquals(t, len(cert.Subject.Country), 1)
121120
test.AssertEquals(t, cert.Subject.Country[0], profile.Country)
122-
test.AssertEquals(t, len(cert.OCSPServer), 1)
123-
test.AssertEquals(t, cert.OCSPServer[0], profile.OCSPURL)
124121
test.AssertEquals(t, len(cert.CRLDistributionPoints), 1)
125122
test.AssertEquals(t, cert.CRLDistributionPoints[0], profile.CRLURL)
126123
test.AssertEquals(t, len(cert.IssuingCertificateURL), 1)
@@ -147,7 +144,6 @@ func TestMakeTemplateRestrictedCrossCertificate(t *testing.T) {
147144
Organization: "organization",
148145
Country: "country",
149146
KeyUsages: []string{"Digital Signature", "CRL Sign"},
150-
OCSPURL: "ocsp",
151147
CRLURL: "crl",
152148
IssuerURL: "issuer",
153149
NotAfter: "2020-10-10 11:31:00",
@@ -237,7 +233,6 @@ func TestVerifyProfile(t *testing.T) {
237233
CommonName: "d",
238234
Organization: "e",
239235
Country: "f",
240-
OCSPURL: "g",
241236
},
242237
certType: []certType{intermediateCert, crossCert},
243238
expectedErr: "crl-url is required for subordinate CAs",
@@ -250,7 +245,6 @@ func TestVerifyProfile(t *testing.T) {
250245
CommonName: "d",
251246
Organization: "e",
252247
Country: "f",
253-
OCSPURL: "g",
254248
CRLURL: "h",
255249
},
256250
certType: []certType{intermediateCert, crossCert},
@@ -264,7 +258,6 @@ func TestVerifyProfile(t *testing.T) {
264258
CommonName: "d",
265259
Organization: "e",
266260
Country: "f",
267-
OCSPURL: "g",
268261
CRLURL: "h",
269262
IssuerURL: "i",
270263
},
@@ -279,7 +272,6 @@ func TestVerifyProfile(t *testing.T) {
279272
CommonName: "d",
280273
Organization: "e",
281274
Country: "f",
282-
OCSPURL: "g",
283275
CRLURL: "h",
284276
IssuerURL: "i",
285277
Policies: []policyInfoConfig{{OID: "1.2.3"}, {OID: "4.5.6"}},
@@ -319,13 +311,6 @@ func TestVerifyProfile(t *testing.T) {
319311
certType: []certType{requestCert},
320312
expectedErr: "signature-algorithm cannot be set for a CSR",
321313
},
322-
{
323-
profile: certProfile{
324-
OCSPURL: "a",
325-
},
326-
certType: []certType{requestCert},
327-
expectedErr: "ocsp-url cannot be set for a CSR",
328-
},
329314
{
330315
profile: certProfile{
331316
CRLURL: "a",

0 commit comments

Comments
 (0)