You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "ChenSammi (via GitHub)" <gi...@apache.org> on 2023/03/20 08:31:43 UTC

[GitHub] [ozone] ChenSammi opened a new pull request, #4429: HDDS-8042. Display certificate issuer in cert list command.

ChenSammi opened a new pull request, #4429:
URL: https://github.com/apache/ozone/pull/4429

   https://issues.apache.org/jira/browse/HDDS-8042
   
   Output before patch
   ```
   bash-4.2$ ozone admin cert list 
   Total 11 valid certificates: 
   SerialNumber      Valid From                     Expiry                         Subject                                                                                                       
   1                 Mon Mar 20 06:20:20 UTC 2023   Thu Apr 27 06:20:20 UTC 2028   CN=scm@scm1.org,OU=d2a1c17f-34cb-4a0e-af0f-4d28353f1a6c,O=CID-148b1564-3abc-462b-8389-2a7b6ac6c733            
   87303630914       Mon Mar 20 06:20:21 UTC 2023   Thu Apr 27 06:20:21 UTC 2028   CN=scm-sub@scm1.org,OU=d2a1c17f-34cb-4a0e-af0f-4d28353f1a6c,O=CID-148b1564-3abc-462b-8389-2a7b6ac6c733        
   109107860257      Mon Mar 20 06:20:43 UTC 2023   Thu Apr 27 06:20:43 UTC 2028   CN=scm-sub@scm2.org,OU=0078c031-35bd-48c5-bb0a-054000d2418b,O=CID-148b1564-3abc-462b-8389-2a7b6ac6c733        
   109288367257      Mon Mar 20 06:20:43 UTC 2023   Tue Mar 19 06:20:43 UTC 2024   CN=recon@recon,OU=d2a1c17f-34cb-4a0e-af0f-4d28353f1a6c,O=CID-148b1564-3abc-462b-8389-2a7b6ac6c733             
   118491360137      Mon Mar 20 06:20:52 UTC 2023   Thu Apr 27 06:20:52 UTC 2028   CN=scm-sub@scm3.org,OU=f890ae25-c837-4ce0-8f05-347555442e9f,O=CID-148b1564-3abc-462b-8389-2a7b6ac6c733        
   133265524226      Mon Mar 20 06:21:07 UTC 2023   Tue Mar 19 06:21:07 UTC 2024   CN=dn@4fbc1d7db192,OU=d2a1c17f-34cb-4a0e-af0f-4d28353f1a6c,O=CID-148b1564-3abc-462b-8389-2a7b6ac6c733         
   133638710143      Mon Mar 20 06:21:07 UTC 2023   Tue Mar 19 06:21:07 UTC 2024   CN=dn@22cb49da28be,OU=d2a1c17f-34cb-4a0e-af0f-4d28353f1a6c,O=CID-148b1564-3abc-462b-8389-2a7b6ac6c733         
   134258596643      Mon Mar 20 06:21:08 UTC 2023   Tue Mar 19 06:21:08 UTC 2024   CN=dn@776a01a893e4,OU=d2a1c17f-34cb-4a0e-af0f-4d28353f1a6c,O=CID-148b1564-3abc-462b-8389-2a7b6ac6c733         
   136650625394      Mon Mar 20 06:21:10 UTC 2023   Tue Mar 19 06:21:10 UTC 2024   CN=om1,OU=d2a1c17f-34cb-4a0e-af0f-4d28353f1a6c,O=CID-148b1564-3abc-462b-8389-2a7b6ac6c733                     
   136735229394      Mon Mar 20 06:21:10 UTC 2023   Tue Mar 19 06:21:10 UTC 2024   CN=om2,OU=d2a1c17f-34cb-4a0e-af0f-4d28353f1a6c,O=CID-148b1564-3abc-462b-8389-2a7b6ac6c733                     
   137483348978      Mon Mar 20 06:21:11 UTC 2023   Tue Mar 19 06:21:11 UTC 2024   CN=om3,OU=d2a1c17f-34cb-4a0e-af0f-4d28353f1a6c,O=CID-148b1564-3abc-462b-8389-2a7b6ac6c733  
   ```
   
   
   Output after patch
   
   ```
   bash-4.2$ ozone admin cert list
   Certificate list:(Type=VALID, BatchSize=20, CertCount=11)
   SerialNumber      Valid From                     Expiry                         Subject                                                                                                        Issuer                                                                                                        
   754090284551      Mon Mar 20 06:31:27 UTC 2023   Thu Apr 27 06:31:27 UTC 2028   CN=scm-sub@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e         CN=scm@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e            
   774473638186      Mon Mar 20 06:31:48 UTC 2023   Thu Apr 27 06:31:48 UTC 2028   CN=scm-sub@scm2.org,OU=7569e35b-eda4-43ff-9985-82d4530b64ee,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e         CN=scm@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e            
   775686475103      Mon Mar 20 06:31:49 UTC 2023   Tue Mar 19 06:31:49 UTC 2024   CN=recon@recon,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e              CN=scm-sub@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e        
   788141377358      Mon Mar 20 06:32:02 UTC 2023   Thu Apr 27 06:32:02 UTC 2028   CN=scm-sub@scm3.org,OU=d8abe3d0-726d-4b9a-85ca-ed4309b4de5c,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e         CN=scm@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e            
   804789908700      Mon Mar 20 06:32:18 UTC 2023   Tue Mar 19 06:32:18 UTC 2024   CN=dn@4ccd3988b5e3,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e          CN=scm-sub@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e        
   806362991242      Mon Mar 20 06:32:20 UTC 2023   Tue Mar 19 06:32:20 UTC 2024   CN=dn@84925ba1d64e,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e          CN=scm-sub@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e        
   806987236284      Mon Mar 20 06:32:20 UTC 2023   Tue Mar 19 06:32:20 UTC 2024   CN=dn@a31dc844a962,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e          CN=scm-sub@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e        
   814049245662      Mon Mar 20 06:32:27 UTC 2023   Tue Mar 19 06:32:27 UTC 2024   CN=om1,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e                      CN=scm-sub@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e        
   814281868996      Mon Mar 20 06:32:28 UTC 2023   Tue Mar 19 06:32:28 UTC 2024   CN=om2,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e                      CN=scm-sub@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e        
   814524253788      Mon Mar 20 06:32:28 UTC 2023   Tue Mar 19 06:32:28 UTC 2024   CN=om3,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e                      CN=scm-sub@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e        
   1                 Mon Mar 20 06:31:27 UTC 2023   Thu Apr 27 06:31:27 UTC 2028   CN=scm@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e             CN=scm@scm1.org,OU=96b4fd0f-e545-4d03-a9b1-5abee70ed907,O=CID-dbac1f31-a439-435d-b6d5-b73e50828f4e         
   ```
   


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] neils-dev commented on a diff in pull request #4429: HDDS-8042. Display certificate issuer in cert list command.

Posted by "neils-dev (via GitHub)" <gi...@apache.org>.
neils-dev commented on code in PR #4429:
URL: https://github.com/apache/ozone/pull/4429#discussion_r1145492646


##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/cert/ListSubcommand.java:
##########
@@ -79,17 +79,20 @@ private HddsProtos.NodeType parseCertRole(String r) {
 
   private void printCert(X509Certificate cert) {
     LOG.info(String.format(OUTPUT_FORMAT, cert.getSerialNumber(),
-        cert.getNotBefore(), cert.getNotAfter(), cert.getSubjectDN()));
+        cert.getNotBefore(), cert.getNotAfter(), cert.getSubjectDN(),
+        cert.getIssuerDN()));
   }
 
   @Override
   protected void execute(SCMSecurityProtocol client) throws IOException {
     boolean isRevoked = type.equalsIgnoreCase("revoked");
-    List<String> certPemList = client.listCertificate(
-        parseCertRole(role), startSerialId, count, isRevoked);
-    LOG.info("Total {} {} certificates: ", certPemList.size(), type);
+    HddsProtos.NodeType nodeType = parseCertRole(role);
+    List<String> certPemList = client.listCertificate(nodeType,
+        startSerialId, count, isRevoked);
+    LOG.info("Certificate list:(Type={}, BatchSize={}, CertCount={})",

Review Comment:
   Minor: for clarity, `CertCount `can be reworked to `TotalCertCount`.
   
   Changes look good.  Thanks.  +1



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] ChenSammi commented on a diff in pull request #4429: HDDS-8042. Display certificate issuer in cert list command.

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on code in PR #4429:
URL: https://github.com/apache/ozone/pull/4429#discussion_r1145613197


##########
hadoop-hdds/tools/src/main/java/org/apache/hadoop/hdds/scm/cli/cert/ListSubcommand.java:
##########
@@ -79,17 +79,20 @@ private HddsProtos.NodeType parseCertRole(String r) {
 
   private void printCert(X509Certificate cert) {
     LOG.info(String.format(OUTPUT_FORMAT, cert.getSerialNumber(),
-        cert.getNotBefore(), cert.getNotAfter(), cert.getSubjectDN()));
+        cert.getNotBefore(), cert.getNotAfter(), cert.getSubjectDN(),
+        cert.getIssuerDN()));
   }
 
   @Override
   protected void execute(SCMSecurityProtocol client) throws IOException {
     boolean isRevoked = type.equalsIgnoreCase("revoked");
-    List<String> certPemList = client.listCertificate(
-        parseCertRole(role), startSerialId, count, isRevoked);
-    LOG.info("Total {} {} certificates: ", certPemList.size(), type);
+    HddsProtos.NodeType nodeType = parseCertRole(role);
+    List<String> certPemList = client.listCertificate(nodeType,
+        startSerialId, count, isRevoked);
+    LOG.info("Certificate list:(Type={}, BatchSize={}, CertCount={})",

Review Comment:
   @neils-dev , thanks for the code review. TotalCertCount will be misleading.  It will make user think there is only this amount of certs in the cluster.  This case happened before. 



-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] kerneltime commented on pull request #4429: HDDS-8042. Display certificate issuer in cert list command.

Posted by "kerneltime (via GitHub)" <gi...@apache.org>.
kerneltime commented on PR #4429:
URL: https://github.com/apache/ozone/pull/4429#issuecomment-1476521637

   @SaketaChalamchala @tanvipenumudy  can you please take a look?


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] ChenSammi commented on pull request #4429: HDDS-8042. Display certificate issuer in cert list command.

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi commented on PR #4429:
URL: https://github.com/apache/ozone/pull/4429#issuecomment-1480516530

   Thanks @fapifta @duongkame and @neils-dev for the code review. 


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


[GitHub] [ozone] ChenSammi merged pull request #4429: HDDS-8042. Display certificate issuer in cert list command.

Posted by "ChenSammi (via GitHub)" <gi...@apache.org>.
ChenSammi merged PR #4429:
URL: https://github.com/apache/ozone/pull/4429


-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org