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

Enabling certificate verification using CRL-DP extension #1003

Merged
merged 3 commits into from
Apr 15, 2024

Conversation

fmarco76
Copy link
Member

Currently certificates can be validated only using OCSP with a configured responder or using the AIA certificate extension. If the responder cannot be used verification is not possible. This is the case for the startup certificates of the responder.

The new policy add a verification using the CRL-DP extension defined in the certificate. If this extension is defined it has precedence over the OCSP and if it pass no other check are performed. If CRL cannot be retrieved then the OCSP responder is used. This new method takes place when OCSP is configured without a default responder and the PKIX verification method is adopted (with the policy OCSP_LEAF_AND_CHAIN_POLICY).

At least a verification method has to return success to accept the certificate.

Additionally, the connector parameter enableOCSP is renamed to enableRevocationCheck since this is used to enable CRL-DP and AIA based validation

Copy link
Contributor

@ladycfu ladycfu left a comment

Choose a reason for hiding this comment

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

looks good. my only comment is,, as stated in slack, to keep enableOCSP working as before just for backward compatibility purpose. Thanks

Copy link
Contributor

@edewata edewata left a comment

Choose a reason for hiding this comment

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

I have some comments about backward compatibility, but everything else looks good. Feel free to update/merge.

As discussed in Slack, in the future we might want to add more params to configure the validation policy (e.g. OCSP first then CRL).

@@ -945,22 +945,22 @@ JSSL_verifyCertPKIXInternal(CERTCertificate *cert,
* we construct the policy ourselves. */
PRUint64 ocsp_Enabled_Hard_Policy_LeafFlags[2] = {
/* crl */
CERT_REV_M_DO_NOT_TEST_USING_THIS_METHOD,
CERT_REV_M_TEST_USING_THIS_METHOD,
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably should update the comment above this code since it's still saying Note that we disable CRL fetching as Dogtag doesn't support it.

/* ocsp */
CERT_REV_M_TEST_USING_THIS_METHOD |
CERT_REV_M_FAIL_ON_MISSING_FRESH_INFO
};

CERTRevocationMethodIndex ocsp_Enabled_Hard_Policy_Method_Preference[1] = {
cert_revocation_method_ocsp
cert_revocation_method_crl
Copy link
Contributor

Choose a reason for hiding this comment

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

This line is under indented.

Comment on lines 76 to 89
public boolean getEnableRevocationCheck() {
return tomcatjss.getEnableRevocationCheck();
}

public void setEnableOCSP(boolean enableOCSP) {
tomcatjss.setEnableOCSP(enableOCSP);
public void setEnableRevocationCheck(boolean enableRevocationCheck) {
tomcatjss.setEnableRevocationCheck(enableRevocationCheck);
Copy link
Contributor

@edewata edewata Apr 10, 2024

Choose a reason for hiding this comment

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

As discussed on Slack, we should keep the enabledOCSP param for backward compatibility, but now the original getter/setter for that param should call TomcatJSS.enableRevocationCheck's getter/setter instead.

Comment on lines +270 to +276
String enableRevocationCheckProp = config.getProperty("enableRevocationCheck");
if (enableRevocationCheckProp != null)
setEnableRevocationCheck(Boolean.parseBoolean(enableRevocationCheckProp));
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, we should also check enableOCSP param for backward compatibility.

Comment on lines 346 to 356
String enableRevocationCheckProp = connector.getAttribute("enableRevocationCheck");
if (enableRevocationCheckProp != null)
setEnableRevocationCheck(Boolean.parseBoolean(enableRevocationCheckProp));
Copy link
Contributor

Choose a reason for hiding this comment

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

Similarly, we should also check enableOCSP param for backward compatibility.

Comment on lines 3 to 6
== enableOCSP become enableRevocationCheck ==

Since verification with CRL-DP is introduced and it is enabled using
this parameter in `server.xml` connector, the name is modified to be not related only to OCSP.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're going to keep enableOCSP, I'd suggest to modify this to be something like:

Rename enableOCSP to enableRevocationCheck

The enableOCSP param has been deprecated. Use enableRevocationCheck instead.

Currently certificates can be validated only using OCSP with a configured
responder or using the AIA certificate extension. If the responder
cannot be used verification is not possible. This is the case for the
startup certificates of the responder.

The new policy add a verification using the CRL-DP extension defined in
the certificate. If AIA extension is defined it has precedence over the
CRLs and if no other check are performed.
This new method takes place when OCSP is configured without a default
responder and the PKIX verification method is adopted (with the policy
OCSP_LEAF_AND_CHAIN_POLICY).

At least a verification method, defined in the certificate, has to return
success to accept the certificate.
Since verification with CRL-DP is introduced and it is enabled using
this parameter the name is modified to be not related only to OCSP.
Comment on lines 945 to 946
* - if AIA and CRL-DP are both presents only AIA is used and in case
* freshin formation cannot be retrieved it fails the validation;
Copy link
Contributor

@edewata edewata Apr 11, 2024

Choose a reason for hiding this comment

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

I think there's a typo: fresh information.

With this PR what would be the verification order, CRL-DP first or AIA first?

If the AIA check is done first but the OCSP responder is not available, can we fallback to CRL-DP?

Copy link
Contributor

Choose a reason for hiding this comment

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

JFTR, @fmarco76 explained that the order is defined in ocsp_Enabled_Hard_Policy_Method_Preference, and currently it's configured to do OCSP first (so CRL is implicitly the second).

Also, it seems like it's not possible to define a single validation policy that can fallback from OCSP to CRL without affecting individual OCSP or CRL validations. A possible workaround is to define separate policies based on which extensions are present in the cert itself, but this likely requires more significant changes.

Regardless, the description above correctly describes the policy based on the changes in this PR, so feel free to update/merge. Thanks!

*
* When enabled the checking on the chained CA certificates.
* With this policy the verification process does:
* - if one between AIA and CRL-DP is present then it will be used;
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion to rephrase : "- if only an AIA or an CRL-DP is present, the respective validation method is used;"

@fmarco76 fmarco76 force-pushed the CRL-DP_Enabled branch 2 times, most recently from 7d90b9f to bf32a6f Compare April 12, 2024 14:42
/* ocsp */
CERT_REV_M_TEST_USING_THIS_METHOD |
CERT_REV_M_FAIL_ON_MISSING_FRESH_INFO
};

PRUint64 ocsp_Enabled_Hard_Policy_ChainFlags[2] = {
/* crl */
CERT_REV_M_DO_NOT_TEST_USING_THIS_METHOD,
CERT_REV_M_TEST_USING_THIS_METHOD |
CERT_REV_M_FAIL_ON_MISSING_FRESH_INFO,
/* ocsp */
CERT_REV_M_TEST_USING_THIS_METHOD |
CERT_REV_M_FAIL_ON_MISSING_FRESH_INFO
};

Copy link
Contributor

Choose a reason for hiding this comment

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

for the following setting, it might help the reader to add a comment that says something like "/* if CRL-dp is present in the cert, disable CERT_REV_M_FAIL_ON_MISSING_FRESH_INFO for ocsp */

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment added to the if where the flag is modified

* - if only an AIA or an CRL-DP is present, the respective validation method is used;
* - if AIA and CRL-DP are both presents the execution order is: AIA first followed by
* CRL only in case OCSP endpoint does not provide fresh information;
* - it no AIA and CRL-DP are present no revocation check is performed.*/
Copy link
Contributor

Choose a reason for hiding this comment

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

typo. "if" instead of "it"

Copy link
Contributor

@ladycfu ladycfu left a comment

Choose a reason for hiding this comment

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

looks good. Just a couple comments-related suggestions.

@edewata
Copy link
Contributor

edewata commented Apr 12, 2024

I don't have any additional comments. Thanks for the updates!

In case of CRLDP and AIA extensions available in the certificate the
PKIX verification flags do not allow to implement a fallback mechanism
because the fallback remain active also for certificate with only one
extension with unexpected behaviour.

A more dynamic approach is introduced verifying the presence of the
CRLDP extension and setting the flags accordingly.
Copy link

@fmarco76 fmarco76 merged commit 242024a into dogtagpki:master Apr 15, 2024
34 of 35 checks passed
@fmarco76 fmarco76 deleted the CRL-DP_Enabled branch May 17, 2024 14:52
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.

3 participants