yandrey321 commented on code in PR #12114:
URL: https://github.com/apache/ozone/pull/12114#discussion_r4675276112
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/client/SCMCertificateClient.java:
##########
@@ -386,8 +388,8 @@ public CertificateServer initializeRootCertificateServer(
SecurityConfig config, CertificateStore scmCertStore,
BigInteger rootCertId, PKIProfile pkiProfile, String component)
throws IOException {
- String subject = SCM_ROOT_CA_PREFIX +
- InetAddress.getLocalHost().getHostName();
+ String subject = CertificateSignRequest.commonName(SCM_ROOT_CA_PREFIX +
Review Comment:
Good catch, fixed. HASecurityUtils.initializeRootCertificateServer now
applies CertificateSignRequest.commonName as you suggested. On a long host name
the root CA CN is scm@<SCM ID>, the same as SCMCertificateClient gives at init.
RootCARotationManager calls exactly this method for the new root CA, and so
does SCM start-up on the primary SCM and on upgraded clusters.
One correction for the record: with the first commit of this PR, rotation no
longer shuts SCM down, because the subject is built with X500NameBuilder and
never goes through the Bouncy Castle string check. Without this fix it would
still have issued a root CA with a CN over 64 characters, so this is about RFC
5280 conformance, as you said.
Tests:
- TestHASecurityUtils#testRootCaCommonName: the rotation path; scm@<SCM ID>
for a long host name, unchanged scm@<host> for a short one.
- TestSCMCertificateClient#testRootCaCommonName: the init path, same
assertions.
I tested the method directly instead of extending TestRootCARotationManager,
because that test mocks around rotation and the new root CA comes entirely from
this one call. With the fix reverted, TestHASecurityUtils fails with "expected:
<scm@<SCM ID>> but was: <[email protected]>".
The scm-sub@<host> subject in
StorageContainerManager#initializeCAnSecurityProtocol is never used: a
SUBORDINATE DefaultCAServer gets its certificate at init/bootstrap and doesn't
self-sign. So I left it alone.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]