Skip to content

Commit

Permalink
Disable SSL verification for internal clients in system services and …
Browse files Browse the repository at this point in the history
…combine https configuration for internal router with existing config
  • Loading branch information
arjan-bal committed Dec 27, 2023
1 parent 1ae1852 commit a590565
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import io.cdap.cdap.common.service.ServiceDiscoverable;
import io.cdap.cdap.proto.ProgramType;
import io.cdap.cdap.proto.id.ProgramId;
import io.cdap.common.http.HttpRequestConfig;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
Expand Down Expand Up @@ -85,6 +84,8 @@ public HttpURLConnection openConnection(String namespaceId, String applicationId
}

/**
* Gets a factory for creating clients for CDAP services.
*
* @return the {@link RemoteClientFactory}
*/
protected abstract RemoteClientFactory getRemoteClientFactory();
Expand All @@ -103,7 +104,7 @@ private RemoteClient createRemoteClient(String namespaceId, String applicationId
ProgramType.SERVICE, serviceId);
String basePath = String.format("%s/namespaces/%s/apps/%s/services/%s/methods/",
Constants.Gateway.API_VERSION_3_TOKEN, namespaceId, applicationId, serviceId);
return getRemoteClientFactory().createRemoteClient(discoveryName, HttpRequestConfig.DEFAULT,
basePath);
return getRemoteClientFactory().createRemoteClient(discoveryName,
RemoteClientFactory.NO_VERIFY_HTTP_REQUEST_CONFIG, basePath);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void modify(ChannelPipeline pipeline) {
.setHost(cConf.get(Constants.InternalRouter.BIND_ADDRESS))
.setPort(cConf.getInt(Constants.InternalRouter.BIND_PORT));

if (cConf.getBoolean(Constants.InternalRouter.SSL_ENABLED)) {
if (cConf.getBoolean(Constants.Security.SSL.INTERNAL_ENABLED)) {
new HttpsEnabler().configureKeyStore(cConf, sConf).enable(builder);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2495,7 +2495,6 @@ public static final class InternalRouter {

public static final String BIND_ADDRESS = "internal.router.service.bind.address";
public static final String BIND_PORT = "internal.router.service.bind.port";
public static final String SSL_ENABLED = "internal.router.service.ssl.enabled";
public static final String CLIENT_ENABLED = "internal.router.client.enabled";
public static final String SERVER_ENABLED = "internal.router.server.enabled";
}
Expand Down
9 changes: 0 additions & 9 deletions cdap-common/src/main/resources/cdap-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6063,15 +6063,6 @@
</description>
</property>

<property>
<name>internal.router.service.ssl.enabled</name>
<value>${ssl.internal.enabled}</value>
<description>
Enable usage of SSL for the internal router service. By default, it is
disabled.
</description>
</property>

<property>
<name>internal.router.client.enabled</name>
<value>false</value>
Expand Down

0 comments on commit a590565

Please sign in to comment.