...
1 package cabfbr
2
3 import (
4 "github.com/zmap/zcrypto/x509"
5 "github.com/zmap/zlint/v3/lint"
6
7 "github.com/letsencrypt/boulder/linter/lints"
8 )
9
10 type crlAcceptableReasonCodes struct{}
11
12
24
25 func init() {
26 lint.RegisterRevocationListLint(&lint.RevocationListLint{
27 LintMetadata: lint.LintMetadata{
28 Name: "e_crl_acceptable_reason_codes",
29 Description: "CRL entry Reason Codes must be 1, 3, 4, 5, or 9",
30 Citation: "BRs: 7.2.2.1",
31 Source: lint.CABFBaselineRequirements,
32
33
34
35 EffectiveDate: lints.MozillaPolicy281Date,
36 },
37 Lint: NewCrlAcceptableReasonCodes,
38 })
39 }
40
41 func NewCrlAcceptableReasonCodes() lint.RevocationListLintInterface {
42 return &crlAcceptableReasonCodes{}
43 }
44
45 func (l *crlAcceptableReasonCodes) CheckApplies(c *x509.RevocationList) bool {
46 return true
47 }
48
49 func (l *crlAcceptableReasonCodes) Execute(c *x509.RevocationList) *lint.LintResult {
50 for _, rc := range c.RevokedCertificates {
51 if rc.ReasonCode == nil {
52 continue
53 }
54 switch *rc.ReasonCode {
55 case 1:
56 case 3:
57 case 4:
58 case 5:
59 case 9:
60 continue
61 default:
62 return &lint.LintResult{
63 Status: lint.Error,
64 Details: "CRLs MUST NOT include reasonCodes other than 1, 3, 4, 5, and 9",
65 }
66 }
67 }
68 return &lint.LintResult{Status: lint.Pass}
69 }
70
View as plain text