Skip to content

Commit ea200c2

Browse files
authored
Remove "ocsp-response" Ceremony type (#8396)
Remove the configuration, validation, logic, and tests which support the "ocsp-response" ceremony type. We have not used this ceremony type to produce OCSP responses in many years, and do not anticipate doing so at any time in the foreseeable future. None of our CA certificates contain AIA OCSP URIs, so we could not serve such responses even if we did generate them.
1 parent 3b0e57e commit ea200c2

File tree

5 files changed

+1
-580
lines changed

5 files changed

+1
-580
lines changed

cmd/ceremony/README.md

Lines changed: 0 additions & 56 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.
@@ -296,61 +295,6 @@ outputs:
296295

297296
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`.
298297

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-
354298
### CRL ceremony
355299

356300
- `ceremony-type`: string describing the ceremony type, `crl`.

cmd/ceremony/main.go

Lines changed: 1 addition & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ import (
1818
"slices"
1919
"time"
2020

21-
"golang.org/x/crypto/ocsp"
2221
"gopkg.in/yaml.v3"
2322

2423
zlintx509 "github.com/zmap/zcrypto/x509"
@@ -379,59 +378,6 @@ func (kc keyConfig) validate() error {
379378
return nil
380379
}
381380

382-
type ocspRespConfig struct {
383-
CeremonyType string `yaml:"ceremony-type"`
384-
PKCS11 PKCS11SigningConfig `yaml:"pkcs11"`
385-
Inputs struct {
386-
CertificatePath string `yaml:"certificate-path"`
387-
IssuerCertificatePath string `yaml:"issuer-certificate-path"`
388-
DelegatedIssuerCertificatePath string `yaml:"delegated-issuer-certificate-path"`
389-
} `yaml:"inputs"`
390-
Outputs struct {
391-
ResponsePath string `yaml:"response-path"`
392-
} `yaml:"outputs"`
393-
OCSPProfile struct {
394-
ThisUpdate string `yaml:"this-update"`
395-
NextUpdate string `yaml:"next-update"`
396-
Status string `yaml:"status"`
397-
} `yaml:"ocsp-profile"`
398-
}
399-
400-
func (orc ocspRespConfig) validate() error {
401-
err := orc.PKCS11.validate()
402-
if err != nil {
403-
return err
404-
}
405-
406-
// Input fields
407-
if orc.Inputs.CertificatePath == "" {
408-
return errors.New("inputs.certificate-path is required")
409-
}
410-
if orc.Inputs.IssuerCertificatePath == "" {
411-
return errors.New("inputs.issuer-certificate-path is required")
412-
}
413-
// DelegatedIssuerCertificatePath may be omitted
414-
415-
// Output fields
416-
err = checkOutputFile(orc.Outputs.ResponsePath, "response-path")
417-
if err != nil {
418-
return err
419-
}
420-
421-
// OCSP fields
422-
if orc.OCSPProfile.ThisUpdate == "" {
423-
return errors.New("ocsp-profile.this-update is required")
424-
}
425-
if orc.OCSPProfile.NextUpdate == "" {
426-
return errors.New("ocsp-profile.next-update is required")
427-
}
428-
if orc.OCSPProfile.Status != "good" && orc.OCSPProfile.Status != "revoked" {
429-
return errors.New("ocsp-profile.status must be either \"good\" or \"revoked\"")
430-
}
431-
432-
return nil
433-
}
434-
435381
type crlConfig struct {
436382
CeremonyType string `yaml:"ceremony-type"`
437383
PKCS11 PKCS11SigningConfig `yaml:"pkcs11"`
@@ -879,76 +825,6 @@ func keyCeremony(configBytes []byte) error {
879825
return nil
880826
}
881827

882-
func ocspRespCeremony(configBytes []byte) error {
883-
var config ocspRespConfig
884-
err := strictyaml.Unmarshal(configBytes, &config)
885-
if err != nil {
886-
return fmt.Errorf("failed to parse config: %s", err)
887-
}
888-
err = config.validate()
889-
if err != nil {
890-
return fmt.Errorf("failed to validate config: %s", err)
891-
}
892-
893-
cert, err := loadCert(config.Inputs.CertificatePath)
894-
if err != nil {
895-
return fmt.Errorf("failed to load certificate %q: %s", config.Inputs.CertificatePath, err)
896-
}
897-
issuer, err := loadCert(config.Inputs.IssuerCertificatePath)
898-
if err != nil {
899-
return fmt.Errorf("failed to load issuer certificate %q: %s", config.Inputs.IssuerCertificatePath, err)
900-
}
901-
var signer crypto.Signer
902-
var delegatedIssuer *x509.Certificate
903-
if config.Inputs.DelegatedIssuerCertificatePath != "" {
904-
delegatedIssuer, err = loadCert(config.Inputs.DelegatedIssuerCertificatePath)
905-
if err != nil {
906-
return fmt.Errorf("failed to load delegated issuer certificate %q: %s", config.Inputs.DelegatedIssuerCertificatePath, err)
907-
}
908-
909-
signer, _, err = openSigner(config.PKCS11, delegatedIssuer.PublicKey)
910-
if err != nil {
911-
return err
912-
}
913-
} else {
914-
signer, _, err = openSigner(config.PKCS11, issuer.PublicKey)
915-
if err != nil {
916-
return err
917-
}
918-
}
919-
920-
thisUpdate, err := time.Parse(time.DateTime, config.OCSPProfile.ThisUpdate)
921-
if err != nil {
922-
return fmt.Errorf("unable to parse ocsp-profile.this-update: %s", err)
923-
}
924-
nextUpdate, err := time.Parse(time.DateTime, config.OCSPProfile.NextUpdate)
925-
if err != nil {
926-
return fmt.Errorf("unable to parse ocsp-profile.next-update: %s", err)
927-
}
928-
var status int
929-
switch config.OCSPProfile.Status {
930-
case "good":
931-
status = int(ocsp.Good)
932-
case "revoked":
933-
status = int(ocsp.Revoked)
934-
default:
935-
// this shouldn't happen if the config is validated
936-
return fmt.Errorf("unexpected ocsp-profile.stats: %s", config.OCSPProfile.Status)
937-
}
938-
939-
resp, err := generateOCSPResponse(signer, issuer, delegatedIssuer, cert, thisUpdate, nextUpdate, status)
940-
if err != nil {
941-
return err
942-
}
943-
944-
err = writeFile(config.Outputs.ResponsePath, resp)
945-
if err != nil {
946-
return fmt.Errorf("failed to write OCSP response to %q: %s", config.Outputs.ResponsePath, err)
947-
}
948-
949-
return nil
950-
}
951-
952828
func crlCeremony(configBytes []byte) error {
953829
var config crlConfig
954830
err := strictyaml.Unmarshal(configBytes, &config)
@@ -1075,17 +951,12 @@ func main() {
1075951
if err != nil {
1076952
log.Fatalf("key ceremony failed: %s", err)
1077953
}
1078-
case "ocsp-response":
1079-
err = ocspRespCeremony(configBytes)
1080-
if err != nil {
1081-
log.Fatalf("ocsp response ceremony failed: %s", err)
1082-
}
1083954
case "crl":
1084955
err = crlCeremony(configBytes)
1085956
if err != nil {
1086957
log.Fatalf("crl ceremony failed: %s", err)
1087958
}
1088959
default:
1089-
log.Fatalf("unknown ceremony-type, must be one of: root, cross-certificate, intermediate, cross-csr, key, ocsp-response, crl")
960+
log.Fatalf("unknown ceremony-type, must be one of: root, cross-certificate, intermediate, cross-csr, key, crl")
1090961
}
1091962
}

0 commit comments

Comments
 (0)