Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions external-service-impl/rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
<scope>runtime</scope>
<exclusions>
<!-- repeated in node commons -->
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.apache.iotdb</groupId>
Expand Down Expand Up @@ -87,11 +80,6 @@
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</exclusion>
<!-- repeated in node commons -->
<exclusion>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.iotdb.externalservice.api.IExternalService;
import org.apache.iotdb.rest.i18n.RestMessages;
import org.apache.iotdb.rest.protocol.filter.ApiOriginFilter;
import org.apache.iotdb.rpc.RpcSslUtils;

import org.eclipse.jetty.ee10.servlet.ServletContextHandler;
import org.eclipse.jetty.ee10.servlet.ServletHolder;
Expand All @@ -46,12 +47,13 @@

private static Server server;

private void startSSL(

Check warning on line 50 in external-service-impl/rest/src/main/java/org/apache/iotdb/rest/RestService.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Method has 8 parameters, which is greater than 7 authorized.

See more on https://sonarcloud.io/project/issues?id=apache_iotdb&issues=AZ6XaZTCOPSex0CpCscO&open=AZ6XaZTCOPSex0CpCscO&pullRequest=17854
int port,
String keyStorePath,
String trustStorePath,
String keyStorePwd,
String trustStorePwd,
String sslProtocol,
int idleTime,
boolean clientAuth) {
server = new Server();
Expand All @@ -61,6 +63,7 @@
httpsConfig.addCustomizer(new SecureRequestCustomizer());

SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
configureSSL(sslContextFactory, sslProtocol);
sslContextFactory.setKeyStorePath(keyStorePath);
sslContextFactory.setKeyStorePassword(keyStorePwd);
if (clientAuth) {
Expand Down Expand Up @@ -125,6 +128,7 @@
config.getTrustStorePath(),
config.getKeyStorePwd(),
config.getTrustStorePwd(),
config.getSslProtocol(),
config.getIdleTimeoutInSeconds(),
config.isClientAuth());
} else {
Expand All @@ -142,4 +146,9 @@
server.destroy();
}
}

private void configureSSL(SslContextFactory.Server sslContextFactory, String sslProtocol) {

Check warning on line 150 in external-service-impl/rest/src/main/java/org/apache/iotdb/rest/RestService.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Abbreviation in name 'configureSSL' must contain no more than '2' consecutive capital letters.

See more on https://sonarcloud.io/project/issues?id=apache_iotdb&issues=AZ60xF2rvxKY-zko0WzG&open=AZ60xF2rvxKY-zko0WzG&pullRequest=17854
String protocol = RpcSslUtils.normalizeProtocol(sslProtocol);
sslContextFactory.setProtocol(protocol);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ protected final void setProperty(@NotNull String key, String value) {
}
}

public final String getProperty(@NotNull String key, String defaultValue) {
return properties.getProperty(key, defaultValue);
}

/** Create an instance but with empty properties. */
public abstract MppBaseConfig emptyClone();
}
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,12 @@ public CommonConfig setEnforceStrongPassword(boolean enforceStrongPassword) {
return this;
}

@Override
public CommonConfig setEnableThriftClientSSL(boolean enableThriftClientSSL) {
setProperty("enable_thrift_ssl", String.valueOf(enableThriftClientSSL));
return this;
}

@Override
public CommonConfig setEnableInternalSSL(boolean enableInternalSSL) {
setProperty("enable_internal_ssl", String.valueOf(enableInternalSSL));
Expand Down Expand Up @@ -665,6 +671,12 @@ public CommonConfig setTrustStorePwd(String trustStorePwd) {
return this;
}

@Override
public CommonConfig setSslProtocol(String sslProtocol) {
setProperty("ssl_protocol", sslProtocol);
return this;
}

@Override
public CommonConfig setDatanodeMemoryProportion(String datanodeMemoryProportion) {
setProperty("datanode_memory_proportion", datanodeMemoryProportion);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,13 @@ public CommonConfig setEnforceStrongPassword(boolean enforceStrongPassword) {
return this;
}

@Override
public CommonConfig setEnableThriftClientSSL(boolean enableThriftClientSSL) {
cnConfig.setEnableThriftClientSSL(enableThriftClientSSL);
dnConfig.setEnableThriftClientSSL(enableThriftClientSSL);
return this;
}

@Override
public CommonConfig setEnableInternalSSL(boolean enableInternalSSL) {
cnConfig.setEnableInternalSSL(enableInternalSSL);
Expand Down Expand Up @@ -694,6 +701,13 @@ public CommonConfig setTrustStorePwd(String trustStorePwd) {
return this;
}

@Override
public CommonConfig setSslProtocol(String sslProtocol) {
cnConfig.setSslProtocol(sslProtocol);
dnConfig.setSslProtocol(sslProtocol);
return this;
}

@Override
public CommonConfig setDatanodeMemoryProportion(String datanodeMemoryProportion) {
dnConfig.setDatanodeMemoryProportion(datanodeMemoryProportion);
Expand Down
Loading
Loading