You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2020/06/19 16:53:52 UTC

[GitHub] [bookkeeper] Ghatage commented on a change in pull request #2355: Certificate role based authorization in Apache Bookkeeper.

Ghatage commented on a change in pull request #2355:
URL: https://github.com/apache/bookkeeper/pull/2355#discussion_r442948240



##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieRequestProcessor.java
##########
@@ -564,10 +564,19 @@ public void operationComplete(Future<Channel> future) throws Exception {
                     AuthHandler.ServerSideHandler authHandler = c.pipeline()
                             .get(AuthHandler.ServerSideHandler.class);
                     authHandler.authProvider.onProtocolUpgrade();
-                    if (future.isSuccess()) {
+
+                    /*
+                     * Success of the future doesn't guarantee success in authentication
+                     * future.isSuccess() only checks if the result field is not null
+                     */
+                    if (future.isSuccess() && authHandler.authenticated) {

Review comment:
       Fixed in [7276947](https://github.com/apache/bookkeeper/commit/72769477f52e4982081ae87a8e43da0a0e34e2d1) 

##########
File path: conf/bk_server.conf
##########
@@ -226,6 +226,15 @@ httpServerClass=org.apache.bookkeeper.http.vertx.VertxHttpServer
 #
 # permittedStartupUsers=
 
+# Certificate role based authorization for Bookie
+# To enable this option, bookieAuthProviderFactoryClass should be set to org.apache.bookkeeper.tls.BookieAuthZFactory
+# comma separated values of roles from the certificates OU field which we want to authorize for access
+#
+# Example settings:
+#   authorizedRoles=apache-pulsar-cluster-12,apache-kafka-cluster-2

Review comment:
       Fixed in [7276947](https://github.com/apache/bookkeeper/commit/72769477f52e4982081ae87a8e43da0a0e34e2d1) 

##########
File path: bookkeeper-server/src/test/java/org/apache/bookkeeper/tls/TestTLS.java
##########
@@ -635,6 +635,47 @@ public void testBookieAuthPluginRequireClientTLSAuthenticationLocal() throws Exc
         assertTrue(cert instanceof X509Certificate);
     }
 
+    /**
+     * Verify that given role in client certificate is checked when BookieAuthZFactory is set.
+     * Positive test case where all given roles are present.

Review comment:
       Fixed in [7276947](https://github.com/apache/bookkeeper/commit/72769477f52e4982081ae87a8e43da0a0e34e2d1) 

##########
File path: bookkeeper-server/src/main/java/org/apache/bookkeeper/util/CertUtils.java
##########
@@ -0,0 +1,117 @@
+/**
+ * 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.bookkeeper.util;
+
+import java.io.IOException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import javax.naming.InvalidNameException;
+import javax.naming.ldap.LdapName;
+import javax.naming.ldap.Rdn;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Certificate parsing utilities.
+ */
+public class CertUtils {

Review comment:
       Fixed in [7276947](https://github.com/apache/bookkeeper/commit/72769477f52e4982081ae87a8e43da0a0e34e2d1) 




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