You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@knox.apache.org by GitBox <gi...@apache.org> on 2020/03/09 15:34:22 UTC

[GitHub] [knox] risdenk opened a new pull request #283: KNOX-2267 - Ambari/CM discovery - Needs to point to configured truststore

risdenk opened a new pull request #283: KNOX-2267 - Ambari/CM discovery - Needs to point to configured truststore
URL: https://github.com/apache/knox/pull/283
 
 
   ## What changes were proposed in this pull request?
   
   Currently Ambari and CM discovery doesn't use the configured HTTP truststore. This change adds the HTTP truststore to both the Ambari and CM discovery HTTP clients.
   
   ## How was this patch tested?
   
   * `mvn -U -T.75C clean verify -Ppackage,release -Dshellcheck`
   * Spun up a cluster with CM AutoTLS and checked that Knox was able to poll for events

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


With regards,
Apache Git Services

[GitHub] [knox] risdenk commented on a change in pull request #283: KNOX-2267 - Ambari/CM discovery - Needs to point to configured truststore

Posted by GitBox <gi...@apache.org>.
risdenk commented on a change in pull request #283: KNOX-2267 - Ambari/CM discovery - Needs to point to configured truststore
URL: https://github.com/apache/knox/pull/283#discussion_r390063231
 
 

 ##########
 File path: gateway-spi/src/main/java/org/apache/knox/gateway/util/TruststoreSSLContextUtils.java
 ##########
 @@ -0,0 +1,55 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.knox.gateway.util;
+
+import org.apache.http.ssl.SSLContextBuilder;
+import org.apache.http.ssl.SSLContexts;
+import org.apache.knox.gateway.i18n.GatewaySpiMessages;
+import org.apache.knox.gateway.i18n.messages.MessagesFactory;
+import org.apache.knox.gateway.services.security.KeystoreService;
+import org.apache.knox.gateway.services.security.KeystoreServiceException;
+
+import javax.net.ssl.SSLContext;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+
+public class TruststoreSSLContextUtils {
+  private static final GatewaySpiMessages LOGGER = MessagesFactory.get(GatewaySpiMessages.class);
+
+  private TruststoreSSLContextUtils() {
+  }
+
+  public static SSLContext getTruststoreSSLContext(KeystoreService keystoreService) {
+    SSLContext sslContext = null;
+    try {
+      SSLContextBuilder sslContextBuilder = SSLContexts.custom();
 
 Review comment:
   hmm yea good point.

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


With regards,
Apache Git Services

[GitHub] [knox] smolnar82 commented on a change in pull request #283: KNOX-2267 - Ambari/CM discovery - Needs to point to configured truststore

Posted by GitBox <gi...@apache.org>.
smolnar82 commented on a change in pull request #283: KNOX-2267 - Ambari/CM discovery - Needs to point to configured truststore
URL: https://github.com/apache/knox/pull/283#discussion_r389884272
 
 

 ##########
 File path: gateway-spi/src/main/java/org/apache/knox/gateway/util/TruststoreSSLContextUtils.java
 ##########
 @@ -0,0 +1,55 @@
+/*
+ * 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
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * 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.knox.gateway.util;
+
+import org.apache.http.ssl.SSLContextBuilder;
+import org.apache.http.ssl.SSLContexts;
+import org.apache.knox.gateway.i18n.GatewaySpiMessages;
+import org.apache.knox.gateway.i18n.messages.MessagesFactory;
+import org.apache.knox.gateway.services.security.KeystoreService;
+import org.apache.knox.gateway.services.security.KeystoreServiceException;
+
+import javax.net.ssl.SSLContext;
+import java.security.KeyManagementException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+
+public class TruststoreSSLContextUtils {
+  private static final GatewaySpiMessages LOGGER = MessagesFactory.get(GatewaySpiMessages.class);
+
+  private TruststoreSSLContextUtils() {
+  }
+
+  public static SSLContext getTruststoreSSLContext(KeystoreService keystoreService) {
+    SSLContext sslContext = null;
+    try {
+      SSLContextBuilder sslContextBuilder = SSLContexts.custom();
 
 Review comment:
   nit: I'd create this instance only if it's really needed (`keystoreService != null && truststore != null`)

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


With regards,
Apache Git Services

[GitHub] [knox] asfgit merged pull request #283: KNOX-2267 - Ambari/CM discovery - Needs to point to configured truststore

Posted by GitBox <gi...@apache.org>.
asfgit merged pull request #283: KNOX-2267 - Ambari/CM discovery - Needs to point to configured truststore
URL: https://github.com/apache/knox/pull/283
 
 
   

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


With regards,
Apache Git Services