Skip to content

CA: implement CFSSL/zlint pre-issuance linting.#4378

Merged
cpu merged 4 commits intomasterfrom
cpu-cfssl-prelint
Jul 31, 2019
Merged

CA: implement CFSSL/zlint pre-issuance linting.#4378
cpu merged 4 commits intomasterfrom
cpu-cfssl-prelint

Conversation

@cpu
Copy link
Copy Markdown
Contributor

@cpu cpu commented Jul 31, 2019

The test/config-next CA configs are both updated to use zlint to lint TBS pre-certificates with a throw-away key and treat any lint findings >= lints.Pass as an error, blocking the CA from signing the TBS pre-cert with its private key.

The CA issuePrecertificateInner function is updated to specifically catch linting related errors from CFSSL to marshal the linting findings to the audit log. A small unit test for this change is included.

The CA IssueCertificateForPrecertificate function remains unchanged: the CFSSL interface that defines SignFromPrecert doesn't facilitate linting. We still lint final certificates post-issuance with cert-checker and accept the possibility there may be some compliance issues that could occur between the precertificate passing linting and the final certificate being signed.

Resolves #4255

Daniel added 3 commits July 31, 2019 13:17
This will unblock pre-issuance linting support by updating the
`github.com/cloudflare/cfssl` dependency to the `1.3.4` tag which
notably includes the zlint integration developed in
cloudflare/cfssl#1015
@cpu cpu requested a review from a team as a code owner July 31, 2019 18:14
@cpu cpu self-assigned this Jul 31, 2019
jsha
jsha previously approved these changes Jul 31, 2019
Copy link
Copy Markdown
Contributor

@jsha jsha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Generally looks great. I'm curious - why do the lint errors need to be separately marshalled? Are they not serialized in err.Error()?

@cpu
Copy link
Copy Markdown
Contributor Author

cpu commented Jul 31, 2019

Working on the config-next test failures now.

Generally looks great. I'm curious - why do the lint errors need to be separately marshalled? Are they not serialized in err.Error()?

@jsha Correct: https://github.com/cloudflare/cfssl/blob/633726f6bcb7574626ae05ae72ca3c8dbc51810f/signer/local/local.go#L137-L140

I thought slamming all the failures into the Error message would be gnarly when I implemented it and figured that instead the downstream callers that cared could handle the explicit lint failures themselves.

* The change to the `lints.LintStatus` marshaling means we need to use
the human readable version for `lint_error_level`.
* Both profiles in each CA config need the linting configured.
* The `ct_sct_policy_count_unsatisfied` lint needs to be ignored: we're
linting pre-certificates which by definition don't have SCTs.
Copy link
Copy Markdown
Contributor

@jsha jsha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you've added ct_sct_policy_count_unsatisfied to the ignore list, but I think our integration test config always includes 2 SCTs, which is what the lint expects for our 90-day certs, per zmap/zlint#278. Any idea why that lint was triggering?

@cpu
Copy link
Copy Markdown
Contributor Author

cpu commented Jul 31, 2019

I see you've added ct_sct_policy_count_unsatisfied to the ignore list, but I think our integration test config always includes 2 SCTs, which is what the lint expects for our 90-day certs, per zmap/zlint#278. Any idea why that lint was triggering?

@jsha The linting is performed on precertificates. The SCTs from the test CT servers are added at the time the signer signs the final certificate with the precert and the SCTs. There's no linting done at that stage because of CFSSL's design. When linting/signing the TBS precert it's expected there are 0 SCTs and so the lint needs to be disabled or it will always fire.

@jsha
Copy link
Copy Markdown
Contributor

jsha commented Jul 31, 2019

Got it, thanks. Seems like that lint should consider itself not applicable on precertificates - does that make sense to you? If so I'll file a zlint bug (and meanwhile this is fine to merge).

@cpu
Copy link
Copy Markdown
Contributor Author

cpu commented Jul 31, 2019

Seems like that lint should consider itself not applicable on precertificates - does that make sense to you? If so I'll file a zlint bug (and meanwhile this is fine to merge).

@jsha That would be a smart fix 👍 Thanks for the idea. I'll pick up that zlint issue once you've filed it. Next week after the lint fix is merged I can revert the ignore of this lint.

@cpu cpu merged commit eb20b2a into master Jul 31, 2019
@cpu cpu deleted the cpu-cfssl-prelint branch July 31, 2019 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Integrate zlint at signing time

3 participants