Skip to content

HDDS-7708. No check for certificate duration config scenarios. #4149

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

Merged
merged 4 commits into from
Jan 6, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
HDDS-7708. No check for certificate duration config scenarios.
  • Loading branch information
ashishk committed Jan 6, 2023
commit 516c9fcdc87cb7dd07836fea9e17852bb84d5cbb
Original file line number Diff line number Diff line change
Expand Up @@ -228,36 +228,35 @@ public SecurityConfig(ConfigurationSource configuration) {
*/
private void validateCertificateValidityConfig() {
if (maxCertDuration.isNegative() || maxCertDuration.isZero()) {
LOG.error("Certificate maxDuration {} should not be zero or negative",
maxCertDuration);
throw new IllegalArgumentException("Certificate maxDuration should not " +
"be zero or negative");
String msg = "Property " + HDDS_X509_MAX_DURATION +
" should not be zero or negative";
LOG.error(msg);
throw new IllegalArgumentException(msg);
}
if (defaultCertDuration.isNegative() || defaultCertDuration.isZero()) {
LOG.error("Certificate duration {} should not be Zero or negative",
defaultCertDuration);
throw new IllegalArgumentException("Certificate duration should not be " +
"negative or zero");
String msg = "Property " + HDDS_X509_DEFAULT_DURATION +
" should not be zero or negative";
LOG.error(msg);
throw new IllegalArgumentException(msg);
}
if (renewalGracePeriod.isNegative() || renewalGracePeriod.isZero()) {
LOG.error("Certificate grace duration {} should not be Zero or negative",
renewalGracePeriod);
throw new IllegalArgumentException("Certificate grace duration should " +
"not be negative or zero");
String msg = "Property " + HDDS_X509_RENEW_GRACE_DURATION +
" should not be zero or negative";
LOG.error(msg);
throw new IllegalArgumentException(msg);
}

if (maxCertDuration.compareTo(defaultCertDuration) < 0) {
LOG.error("Certificate duration {} should not be greater than Maximum " +
"Certificate duration {}", defaultCertDuration, maxCertDuration);
throw new IllegalArgumentException("Certificate duration should not " +
"be greater than maximum Certificate duration");
String msg = "Property " + HDDS_X509_DEFAULT_DURATION +
" should not be greater than Property " + HDDS_X509_MAX_DURATION;
LOG.error(msg);
throw new IllegalArgumentException(msg);
}
if (defaultCertDuration.compareTo(renewalGracePeriod) < 0) {
LOG.error("Grace Certificate duration {} should not be greater than " +
"Certificate duration {}", renewalGracePeriod,
defaultCertDuration);
throw new IllegalArgumentException("Grace Certificate duration should " +
"not be greater than Certificate duration");
String msg = "Property " + HDDS_X509_RENEW_GRACE_DURATION +
" should not be greater than Property " + HDDS_X509_DEFAULT_DURATION;
LOG.error(msg);
throw new IllegalArgumentException(msg);
}
}

Expand Down