Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lints: ballot 144/201 .onion linting. #263

Closed
wants to merge 3 commits into from
Closed

Conversation

cpu
Copy link
Member

@cpu cpu commented Mar 2, 2019

This branch adds three new lints based on CABF Ballot 144 and CABF Ballot 201 specific to the allowance of .onion subject names under several additional requirements. Presently all of the new lints are made to be effective as of May 1st, 2015 but that may need to be tweaked.

  • lint_san_dns_name_onion_not_ev_cert.go validates that any subscriber certificates containing a .onion subject are EV certificates.
  • lint_ext_tor_service_descriptor.go validates that certificates with one or more .onion subjects have the correct cabf-TorServiceDescriptor extension, and a well formed TorServiceDescriptorHash object for each .onion subject.
  • lint_onion_subject_validity_time_too_large.go validates certificates with one or more .onion subjects do not have a validity period larger than 15 months.

These linters will hopefully help catch miss-issuance events like this one by DigiCert in March 2018.

I'd appreciate some extra 👀 on my parsing of the TorServiceDescriptorHash ASN.1. As far as I know there aren't any other open source projects that have implemented this so I wasn't able to spot check against someone else's code. AWSLabs/Certlint has not yet implemented this linting at the time of writing.

Resolves #14

cpu added 3 commits March 2, 2019 10:18
Adds a lint (`lint_san_dns_name_onion_not_ev_cert.go`) that validates
that any subscriber certificates containing a `.onion` subject that were
issued after May 1st, 2015 are EV certificates. Any non-EV certs issued
after this date that contain a `.onion` subject should receive an
`Error` lint result.
Adds a lint (`lint_ext_tor_service_descriptor.go`) that validates
that `.onion` subjects have the correct `cabf-TorServiceDescriptor`
extension with a well formed `TorServiceDescriptorHash` object for each
`.onion` subject.
Adds a lint (`lint_onion_subject_validity_time_too_large.go`) that
validates certificates with one or more `.onion` subjects do not have
a validity period larger than 15 months.
@cpu cpu self-assigned this Mar 2, 2019
@cpu cpu changed the title lints: ballot 144 .onion linting. lints: ballot 201 .onion linting. Mar 2, 2019
@cpu
Copy link
Member Author

cpu commented Mar 2, 2019

lint_ext_tor_service_descriptor.go validates that certificates with one or more .onion subjects have the correct cabf-TorServiceDescriptor extension, and a well formed TorServiceDescriptorHash object for each .onion subject.

I think for this one lint the effective date should be the 8th of July 2017 instead of May 1st, 2015 based on it being a clarification from Ballot 201. I'll try to clarify and update shortly.

@cpu cpu changed the title lints: ballot 201 .onion linting. lints: ballot 144/201 .onion linting. Mar 2, 2019
@zakird
Copy link
Member

zakird commented Mar 2, 2019

Resolves #14

if !util.IsSubscriberCert(c) {
return false
}
names := append(c.DNSNames, c.Subject.CommonName)
Copy link
Member

Choose a reason for hiding this comment

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

We might want to move this into a util helper since it's already in multiple lints and could plausibly be reused in the future.

// and parses a TorServiceDescriptorHash using the data contained in the
// sequence. The TorServiceDescriptorHash object and the remaining data are
// returned if no error occurs.
func parseTorServiceDescriptorHash(data []byte) (*TorServiceDescriptorHash, []byte, error) {
Copy link
Member

@zakird zakird Mar 2, 2019

Choose a reason for hiding this comment

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

I suspect we want this parsing to live in ZCrypto (https://github.com/zmap/zcrypto) and be an exposed part of a certificate rather than parsed out here as part of the lint. That way when we parse certificates in other places, we have this data available. Thoughts?

Copy link
Member Author

Choose a reason for hiding this comment

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

That makes sense to me 👍 I'll take a crack at pulling out a separate zcrypto PR.

Copy link
Member Author

Choose a reason for hiding this comment

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

I haven't had a chance to start on dissecting this PR but I think my rough plan of attack will be:

  1. Closing this PR.
  2. Opening a new PR against zlint that adds lint_onion_subject_validity_time_too_large.go and lint_san_dns_name_onion_not_ev_cert.go since these can land right away.
  3. Opening a PR against zcrypto to add the TorServiceDescriptorHash parsing code
  4. Working through review of that branch until it lands.
  5. Opening a final PR against zlint that adds an updated lint_ext_tor_service_descriptor_hash_invalid.go that lints without any ASN.1 parsing logic.

@zakird Is it fair to assume that since zlint doesn't pin/vendor its dependencies that writing a lint that only builds against zcrypto master is copacetic?

Description: fmt.Sprintf(
"certificates with .onion names can not be valid for more than %d months",
maxOnionValidityMonths),
// TODO(@cpu): Cite section of BRs instead of ballot?
Copy link
Member

Choose a reason for hiding this comment

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

Agree, we should cite the finalized BR not the ballot.

@zakird
Copy link
Member

zakird commented Mar 5, 2019 via email

@cpu
Copy link
Member Author

cpu commented Mar 5, 2019

Yes I think that's fine. Long erm we should probably pin.

👍 #264

@cpu
Copy link
Member Author

cpu commented Mar 6, 2019

Closing this PR based on my plan to split it up.

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.

2 participants