You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "akulabs8 (via GitHub)" <gi...@apache.org> on 2025/02/13 14:30:12 UTC

[PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

akulabs8 opened a new pull request, #8698:
URL: https://github.com/apache/seatunnel/pull/8698

   <!--
   
   Thank you for contributing to SeaTunnel! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   ## Contribution Checklist
     - Make sure that the pull request corresponds to a [GITHUB issue](https://github.com/apache/seatunnel/issues).
     - Name the pull request in the form "[Feature] [component] Title of the pull request", where *Feature* can be replaced by `Hotfix`, `Bug`, etc.
     - Minor fixes should be named following this pattern: `[hotfix] [docs] Fix typo in README.md doc`.
   -->
   
   ### Purpose of this pull request
   Adds Https support to rest api v2
   
   ### Does this PR introduce _any_ user-facing change?
   
   <!--
   Note that it means *any* user-facing change including all aspects such as the documentation fix.
   If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
   If possible, please also clarify if this is a user-facing change compared to the released SeaTunnel versions or within the unreleased branches such as dev.
   If no, write 'No'.
   If you are adding/modifying connector documents, please follow our new specifications: https://github.com/apache/seatunnel/issues/4544.
   -->
   
   
   ### How was this patch tested?
   
   <!--
   If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
   If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
   If tests were not added, please describe why they were not added and/or why it was difficult to add.
   If you are adding E2E test cases, maybe refer to https://github.com/apache/seatunnel/blob/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-mysql-e2e/src/test/resources/mysqlcdc_to_mysql.conf, here is a good example.
   -->
   
   
   ### Check list
   
   * [ ] If any new Jar binary package adding in your PR, please add License Notice according
     [New License Guide](https://github.com/apache/seatunnel/blob/dev/docs/en/contribution/new-license.md)
   * [ ] If necessary, please update the documentation to describe the new feature. https://github.com/apache/seatunnel/tree/dev/docs
   * [ ] If you are contributing the connector code, please check that the following files are updated:
     1. Update [plugin-mapping.properties](https://github.com/apache/seatunnel/blob/dev/plugin-mapping.properties) and add new connector information in it
     2. Update the pom file of [seatunnel-dist](https://github.com/apache/seatunnel/blob/dev/seatunnel-dist/pom.xml)
     3. Add ci label in [label-scope-conf](https://github.com/apache/seatunnel/blob/dev/.github/workflows/labeler/label-scope-conf.yml)
     4. Add e2e testcase in [seatunnel-e2e](https://github.com/apache/seatunnel/tree/dev/seatunnel-e2e/seatunnel-connector-v2-e2e/)
     5. Update connector [plugin_config](https://github.com/apache/seatunnel/blob/dev/config/plugin_config)
   * [ ] Update the [`release-note`](https://github.com/apache/seatunnel/blob/dev/release-note.md).


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#issuecomment-3105248866

   This pull request has been closed because it has not had recent activity. You could reopen it if you try to continue your work, and anyone who are interested in it are encouraged to continue work on this pull request.


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#issuecomment-2658096069

   close #8583


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "akulabs8 (via GitHub)" <gi...@apache.org>.
akulabs8 commented on PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#issuecomment-2665458517

   Thanks for the comments @hailin0 
   I will make the necessary changes 


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on code in PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#discussion_r1960991011


##########
seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/server/ServerConfigOptions.java:
##########
@@ -300,6 +300,61 @@ public class ServerConfigOptions {
                     .defaultValue(100)
                     .withDescription(
                             "The port range of the http server. If enable-dynamic-port is true, We will use the unused port in the range");
+    // New HTTPS configurations
+    public static final Option<Integer> HTTPS_PORT =
+            Options.key("https-port")
+                    .intType()
+                    .defaultValue(8443)
+                    .withDescription("The port used for HTTPS communication.");
+
+    public static final Option<Boolean> ENABLE_HTTPS =
+            Options.key("enable-https")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription("Whether to enable HTTPS.");
+
+    public static final Option<String> KEYSTORE =
+            Options.key("keystore")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The file path of the keystore for HTTPS.");
+
+    public static final Option<String> KEYSTORE_PASSWORD =
+            Options.key("keystore-password")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The password for the keystore.");
+
+    public static final Option<String> KEY_PASSWORD =
+            Options.key("key-password")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The password for the key in the keystore.");
+
+    public static final Option<Boolean> REQUIRE_CLIENT_AUTH =
+            Options.key("require-client-auth")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Whether to require client authentication for HTTPS connections.");
+
+    public static final Option<String> KEY_MANAGER_PASSWORD =

Review Comment:
   unused this field `KEY_MANAGER_PASSWORD`



##########
seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/server/HttpConfig.java:
##########
@@ -35,9 +36,23 @@ public class HttpConfig implements Serializable {
     private boolean enableDynamicPort = ServerConfigOptions.ENABLE_DYNAMIC_PORT.defaultValue();
 
     private int portRange = ServerConfigOptions.PORT_RANGE.defaultValue();
+    private boolean requireClientAuth = ServerConfigOptions.REQUIRE_CLIENT_AUTH.defaultValue();

Review Comment:
   unused this field `requireClientAuth`



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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on code in PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#discussion_r1959008138


##########
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/RestApiHttpsIT.java:
##########
@@ -0,0 +1,226 @@
+/*
+ * 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.seatunnel.engine.e2e;
+
+import org.apache.seatunnel.engine.client.SeaTunnelClient;
+import org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment;
+import org.apache.seatunnel.engine.client.job.ClientJobProxy;
+import org.apache.seatunnel.engine.common.config.ConfigProvider;
+import org.apache.seatunnel.engine.common.config.JobConfig;
+import org.apache.seatunnel.engine.common.config.SeaTunnelConfig;
+import org.apache.seatunnel.engine.core.job.JobStatus;
+import org.apache.seatunnel.engine.e2e.DummySSLUtil.DummySSLStores;
+import org.apache.seatunnel.engine.server.SeaTunnelServerStarter;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LoggerContext;
+
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import com.hazelcast.client.config.ClientConfig;
+import com.hazelcast.config.Config;
+import com.hazelcast.config.MemberAttributeConfig;
+import com.hazelcast.instance.impl.HazelcastInstanceImpl;
+import lombok.extern.slf4j.Slf4j;
+
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import static io.restassured.RestAssured.given;
+import static org.apache.seatunnel.e2e.common.util.ContainerUtil.PROJECT_ROOT_PATH;
+import static org.hamcrest.Matchers.containsString;
+
+@Slf4j
+public class RestApiHttpsIT {

Review Comment:
   I think we can do some refactoring, such as constructing an `AbstractRestAPIIT` (move some common code from `RestApiIT`). Then implement `RestApiHttpIT` and `RestApiHttpsIT` both, so that we can verify all functions instead of just getting the UI.



##########
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/pom.xml:
##########
@@ -34,6 +34,24 @@
     </properties>
 
     <dependencies>
+        <!-- https://mvnrepository.com/artifact/org.bouncycastle/bcprov-jdk15on -->
+
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk18on</artifactId>
+            <version>1.78</version>
+            <!-- or the latest version -->
+        </dependency>
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcpkix-jdk18on</artifactId>
+            <version>1.78</version>
+        </dependency>
+        <dependency>
+            <groupId>org.bouncycastle</groupId>
+            <artifactId>bcprov-jdk18on</artifactId>
+            <version>1.78</version>
+        </dependency>

Review Comment:
   ```suggestion
           <dependency>
               <groupId>org.bouncycastle</groupId>
               <artifactId>bcprov-jdk18on</artifactId>
               <version>1.78</version>
               <!-- or the latest version -->
           </dependency>
           <dependency>
               <groupId>org.bouncycastle</groupId>
               <artifactId>bcpkix-jdk18on</artifactId>
               <version>1.78</version>
           </dependency>
   ```



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/JettyService.java:
##########
@@ -88,14 +94,63 @@ public class JettyService {
     public JettyService(NodeEngineImpl nodeEngine, SeaTunnelConfig seaTunnelConfig) {
         this.nodeEngine = nodeEngine;
         this.seaTunnelConfig = seaTunnelConfig;
+        this.server = new Server();
+        configureServer();
+    }
+
+    private void configureServer() {

Review Comment:
   So we don't support enable https and http at same time. Please add verify to make sure user not open https/http both in config.



##########
docs/en/seatunnel-engine/rest-api-v2.md:
##########
@@ -36,7 +36,39 @@ seatunnel:
       port: 8080
       context-path: /seatunnel
 ```
+#### HTTPS
+Https can also be configured as follows:
 
+```yaml
+
+seatunnel:
+  engine:
+    http:
+      enable-http: true
+      port: 8080
+      enable-https: true
+      https-port: 8443
+      keystore: /path/to/file.keystore
+      keystore-password: keystore_password
+      key-password: key_password
+```
+For optional:Two-way authentication can also be configured as follows:
+
+```yaml
+
+seatunnel:
+  engine:
+    http:
+      enable-http: true

Review Comment:
   ```suggestion
         enable-http: false
   ```



##########
docs/en/seatunnel-engine/rest-api-v2.md:
##########
@@ -36,7 +36,39 @@ seatunnel:
       port: 8080
       context-path: /seatunnel
 ```
+#### HTTPS
+Https can also be configured as follows:
 
+```yaml
+
+seatunnel:
+  engine:
+    http:
+      enable-http: true

Review Comment:
   ```suggestion
         enable-http: false
   ```



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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#issuecomment-3076359477

   This pull request has been automatically marked as stale because it has not had recent activity for 120 days. It will be closed in 7 days if no further activity occurs.


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#issuecomment-2727857739

   Hi @akulabs8 , why close this PR?


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on code in PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#discussion_r1959605661


##########
seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/server/HttpConfig.java:
##########
@@ -35,9 +36,23 @@ public class HttpConfig implements Serializable {
     private boolean enableDynamicPort = ServerConfigOptions.ENABLE_DYNAMIC_PORT.defaultValue();
 
     private int portRange = ServerConfigOptions.PORT_RANGE.defaultValue();
+    private boolean requireClientAuth = ServerConfigOptions.REQUIRE_CLIENT_AUTH.defaultValue();

Review Comment:
   remove ?



##########
seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/server/ServerConfigOptions.java:
##########
@@ -300,6 +300,61 @@ public class ServerConfigOptions {
                     .defaultValue(100)
                     .withDescription(
                             "The port range of the http server. If enable-dynamic-port is true, We will use the unused port in the range");
+    // New HTTPS configurations
+    public static final Option<Integer> HTTPS_PORT =
+            Options.key("https-port")
+                    .intType()
+                    .defaultValue(8443)
+                    .withDescription("The port used for HTTPS communication.");
+
+    public static final Option<Boolean> ENABLE_HTTPS =
+            Options.key("enable-https")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription("Whether to enable HTTPS.");
+
+    public static final Option<String> KEYSTORE =
+            Options.key("keystore")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The file path of the keystore for HTTPS.");
+
+    public static final Option<String> KEYSTORE_PASSWORD =
+            Options.key("keystore-password")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The password for the keystore.");
+
+    public static final Option<String> KEY_PASSWORD =
+            Options.key("key-password")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The password for the key in the keystore.");
+
+    public static final Option<Boolean> REQUIRE_CLIENT_AUTH =

Review Comment:
   remove?



##########
seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/JettyService.java:
##########
@@ -88,14 +94,63 @@ public class JettyService {
     public JettyService(NodeEngineImpl nodeEngine, SeaTunnelConfig seaTunnelConfig) {
         this.nodeEngine = nodeEngine;
         this.seaTunnelConfig = seaTunnelConfig;
+        this.server = new Server();
+        configureServer();
+    }
+
+    private void configureServer() {
+        if (seaTunnelConfig.getEngineConfig().getHttpConfig().isEnableHttps()) {
+            configureHttps();
+        } else {
+            configureHttp();
+        }
+    }
+
+    private void configureHttp() {
         int port = seaTunnelConfig.getEngineConfig().getHttpConfig().getPort();
         if (seaTunnelConfig.getEngineConfig().getHttpConfig().isEnableDynamicPort()) {
             port =
                     chooseAppropriatePort(
                             port, seaTunnelConfig.getEngineConfig().getHttpConfig().getPortRange());
         }
-        log.info("SeaTunnel REST service will start on port {}", port);
-        this.server = new Server(port);
+        ServerConnector httpConnector = new ServerConnector(server);
+        httpConnector.setPort(port);
+        server.addConnector(httpConnector);
+        log.info("SeaTunnel REST service will start on HTTP port {}", port);
+    }
+
+    private void configureHttps() {
+        // Create and configure the SSL context factory
+        SslContextFactory.Server sslContextFactory = new SslContextFactory.Server();
+        sslContextFactory.setKeyStorePath(
+                seaTunnelConfig.getEngineConfig().getHttpConfig().getKeystore());
+        sslContextFactory.setKeyStorePassword(
+                seaTunnelConfig.getEngineConfig().getHttpConfig().getKeystorePassword());
+        sslContextFactory.setKeyManagerPassword(
+                seaTunnelConfig.getEngineConfig().getHttpConfig().getKeyPassword());
+
+        if (seaTunnelConfig.getEngineConfig().getHttpConfig().isTwoWayAuthEnabled()) {
+            sslContextFactory.setTrustStorePath(

Review Comment:
   ```suggestion
               sslContextFactory.setNeedClientAuth(true);
               sslContextFactory.setTrustStorePath(
   ```



##########
seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/server/ServerConfigOptions.java:
##########
@@ -300,6 +300,61 @@ public class ServerConfigOptions {
                     .defaultValue(100)
                     .withDescription(
                             "The port range of the http server. If enable-dynamic-port is true, We will use the unused port in the range");
+    // New HTTPS configurations
+    public static final Option<Integer> HTTPS_PORT =
+            Options.key("https-port")
+                    .intType()
+                    .defaultValue(8443)
+                    .withDescription("The port used for HTTPS communication.");
+
+    public static final Option<Boolean> ENABLE_HTTPS =
+            Options.key("enable-https")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription("Whether to enable HTTPS.");
+
+    public static final Option<String> KEYSTORE =
+            Options.key("keystore")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The file path of the keystore for HTTPS.");
+
+    public static final Option<String> KEYSTORE_PASSWORD =
+            Options.key("keystore-password")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The password for the keystore.");
+
+    public static final Option<String> KEY_PASSWORD =
+            Options.key("key-password")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The password for the key in the keystore.");
+
+    public static final Option<Boolean> REQUIRE_CLIENT_AUTH =
+            Options.key("require-client-auth")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Whether to require client authentication for HTTPS connections.");
+
+    public static final Option<String> KEY_MANAGER_PASSWORD =

Review Comment:
   remove?



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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#issuecomment-2658093787

   close duplicate PR ?https://github.com/apache/seatunnel/pull/8599


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #8698: [Feature]Support enable https protocol for rest-api v2
URL: https://github.com/apache/seatunnel/pull/8698


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "hailin0 (via GitHub)" <gi...@apache.org>.
hailin0 commented on code in PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#discussion_r1959585009


##########
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/RestApiHttpsIT.java:
##########
@@ -0,0 +1,226 @@
+/*
+ * 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.seatunnel.engine.e2e;
+
+import org.apache.seatunnel.engine.client.SeaTunnelClient;
+import org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment;
+import org.apache.seatunnel.engine.client.job.ClientJobProxy;
+import org.apache.seatunnel.engine.common.config.ConfigProvider;
+import org.apache.seatunnel.engine.common.config.JobConfig;
+import org.apache.seatunnel.engine.common.config.SeaTunnelConfig;
+import org.apache.seatunnel.engine.core.job.JobStatus;
+import org.apache.seatunnel.engine.e2e.DummySSLUtil.DummySSLStores;
+import org.apache.seatunnel.engine.server.SeaTunnelServerStarter;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LoggerContext;
+
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import com.hazelcast.client.config.ClientConfig;
+import com.hazelcast.config.Config;
+import com.hazelcast.config.MemberAttributeConfig;
+import com.hazelcast.instance.impl.HazelcastInstanceImpl;
+import lombok.extern.slf4j.Slf4j;
+
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import static io.restassured.RestAssured.given;
+import static org.apache.seatunnel.e2e.common.util.ContainerUtil.PROJECT_ROOT_PATH;
+import static org.hamcrest.Matchers.containsString;
+
+@Slf4j
+public class RestApiHttpsIT {
+
+    private static final String HOST = "http://localhost:";
+
+    private static ClientJobProxy clientJobProxy;
+    private static ClientJobProxy batchJobProxy;
+    private static HazelcastInstanceImpl node1;
+    private static HazelcastInstanceImpl node2;
+    private static SeaTunnelClient engineClient;
+    private static SeaTunnelConfig node1Config;
+    private static SeaTunnelConfig node2Config;
+    private static Map<Integer, Integer> ports;
+
+    // Dummy SSL stores for the server and client.
+    private static DummySSLStores serverStores;
+    private static DummySSLStores clientStores;
+
+    @BeforeEach
+    void beforeClass() throws Exception {
+        // Set up logging configuration.
+        LoggerContext context = (LoggerContext) LogManager.getContext(false);
+        context.setConfigLocation(
+                Paths.get(
+                                PROJECT_ROOT_PATH
+                                        + "/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/resources/job-log-file/log4j2.properties")
+                        .toUri());
+
+        String testClusterName = TestUtils.getClusterName("RestApiHttpsIT");
+        node1Config = ConfigProvider.locateAndGetSeaTunnelConfig();
+        node1Config.getHazelcastConfig().setClusterName(testClusterName);
+        node1Config.getEngineConfig().getSlotServiceConfig().setDynamicSlot(false);
+
+        // Generate dummy SSL stores.
+        serverStores = DummySSLUtil.generateDummySSLStores();
+        clientStores = DummySSLUtil.generateDummySSLStores();
+
+        // Configure node1 for HTTPS with two‑way SSL.
+        node1Config.getEngineConfig().getHttpConfig().setHttpsPort(9443);
+        node1Config.getEngineConfig().getHttpConfig().setEnableHttps(true);
+        node1Config.getEngineConfig().getHttpConfig().setKeystore(serverStores.keystorePath);
+        node1Config.getEngineConfig().getHttpConfig().setKeystorePassword("changeit");
+        node1Config.getEngineConfig().getHttpConfig().setKeyPassword("changeit");
+        // Set truststore so that the server trusts client certificates.
+        node1Config.getEngineConfig().getHttpConfig().setTruststore(clientStores.truststorePath);
+        node1Config.getEngineConfig().getHttpConfig().setTruststorePassword("changeit");
+
+        node1Config.getEngineConfig().getSlotServiceConfig().setSlotNum(20);
+        MemberAttributeConfig node1Tags = new MemberAttributeConfig();
+        node1Tags.setAttribute("node", "node1");
+        node1Config.getHazelcastConfig().setMemberAttributeConfig(node1Tags);
+        node1 = SeaTunnelServerStarter.createHazelcastInstance(node1Config);
+
+        // Configure node2 similarly.
+        MemberAttributeConfig node2Tags = new MemberAttributeConfig();
+        node2Tags.setAttribute("node", "node2");
+        Config node2hzconfig = node1Config.getHazelcastConfig().setMemberAttributeConfig(node2Tags);
+        node2Config = ConfigProvider.locateAndGetSeaTunnelConfig();
+        node2Config
+                .getEngineConfig()
+                .getHttpConfig()
+                .setHttpsPort(9443); // or use a different port if desired
+        node2Config.getEngineConfig().getHttpConfig().setEnableHttps(true);
+        node2Config.getEngineConfig().getHttpConfig().setKeystore(serverStores.keystorePath);
+        node2Config.getEngineConfig().getHttpConfig().setKeystorePassword("changeit");
+        node2Config.getEngineConfig().getHttpConfig().setKeyPassword("changeit");
+        node2Config.getEngineConfig().getHttpConfig().setTruststore(clientStores.truststorePath);
+        node2Config.getEngineConfig().getHttpConfig().setTruststorePassword("changeit");
+        node2Config.getEngineConfig().getSlotServiceConfig().setSlotNum(20);
+        node2Config.setHazelcastConfig(node2hzconfig);
+        node2 = SeaTunnelServerStarter.createHazelcastInstance(node2Config);
+
+        // Submit a streaming job.
+        String filePath = TestUtils.getResource("stream_fakesource_to_file.conf");
+        JobConfig jobConfig = new JobConfig();
+        jobConfig.setName("fake_to_file");
+        ClientConfig clientConfig = ConfigProvider.locateAndGetClientConfig();
+        clientConfig.setClusterName(testClusterName);
+        engineClient = new SeaTunnelClient(clientConfig);
+        ClientJobExecutionEnvironment jobExecutionEnv =
+                engineClient.createExecutionContext(filePath, jobConfig, node1Config);
+        clientJobProxy = jobExecutionEnv.execute();
+        Awaitility.await()
+                .atMost(2, TimeUnit.MINUTES)
+                .untilAsserted(
+                        () ->
+                                Assertions.assertEquals(
+                                        JobStatus.RUNNING, clientJobProxy.getJobStatus()));
+
+        // Submit a batch job.
+        String batchFilePath = TestUtils.getResource("fakesource_to_console.conf");
+        JobConfig batchConf = new JobConfig();
+        batchConf.setName("fake_to_console");
+        ClientJobExecutionEnvironment batchJobExecutionEnv =
+                engineClient.createExecutionContext(batchFilePath, batchConf, node1Config);
+        batchJobProxy = batchJobExecutionEnv.execute();
+        Awaitility.await()
+                .atMost(5, TimeUnit.MINUTES)
+                .untilAsserted(
+                        () ->
+                                Assertions.assertEquals(
+                                        JobStatus.FINISHED, batchJobProxy.getJobStatus()));
+
+        // Map Hazelcast member ports to HTTP ports.
+        ports = new HashMap<>();
+        ports.put(
+                node1.getCluster().getLocalMember().getAddress().getPort(),
+                node1Config.getEngineConfig().getHttpConfig().getHttpsPort());
+        ports.put(
+                node2.getCluster().getLocalMember().getAddress().getPort(),
+                node2Config.getEngineConfig().getHttpConfig().getHttpsPort());
+    }
+
+    // One-way SSL: client does not present its certificate.
+    @Test
+    public void testHttpsOneWayAuthentication() {
+        ports.forEach(
+                (memberPort, httpPort) -> {
+                    given().relaxedHTTPSValidation() // Allow self-signed certs.
+                            .when()
+                            .get(
+                                    "https://localhost:"
+                                            + httpPort
+                                            + node1Config
+                                                    .getEngineConfig()
+                                                    .getHttpConfig()
+                                                    .getContextPath())
+                            .then()
+                            .statusCode(200)
+                            .contentType(containsString("text/html"))
+                            .body(containsString("<html"))
+                            .body(containsString("<title>Seatunnel Engine UI</title>"));
+                });
+    }
+
+    // Two-way SSL: client presents its certificate.
+    @Test
+    public void testHttpsTwoWayAuthentication() {

Review Comment:
   ```suggestion
       public void testHttpsTwoWayAuthenticationSuccess() {
   ```



##########
seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/java/org/apache/seatunnel/engine/e2e/RestApiHttpsIT.java:
##########
@@ -0,0 +1,226 @@
+/*
+ * 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.seatunnel.engine.e2e;
+
+import org.apache.seatunnel.engine.client.SeaTunnelClient;
+import org.apache.seatunnel.engine.client.job.ClientJobExecutionEnvironment;
+import org.apache.seatunnel.engine.client.job.ClientJobProxy;
+import org.apache.seatunnel.engine.common.config.ConfigProvider;
+import org.apache.seatunnel.engine.common.config.JobConfig;
+import org.apache.seatunnel.engine.common.config.SeaTunnelConfig;
+import org.apache.seatunnel.engine.core.job.JobStatus;
+import org.apache.seatunnel.engine.e2e.DummySSLUtil.DummySSLStores;
+import org.apache.seatunnel.engine.server.SeaTunnelServerStarter;
+
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.LoggerContext;
+
+import org.awaitility.Awaitility;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.Assertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+
+import com.hazelcast.client.config.ClientConfig;
+import com.hazelcast.config.Config;
+import com.hazelcast.config.MemberAttributeConfig;
+import com.hazelcast.instance.impl.HazelcastInstanceImpl;
+import lombok.extern.slf4j.Slf4j;
+
+import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+import static io.restassured.RestAssured.given;
+import static org.apache.seatunnel.e2e.common.util.ContainerUtil.PROJECT_ROOT_PATH;
+import static org.hamcrest.Matchers.containsString;
+
+@Slf4j
+public class RestApiHttpsIT {
+
+    private static final String HOST = "http://localhost:";
+
+    private static ClientJobProxy clientJobProxy;
+    private static ClientJobProxy batchJobProxy;
+    private static HazelcastInstanceImpl node1;
+    private static HazelcastInstanceImpl node2;
+    private static SeaTunnelClient engineClient;
+    private static SeaTunnelConfig node1Config;
+    private static SeaTunnelConfig node2Config;
+    private static Map<Integer, Integer> ports;
+
+    // Dummy SSL stores for the server and client.
+    private static DummySSLStores serverStores;
+    private static DummySSLStores clientStores;
+
+    @BeforeEach
+    void beforeClass() throws Exception {
+        // Set up logging configuration.
+        LoggerContext context = (LoggerContext) LogManager.getContext(false);
+        context.setConfigLocation(
+                Paths.get(
+                                PROJECT_ROOT_PATH
+                                        + "/seatunnel-e2e/seatunnel-engine-e2e/connector-seatunnel-e2e-base/src/test/resources/job-log-file/log4j2.properties")
+                        .toUri());
+
+        String testClusterName = TestUtils.getClusterName("RestApiHttpsIT");
+        node1Config = ConfigProvider.locateAndGetSeaTunnelConfig();
+        node1Config.getHazelcastConfig().setClusterName(testClusterName);
+        node1Config.getEngineConfig().getSlotServiceConfig().setDynamicSlot(false);
+
+        // Generate dummy SSL stores.
+        serverStores = DummySSLUtil.generateDummySSLStores();
+        clientStores = DummySSLUtil.generateDummySSLStores();
+
+        // Configure node1 for HTTPS with two‑way SSL.
+        node1Config.getEngineConfig().getHttpConfig().setHttpsPort(9443);
+        node1Config.getEngineConfig().getHttpConfig().setEnableHttps(true);
+        node1Config.getEngineConfig().getHttpConfig().setKeystore(serverStores.keystorePath);
+        node1Config.getEngineConfig().getHttpConfig().setKeystorePassword("changeit");
+        node1Config.getEngineConfig().getHttpConfig().setKeyPassword("changeit");
+        // Set truststore so that the server trusts client certificates.
+        node1Config.getEngineConfig().getHttpConfig().setTruststore(clientStores.truststorePath);
+        node1Config.getEngineConfig().getHttpConfig().setTruststorePassword("changeit");
+
+        node1Config.getEngineConfig().getSlotServiceConfig().setSlotNum(20);
+        MemberAttributeConfig node1Tags = new MemberAttributeConfig();
+        node1Tags.setAttribute("node", "node1");
+        node1Config.getHazelcastConfig().setMemberAttributeConfig(node1Tags);
+        node1 = SeaTunnelServerStarter.createHazelcastInstance(node1Config);
+
+        // Configure node2 similarly.
+        MemberAttributeConfig node2Tags = new MemberAttributeConfig();
+        node2Tags.setAttribute("node", "node2");
+        Config node2hzconfig = node1Config.getHazelcastConfig().setMemberAttributeConfig(node2Tags);
+        node2Config = ConfigProvider.locateAndGetSeaTunnelConfig();
+        node2Config
+                .getEngineConfig()
+                .getHttpConfig()
+                .setHttpsPort(9443); // or use a different port if desired
+        node2Config.getEngineConfig().getHttpConfig().setEnableHttps(true);
+        node2Config.getEngineConfig().getHttpConfig().setKeystore(serverStores.keystorePath);
+        node2Config.getEngineConfig().getHttpConfig().setKeystorePassword("changeit");
+        node2Config.getEngineConfig().getHttpConfig().setKeyPassword("changeit");
+        node2Config.getEngineConfig().getHttpConfig().setTruststore(clientStores.truststorePath);
+        node2Config.getEngineConfig().getHttpConfig().setTruststorePassword("changeit");
+        node2Config.getEngineConfig().getSlotServiceConfig().setSlotNum(20);
+        node2Config.setHazelcastConfig(node2hzconfig);
+        node2 = SeaTunnelServerStarter.createHazelcastInstance(node2Config);
+
+        // Submit a streaming job.
+        String filePath = TestUtils.getResource("stream_fakesource_to_file.conf");
+        JobConfig jobConfig = new JobConfig();
+        jobConfig.setName("fake_to_file");
+        ClientConfig clientConfig = ConfigProvider.locateAndGetClientConfig();
+        clientConfig.setClusterName(testClusterName);
+        engineClient = new SeaTunnelClient(clientConfig);
+        ClientJobExecutionEnvironment jobExecutionEnv =
+                engineClient.createExecutionContext(filePath, jobConfig, node1Config);
+        clientJobProxy = jobExecutionEnv.execute();
+        Awaitility.await()
+                .atMost(2, TimeUnit.MINUTES)
+                .untilAsserted(
+                        () ->
+                                Assertions.assertEquals(
+                                        JobStatus.RUNNING, clientJobProxy.getJobStatus()));
+
+        // Submit a batch job.
+        String batchFilePath = TestUtils.getResource("fakesource_to_console.conf");
+        JobConfig batchConf = new JobConfig();
+        batchConf.setName("fake_to_console");
+        ClientJobExecutionEnvironment batchJobExecutionEnv =
+                engineClient.createExecutionContext(batchFilePath, batchConf, node1Config);
+        batchJobProxy = batchJobExecutionEnv.execute();
+        Awaitility.await()
+                .atMost(5, TimeUnit.MINUTES)
+                .untilAsserted(
+                        () ->
+                                Assertions.assertEquals(
+                                        JobStatus.FINISHED, batchJobProxy.getJobStatus()));
+
+        // Map Hazelcast member ports to HTTP ports.
+        ports = new HashMap<>();
+        ports.put(
+                node1.getCluster().getLocalMember().getAddress().getPort(),
+                node1Config.getEngineConfig().getHttpConfig().getHttpsPort());
+        ports.put(
+                node2.getCluster().getLocalMember().getAddress().getPort(),
+                node2Config.getEngineConfig().getHttpConfig().getHttpsPort());
+    }
+
+    // One-way SSL: client does not present its certificate.
+    @Test
+    public void testHttpsOneWayAuthentication() {
+        ports.forEach(
+                (memberPort, httpPort) -> {
+                    given().relaxedHTTPSValidation() // Allow self-signed certs.
+                            .when()
+                            .get(
+                                    "https://localhost:"
+                                            + httpPort
+                                            + node1Config
+                                                    .getEngineConfig()
+                                                    .getHttpConfig()
+                                                    .getContextPath())
+                            .then()
+                            .statusCode(200)
+                            .contentType(containsString("text/html"))
+                            .body(containsString("<html"))
+                            .body(containsString("<title>Seatunnel Engine UI</title>"));
+                });
+    }
+
+    // Two-way SSL: client presents its certificate.
+    @Test
+    public void testHttpsTwoWayAuthentication() {

Review Comment:
   add method `testHttpsTwoWayAuthenticationFailed`



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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "akulabs8 (via GitHub)" <gi...@apache.org>.
akulabs8 closed pull request #8698: [Feature]Support enable https protocol for rest-api v2
URL: https://github.com/apache/seatunnel/pull/8698


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "akulabs8 (via GitHub)" <gi...@apache.org>.
akulabs8 commented on PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#issuecomment-2660296462

   @hailin0 
   I have a question, for testing i will need some keystore or truststore value as well.. right? how to go about that, any suggestion? 
   
   and what exactly do I have to do for 'Adapt UI' part?


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "Hisoka-X (via GitHub)" <gi...@apache.org>.
Hisoka-X commented on PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#issuecomment-2661849046

   > for testing i will need some keystore or truststore value as well
   
   You can generate it by java code. It is easier to maintain.
   
   > what exactly do I have to do for 'Adapt UI' part
   
   Add IT to make sure when use open https port, the UI can get information from server with https port not http port.


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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Feature]Support enable https protocol for rest-api v2 [seatunnel]

Posted by "akulabs8 (via GitHub)" <gi...@apache.org>.
akulabs8 commented on code in PR #8698:
URL: https://github.com/apache/seatunnel/pull/8698#discussion_r1960242464


##########
seatunnel-engine/seatunnel-engine-common/src/main/java/org/apache/seatunnel/engine/common/config/server/ServerConfigOptions.java:
##########
@@ -300,6 +300,61 @@ public class ServerConfigOptions {
                     .defaultValue(100)
                     .withDescription(
                             "The port range of the http server. If enable-dynamic-port is true, We will use the unused port in the range");
+    // New HTTPS configurations
+    public static final Option<Integer> HTTPS_PORT =
+            Options.key("https-port")
+                    .intType()
+                    .defaultValue(8443)
+                    .withDescription("The port used for HTTPS communication.");
+
+    public static final Option<Boolean> ENABLE_HTTPS =
+            Options.key("enable-https")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription("Whether to enable HTTPS.");
+
+    public static final Option<String> KEYSTORE =
+            Options.key("keystore")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The file path of the keystore for HTTPS.");
+
+    public static final Option<String> KEYSTORE_PASSWORD =
+            Options.key("keystore-password")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The password for the keystore.");
+
+    public static final Option<String> KEY_PASSWORD =
+            Options.key("key-password")
+                    .stringType()
+                    .defaultValue("")
+                    .withDescription("The password for the key in the keystore.");
+
+    public static final Option<Boolean> REQUIRE_CLIENT_AUTH =
+            Options.key("require-client-auth")
+                    .booleanType()
+                    .defaultValue(false)
+                    .withDescription(
+                            "Whether to require client authentication for HTTPS connections.");
+
+    public static final Option<String> KEY_MANAGER_PASSWORD =

Review Comment:
   what exactly you mean? you want this to be removed?



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

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org