You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/04/10 01:28:56 UTC

[GitHub] [ozone] vivekratnavel opened a new pull request #2145: HDDS-4842. Add timestamp to Revoked Certs table in SCM DB

vivekratnavel opened a new pull request #2145:
URL: https://github.com/apache/ozone/pull/2145


   ## What changes were proposed in this pull request?
   
   Add timestamp to REVOKED_CERTS table in SCM db. 
   
   The changes required to make it backward compatible is tracked here - https://issues.apache.org/jira/browse/HDDS-5088
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-4842
   
   ## How was this patch tested?
   
   Unit tests
   


-- 
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.

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] xiaoyuyao commented on pull request #2145: HDDS-4842. Add timestamp to Revoked Certs table in SCM DB

Posted by GitBox <gi...@apache.org>.
xiaoyuyao commented on pull request #2145:
URL: https://github.com/apache/ozone/pull/2145#issuecomment-818861744


   @vivekratnavel TestSCMCertStore.testRevokeCertificates failure seems related. 


-- 
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.

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] bharatviswa504 commented on a change in pull request #2145: HDDS-4842. Add timestamp to Revoked Certs table in SCM DB

Posted by GitBox <gi...@apache.org>.
bharatviswa504 commented on a change in pull request #2145:
URL: https://github.com/apache/ozone/pull/2145#discussion_r611758933



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMDBDefinition.java
##########
@@ -75,6 +80,15 @@
           X509Certificate.class,
           new X509CertificateCodec());
 
+  public static final DBColumnFamilyDefinition<BigInteger, CertInfo>
+      REVOKED_CERTS_V2 =

Review comment:
       Yes, it should be replicated across SCM's.




-- 
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.

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] xiaoyuyao commented on pull request #2145: HDDS-4842. Add timestamp to Revoked Certs table in SCM DB

Posted by GitBox <gi...@apache.org>.
xiaoyuyao commented on pull request #2145:
URL: https://github.com/apache/ozone/pull/2145#issuecomment-819116543


   Thanks @vivekratnavel  for the update. LGTM, +1.  I will merge it shortly,. 


-- 
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.

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] vivekratnavel commented on a change in pull request #2145: HDDS-4842. Add timestamp to Revoked Certs table in SCM DB

Posted by GitBox <gi...@apache.org>.
vivekratnavel commented on a change in pull request #2145:
URL: https://github.com/apache/ozone/pull/2145#discussion_r611996283



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMDBDefinition.java
##########
@@ -75,6 +80,15 @@
           X509Certificate.class,
           new X509CertificateCodec());
 
+  public static final DBColumnFamilyDefinition<BigInteger, CertInfo>
+      REVOKED_CERTS_V2 =

Review comment:
       Thanks for bringing this up @GlenGeng and @bharatviswa504. I have created a separate jira to fix the persistence via Ratis - https://issues.apache.org/jira/browse/HDDS-5095 since we also need to fix the valid certs table.
   
    




-- 
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.

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] xiaoyuyao commented on a change in pull request #2145: HDDS-4842. Add timestamp to Revoked Certs table in SCM DB

Posted by GitBox <gi...@apache.org>.
xiaoyuyao commented on a change in pull request #2145:
URL: https://github.com/apache/ozone/pull/2145#discussion_r612021635



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMDBDefinition.java
##########
@@ -141,7 +155,7 @@ public String getLocationConfigKey() {
   @Override
   public DBColumnFamilyDefinition[] getColumnFamilies() {
     return new DBColumnFamilyDefinition[] {DELETED_BLOCKS, VALID_CERTS,
-        VALID_SCM_CERTS, REVOKED_CERTS, PIPELINES, CONTAINERS, TRANSACTIONINFO,
-        CRLS, CRL_SEQUENCE_ID, SEQUENCE_ID};
+        VALID_SCM_CERTS, REVOKED_CERTS_V2, PIPELINES, CONTAINERS,

Review comment:
       Should we keep the REVOKED_CERTS and add a separate take as V2 for compatibility? Otherwise, it might break on upgrade. 

##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMCertStore.java
##########
@@ -174,8 +175,12 @@ public void checkValidCertID(BigInteger serialID) throws IOException {
           // only if the revocation time has passed.
           if (now.after(revocationTime) || now.equals(revocationTime)) {
             for (X509Certificate cert : certsToRevoke) {
+              CertInfo certInfo = new CertInfo.Builder()
+                  .setX509Certificate(cert)
+                  .setTimestamp(now.getTime())
+                  .build();
               scmMetadataStore.getRevokedCertsTable()
-                  .putWithBatch(batch, cert.getSerialNumber(), cert);
+                  .putWithBatch(batch, cert.getSerialNumber(), certInfo);

Review comment:
       here we might provide some migration from revokecert table to revokecert v2 table. 

##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMDBDefinition.java
##########
@@ -75,6 +80,15 @@
           X509Certificate.class,
           new X509CertificateCodec());
 
+  public static final DBColumnFamilyDefinition<BigInteger, CertInfo>
+      REVOKED_CERTS_V2 =

Review comment:
       @vivekratnavel  and I have an offline discussion on this. Both crl sequence id and revoked certs replication will be taken care by HDDS-5095 via Replicate annotation on the CertificateStore#revokeCertificats




-- 
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.

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] vivekratnavel commented on a change in pull request #2145: HDDS-4842. Add timestamp to Revoked Certs table in SCM DB

Posted by GitBox <gi...@apache.org>.
vivekratnavel commented on a change in pull request #2145:
URL: https://github.com/apache/ozone/pull/2145#discussion_r612018451



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMDBDefinition.java
##########
@@ -75,6 +80,15 @@
           X509Certificate.class,
           new X509CertificateCodec());
 
+  public static final DBColumnFamilyDefinition<BigInteger, CertInfo>
+      REVOKED_CERTS_V2 =

Review comment:
       It seems like a small change. So, I will update the same patch to get "REVOKED_CERTS_V2" replicated. 




-- 
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.

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] xiaoyuyao merged pull request #2145: HDDS-4842. Add timestamp to Revoked Certs table in SCM DB

Posted by GitBox <gi...@apache.org>.
xiaoyuyao merged pull request #2145:
URL: https://github.com/apache/ozone/pull/2145


   


-- 
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.

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] xiaoyuyao commented on a change in pull request #2145: HDDS-4842. Add timestamp to Revoked Certs table in SCM DB

Posted by GitBox <gi...@apache.org>.
xiaoyuyao commented on a change in pull request #2145:
URL: https://github.com/apache/ozone/pull/2145#discussion_r612020057



##########
File path: hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/security/x509/certificate/CertInfo.java
##########
@@ -0,0 +1,169 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+package org.apache.hadoop.hdds.security.x509.certificate;
+
+import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
+import org.apache.hadoop.hdds.security.exception.SCMSecurityException;
+import org.apache.hadoop.hdds.security.x509.certificate.utils.CertificateCodec;
+import org.jetbrains.annotations.NotNull;
+
+import java.io.IOException;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.Comparator;
+import java.util.Objects;
+
+/**
+ * Class that wraps Certificate Info.
+ */
+public class CertInfo implements Comparator<CertInfo>,
+    Comparable<CertInfo> {
+
+  private X509Certificate x509Certificate;
+  private long timestamp;

Review comment:
       Can you add the meaning/intended usage of timestamp here?




-- 
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.

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] vivekratnavel commented on a change in pull request #2145: HDDS-4842. Add timestamp to Revoked Certs table in SCM DB

Posted by GitBox <gi...@apache.org>.
vivekratnavel commented on a change in pull request #2145:
URL: https://github.com/apache/ozone/pull/2145#discussion_r611996283



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMDBDefinition.java
##########
@@ -75,6 +80,15 @@
           X509Certificate.class,
           new X509CertificateCodec());
 
+  public static final DBColumnFamilyDefinition<BigInteger, CertInfo>
+      REVOKED_CERTS_V2 =

Review comment:
       Thanks for bringing this up @GlenGeng and @bharatviswa504. I have created a separate jira to fix the persistence via Ratis - https://issues.apache.org/jira/browse/HDDS-5095.
   
    




-- 
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.

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] GlenGeng commented on a change in pull request #2145: HDDS-4842. Add timestamp to Revoked Certs table in SCM DB

Posted by GitBox <gi...@apache.org>.
GlenGeng commented on a change in pull request #2145:
URL: https://github.com/apache/ozone/pull/2145#discussion_r611294451



##########
File path: hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/metadata/SCMDBDefinition.java
##########
@@ -75,6 +80,15 @@
           X509Certificate.class,
           new X509CertificateCodec());
 
+  public static final DBColumnFamilyDefinition<BigInteger, CertInfo>
+      REVOKED_CERTS_V2 =

Review comment:
       @bharatviswa504 Is `REVOKED_CERTS_V2` needed to be replicated across multi SCMs if SCM HA Is on?




-- 
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.

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