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

Relax VerifyCACerts expiry condition #428

Merged
merged 1 commit into from
Nov 2, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 8 additions & 9 deletions jdk/test/sun/security/lib/cacerts/VerifyCACerts.java
Original file line number Diff line number Diff line change
Expand Up @@ -545,27 +545,26 @@ public static void main(String[] args) throws Exception {
+ e.getMessage());
}

// Make sure cert is not expired or not yet valid
try {
cert.checkValidity();
} catch (CertificateExpiredException cee) {
if (!EXPIRY_EXC_ENTRIES.contains(alias)) {
atLeastOneFailed = true;
System.err.println("ERROR: cert is expired");
}
// Ignore - we have an 'is very expired' check later
} catch (CertificateNotYetValidException cne) {
atLeastOneFailed = true;
System.err.println("ERROR: cert is not yet valid");
}

// If cert is within 90 days of expiring, mark as failure so
// that cert can be scheduled to be removed/renewed.
// If cert is more than 90 days *past* expiry, mark as failure so
// we can alert either OpenJDK upstream or Amazon Linux.
// This is different to the upstream failure condition, which fails
// 90 days *before* expiry. Our condition is more relaxed because we
// rely on OpenJDK/Amazon Linux to manage the certs.
Date notAfter = cert.getNotAfter();
if (notAfter.getTime() - System.currentTimeMillis() < NINETY_DAYS) {
if (System.currentTimeMillis() - notAfter.getTime() > NINETY_DAYS) {
if (!EXPIRY_EXC_ENTRIES.contains(alias)) {
atLeastOneFailed = true;
System.err.println("ERROR: cert \"" + alias + "\" expiry \""
+ notAfter.toString() + "\" will expire within 90 days");
+ notAfter.toString() + "\" has been expired for >90 days.");
}
}
}
Expand Down