apucher commented on a change in pull request #6415:
URL: https://github.com/apache/incubator-pinot/pull/6415#discussion_r552977865
##########
File path:
pinot-broker/src/main/java/org/apache/pinot/broker/broker/BrokerAdminApiApplication.java
##########
@@ -58,20 +62,60 @@ protected void configure() {
registerClasses(io.swagger.jaxrs.listing.SwaggerSerializers.class);
}
- public void start(int httpPort) {
- Preconditions.checkArgument(httpPort > 0);
- _baseUri = URI.create("http://0.0.0.0:" + httpPort + "/");
- _httpServer = GrizzlyHttpServerFactory.createHttpServer(_baseUri, this);
+ public void start(PinotConfiguration brokerConf) {
+ int brokerQueryPort =
brokerConf.getProperty(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT,
+ CommonConstants.Helix.DEFAULT_BROKER_QUERY_PORT);
+
+ Preconditions.checkArgument(brokerQueryPort > 0);
Review comment:
fixed
##########
File path:
pinot-broker/src/main/java/org/apache/pinot/broker/broker/BrokerAdminApiApplication.java
##########
@@ -58,20 +62,60 @@ protected void configure() {
registerClasses(io.swagger.jaxrs.listing.SwaggerSerializers.class);
}
- public void start(int httpPort) {
- Preconditions.checkArgument(httpPort > 0);
- _baseUri = URI.create("http://0.0.0.0:" + httpPort + "/");
- _httpServer = GrizzlyHttpServerFactory.createHttpServer(_baseUri, this);
+ public void start(PinotConfiguration brokerConf) {
+ int brokerQueryPort =
brokerConf.getProperty(CommonConstants.Helix.KEY_OF_BROKER_QUERY_PORT,
+ CommonConstants.Helix.DEFAULT_BROKER_QUERY_PORT);
+
+ Preconditions.checkArgument(brokerQueryPort > 0);
+ _baseUri = URI.create(String.format("%s://0.0.0.0:%d/",
getBrokerClientProtocol(brokerConf), brokerQueryPort));
+
+ _httpServer = buildHttpsServer(brokerConf);
setupSwagger();
}
+ private HttpServer buildHttpsServer(PinotConfiguration brokerConf) {
+ boolean isSecure =
CommonConstants.HTTPS_PROTOCOL.equals(getBrokerClientProtocol(brokerConf));
+
+ if (isSecure) {
+ return GrizzlyHttpServerFactory.createHttpServer(_baseUri, this, true,
buildSSLConfig(brokerConf));
+ }
+
+ return GrizzlyHttpServerFactory.createHttpServer(_baseUri, this);
+ }
+
+ private SSLEngineConfigurator buildSSLConfig(PinotConfiguration brokerConf) {
+ SSLContextConfigurator sslContextConfigurator = new
SSLContextConfigurator();
+
+ sslContextConfigurator.setKeyStoreFile(brokerConf.getProperty(
+ CommonConstants.Broker.CONFIG_OF_BROKER_CLIENT_TLS_KEYSTORE_PATH));
+ sslContextConfigurator.setKeyStorePass(brokerConf.getProperty(
+ CommonConstants.Broker.CONFIG_OF_BROKER_CLIENT_TLS_KEYSTORE_PASSWORD));
+ sslContextConfigurator.setTrustStoreFile(brokerConf.getProperty(
+ CommonConstants.Broker.CONFIG_OF_BROKER_CLIENT_TLS_TRUSTSTORE_PATH));
+ sslContextConfigurator.setTrustStorePass(brokerConf.getProperty(
+
CommonConstants.Broker.CONFIG_OF_BROKER_CLIENT_TLS_TRUSTSTORE_PASSWORD));
+
+ boolean requiresClientAuth = brokerConf.getProperty(
+ CommonConstants.Broker.CONFIG_OF_BROKER_CLIENT_TLS_CLIENT_AUTH,
+ CommonConstants.Broker.DEFAULT_BROKER_CLIENT_TLS_CLIENT_AUTH);
+
+ return new
SSLEngineConfigurator(sslContextConfigurator).setClientMode(false)
+ .setWantClientAuth(requiresClientAuth).setEnabledProtocols(new
String[] { "TLSv1.2" });
+ }
+
+ private static String getBrokerClientProtocol(PinotConfiguration brokerConf)
{
+ return
Optional.ofNullable(brokerConf.getProperty(CommonConstants.Broker.CONFIG_OF_BROKER_CLIENT_PROTOCOL))
Review comment:
fixed
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]