This is an automated email from the ASF dual-hosted git repository. jimin pushed a commit to branch 2.3.0 in repository https://gitbox.apache.org/repos/asf/incubator-seata.git
The following commit(s) were added to refs/heads/2.3.0 by this push: new 9b748f188c bugfix: prefix: [seata.server.raft.ssl] should not be null (#7117) 9b748f188c is described below commit 9b748f188c4d856d955798ae16007739bffc600c Author: funkye <jian...@apache.org> AuthorDate: Thu Jan 16 15:12:04 2025 +0800 bugfix: prefix: [seata.server.raft.ssl] should not be null (#7117) --- changes/en-us/2.3.0.md | 3 +- changes/zh-cn/2.3.0.md | 2 + .../org/apache/seata/common/ConfigurationKeys.java | 27 +++- .../boot/autoconfigure/StarterConstants.java | 3 + .../SeataServerEnvironmentPostProcessor.java | 11 +- .../server/raft/ServerRaftProperties.java | 180 +++++++++++++++++++++ .../server/raft/ServerRaftSSLClientProperties.java | 57 +++++++ .../server/raft/ServerRaftSSLProperties.java | 57 +++++++ .../server/raft/ServerRaftSSLServerProperties.java | 57 +++++++ .../server/ServerRaftPropertiesTest.java | 1 + .../seata/server/cluster/raft/RaftServer.java | 10 +- .../main/resources/application.raft.example.yml | 10 +- .../apache/seata/server/raft/RaftServerTest.java | 13 ++ 13 files changed, 416 insertions(+), 15 deletions(-) diff --git a/changes/en-us/2.3.0.md b/changes/en-us/2.3.0.md index a345f932ec..97362aaed4 100644 --- a/changes/en-us/2.3.0.md +++ b/changes/en-us/2.3.0.md @@ -49,7 +49,8 @@ The version is updated as follows: in `application.raft.example.yml` - [[#7025](https://github.com/apache/incubator-seata/pull/7025)] fix vGroupMappingManager is NOT init - [[#7044](https://github.com/apache/incubator-seata/pull/7044)] fix tableMeta refresh after closed -- +- [[#7117](https://github.com/apache/incubator-seata/pull/7117)] fix prefix: seata.server.raft.ssl should not be null + ### optimize: diff --git a/changes/zh-cn/2.3.0.md b/changes/zh-cn/2.3.0.md index 14b0593975..2ba0fb9e60 100644 --- a/changes/zh-cn/2.3.0.md +++ b/changes/zh-cn/2.3.0.md @@ -42,6 +42,8 @@ Apache Seata(incubating) 是一款开源的分布式事务解决方案,提供 - [[#7022](https://github.com/apache/incubator-seata/pull/7022)] 修复 `application.raft.example.yml`的 `store.mode`属性 - [[#7025](https://github.com/apache/incubator-seata/pull/7025)] 修复vGroupMappingManager未初始化的问题 - [[#7044](https://github.com/apache/incubator-seata/pull/7044)] 修复TableMeta在数据源关闭后刷新错误问题 +- [[#7117](https://github.com/apache/incubator-seata/pull/7117)] 修复 seata.server.raft.ssl 前缀不存在的问题 + ### optimize: diff --git a/common/src/main/java/org/apache/seata/common/ConfigurationKeys.java b/common/src/main/java/org/apache/seata/common/ConfigurationKeys.java index 840e029800..297d64167b 100644 --- a/common/src/main/java/org/apache/seata/common/ConfigurationKeys.java +++ b/common/src/main/java/org/apache/seata/common/ConfigurationKeys.java @@ -966,14 +966,24 @@ public interface ConfigurationKeys { /** - * The constant SERVER_RAFT_SSL_KEYSTORE_TYPE. + * The constant SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE. */ - String SERVER_RAFT_SSL_KEYSTORE_TYPE = SERVER_RAFT_SSL + "keystore.type"; + String SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE = SERVER_RAFT_SSL_CLIENT + "keystore.type"; + + /** + * The constant SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE. + */ + String SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE = SERVER_RAFT_SSL_SERVER + "keystore.type"; + + /** + * The constant SERVER_RAFT_SSL_KMF_ALGORITHM. + */ + String SERVER_RAFT_SSL_KMF_ALGORITHM = SERVER_RAFT_SSL + "kmfAlgorithm"; /** * The constant SERVER_RAFT_SSL_KMF_ALGORITHM. */ - String SERVER_RAFT_SSL_KMF_ALGORITHM = SERVER_RAFT_SSL + "kmf.algorithm"; + String SERVER_RAFT_SSL_TMF_ALGORITHM = SERVER_RAFT_SSL + "tmfAlgorithm"; /** * The constant SERVER_RAFT_MAX_APPEND_BUFFER_SIZE. @@ -1110,4 +1120,15 @@ public interface ConfigurationKeys { * The constant META_PREFIX */ String META_PREFIX = SEATA_FILE_ROOT_CONFIG + FILE_CONFIG_SPLIT_CHAR + FILE_ROOT_REGISTRY + FILE_CONFIG_SPLIT_CHAR + "metadata."; + + /** + * The constant SERVER_REGISTRY_METADATA_PREFIX + */ + String SERVER_REGISTRY_METADATA_PREFIX = SERVER_PREFIX + FILE_ROOT_REGISTRY + ".metadata"; + + /** + * The constant SERVER_REGISTRY_METADATA_EXTERNAL + */ + String SERVER_REGISTRY_METADATA_EXTERNAL = SERVER_REGISTRY_METADATA_PREFIX + ".external"; + } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/org/apache/seata/spring/boot/autoconfigure/StarterConstants.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/org/apache/seata/spring/boot/autoconfigure/StarterConstants.java index 5ec088d43f..8ed113a011 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/org/apache/seata/spring/boot/autoconfigure/StarterConstants.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-core/src/main/java/org/apache/seata/spring/boot/autoconfigure/StarterConstants.java @@ -71,6 +71,9 @@ public interface StarterConstants { String SERVER_PREFIX = SEATA_PREFIX + ".server"; String SERVER_UNDO_PREFIX = SERVER_PREFIX + ".undo"; String SERVER_RAFT_PREFIX = SERVER_PREFIX + ".raft"; + String SERVER_RAFT_SSL_PREFIX = SERVER_RAFT_PREFIX + ".ssl"; + String SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX = SERVER_RAFT_SSL_PREFIX + ".client.keystore"; + String SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX = SERVER_RAFT_SSL_PREFIX + ".server.keystore"; String SERVER_RECOVERY_PREFIX = SERVER_PREFIX + ".recovery"; String METRICS_PREFIX = SEATA_PREFIX + ".metrics"; diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/SeataServerEnvironmentPostProcessor.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/SeataServerEnvironmentPostProcessor.java index 9749a003d8..f20268cf0d 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/SeataServerEnvironmentPostProcessor.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/SeataServerEnvironmentPostProcessor.java @@ -17,10 +17,13 @@ package org.apache.seata.spring.boot.autoconfigure; import java.util.concurrent.atomic.AtomicBoolean; +import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLClientProperties; +import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLProperties; +import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftSSLServerProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.store.StoreProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.MetricsProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerProperties; -import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerRaftProperties; +import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerRecoveryProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.ServerUndoProperties; import org.apache.seata.spring.boot.autoconfigure.properties.server.session.SessionProperties; @@ -38,6 +41,9 @@ import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.METRIC import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.PROPERTY_BEAN_MAP; import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_PREFIX; import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_PREFIX; +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX; +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_PREFIX; +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX; import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RECOVERY_PREFIX; import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_UNDO_PREFIX; import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SESSION_PREFIX; @@ -79,6 +85,9 @@ public class SeataServerEnvironmentPostProcessor implements EnvironmentPostProce PROPERTY_BEAN_MAP.put(STORE_REDIS_SINGLE_PREFIX, StoreRedisProperties.Single.class); PROPERTY_BEAN_MAP.put(STORE_REDIS_SENTINEL_PREFIX, StoreRedisProperties.Sentinel.class); PROPERTY_BEAN_MAP.put(SERVER_RAFT_PREFIX, ServerRaftProperties.class); + PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX, ServerRaftSSLServerProperties.class); + PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_PREFIX, ServerRaftSSLProperties.class); + PROPERTY_BEAN_MAP.put(SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX, ServerRaftSSLClientProperties.class); PROPERTY_BEAN_MAP.put(SESSION_PREFIX, SessionProperties.class); PROPERTY_BEAN_MAP.put(STORE_PREFIX, StoreProperties.class); } diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftProperties.java new file mode 100644 index 0000000000..4a3c3649b4 --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftProperties.java @@ -0,0 +1,180 @@ +/* + * 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.seata.spring.boot.autoconfigure.properties.server.raft; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + + +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_PREFIX; + + +@Component +@ConfigurationProperties(prefix = SERVER_RAFT_PREFIX) +public class ServerRaftProperties { + + private String serverAddr; + + private String group; + + private Boolean autoJoin = false; + + private Integer snapshotInterval = 600; + + private Integer applyBatch = 32; + + private Integer maxAppendBufferSize = 256 * 1024; + + private Integer maxReplicatorInflightMsgs = 256; + + private Integer disruptorBufferSize = 16384; + + private Integer electionTimeoutMs = 1000; + + private boolean reporterEnabled = false; + + private Integer reporterInitialDelay = 60; + + private String serialization = "jackson"; + + private String compressor = "none"; + + private boolean sync = true; + + public String getServerAddr() { + return serverAddr; + } + + public ServerRaftProperties setServerAddr(String serverAddr) { + this.serverAddr = serverAddr; + return this; + } + + public Integer getSnapshotInterval() { + return snapshotInterval; + } + + public ServerRaftProperties setSnapshotInterval(Integer snapshotInterval) { + this.snapshotInterval = snapshotInterval; + return this; + } + + public Integer getApplyBatch() { + return applyBatch; + } + + public ServerRaftProperties setApplyBatch(Integer applyBatch) { + this.applyBatch = applyBatch; + return this; + } + + public Integer getMaxAppendBufferSize() { + return maxAppendBufferSize; + } + + public ServerRaftProperties setMaxAppendBufferSize(Integer maxAppendBufferSize) { + this.maxAppendBufferSize = maxAppendBufferSize; + return this; + } + + public Integer getMaxReplicatorInflightMsgs() { + return maxReplicatorInflightMsgs; + } + + public ServerRaftProperties setMaxReplicatorInflightMsgs(Integer maxReplicatorInflightMsgs) { + this.maxReplicatorInflightMsgs = maxReplicatorInflightMsgs; + return this; + } + + public Integer getDisruptorBufferSize() { + return disruptorBufferSize; + } + + public ServerRaftProperties setDisruptorBufferSize(Integer disruptorBufferSize) { + this.disruptorBufferSize = disruptorBufferSize; + return this; + } + + public Integer getElectionTimeoutMs() { + return electionTimeoutMs; + } + + public ServerRaftProperties setElectionTimeoutMs(Integer electionTimeoutMs) { + this.electionTimeoutMs = electionTimeoutMs; + return this; + } + + public boolean isReporterEnabled() { + return reporterEnabled; + } + + public ServerRaftProperties setReporterEnabled(boolean reporterEnabled) { + this.reporterEnabled = reporterEnabled; + return this; + } + + public Integer getReporterInitialDelay() { + return reporterInitialDelay; + } + + public ServerRaftProperties setReporterInitialDelay(Integer reporterInitialDelay) { + this.reporterInitialDelay = reporterInitialDelay; + return this; + } + + public Boolean getAutoJoin() { + return autoJoin; + } + + public ServerRaftProperties setAutoJoin(Boolean autoJoin) { + this.autoJoin = autoJoin; + return this; + } + + public String getSerialization() { + return serialization; + } + + public void setSerialization(String serialization) { + this.serialization = serialization; + } + + public String getCompressor() { + return compressor; + } + + public void setCompressor(String compressor) { + this.compressor = compressor; + } + + public String getGroup() { + return group; + } + + public void setGroup(String group) { + this.group = group; + } + + public boolean isSync() { + return sync; + } + + public void setSync(boolean sync) { + this.sync = sync; + } + +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLClientProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLClientProperties.java new file mode 100644 index 0000000000..3c91211857 --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLClientProperties.java @@ -0,0 +1,57 @@ +/* + * 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.seata.spring.boot.autoconfigure.properties.server.raft; + +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = SERVER_RAFT_SSL_CLIENT_KEYSTORE_PREFIX) +public class ServerRaftSSLClientProperties { + + private String path = "ssl/cbolt.pfx"; + + private String password; + + private String type = "pkcs12"; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLProperties.java new file mode 100644 index 0000000000..55804b39b4 --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLProperties.java @@ -0,0 +1,57 @@ +/* + * 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.seata.spring.boot.autoconfigure.properties.server.raft; + +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_PREFIX; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = SERVER_RAFT_SSL_PREFIX) +public class ServerRaftSSLProperties { + + private Boolean enabled = false; + + private String kmfAlgorithm; + + private String tmfAlgorithm; + + public Boolean getEnabled() { + return enabled; + } + + public void setEnabled(Boolean enabled) { + this.enabled = enabled; + } + + public String getKmfAlgorithm() { + return kmfAlgorithm; + } + + public void setKmfAlgorithm(String kmfAlgorithm) { + this.kmfAlgorithm = kmfAlgorithm; + } + + public String getTmfAlgorithm() { + return tmfAlgorithm; + } + + public void setTmfAlgorithm(String tmfAlgorithm) { + this.tmfAlgorithm = tmfAlgorithm; + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLServerProperties.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLServerProperties.java new file mode 100644 index 0000000000..8b4a2efc0d --- /dev/null +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/main/java/org/apache/seata/spring/boot/autoconfigure/properties/server/raft/ServerRaftSSLServerProperties.java @@ -0,0 +1,57 @@ +/* + * 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.seata.spring.boot.autoconfigure.properties.server.raft; + +import static org.apache.seata.spring.boot.autoconfigure.StarterConstants.SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.stereotype.Component; + +@Component +@ConfigurationProperties(prefix = SERVER_RAFT_SSL_SERVER_KEYSTORE_PREFIX) +public class ServerRaftSSLServerProperties { + + private String path = "ssl/cbolt.pfx"; + + private String password; + + private String type = "pkcs12"; + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java index 7c7e76892c..51e6df64ae 100644 --- a/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java +++ b/seata-spring-autoconfigure/seata-spring-autoconfigure-server/src/test/java/org/apache/seata/spring/boot/autoconfigure/properties/server/ServerRaftPropertiesTest.java @@ -16,6 +16,7 @@ */ package org.apache.seata.spring.boot.autoconfigure.properties.server; +import org.apache.seata.spring.boot.autoconfigure.properties.server.raft.ServerRaftProperties; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; diff --git a/server/src/main/java/org/apache/seata/server/cluster/raft/RaftServer.java b/server/src/main/java/org/apache/seata/server/cluster/raft/RaftServer.java index ff3113e429..e2f6592afe 100644 --- a/server/src/main/java/org/apache/seata/server/cluster/raft/RaftServer.java +++ b/server/src/main/java/org/apache/seata/server/cluster/raft/RaftServer.java @@ -40,11 +40,13 @@ import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_REPORTER_ENA import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_REPORTER_INITIAL_DELAY; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PASSWORD; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PATH; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_ENABLED; -import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_KEYSTORE_TYPE; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_KMF_ALGORITHM; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_SERVER_KEYSTORE_PASSWORD; import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_SERVER_KEYSTORE_PATH; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_TMF_ALGORITHM; import static org.apache.seata.common.DefaultValues.DEFAULT_RAFT_SSL_ENABLED; /** @@ -143,13 +145,13 @@ public class RaftServer implements Disposable, Closeable { setSystemProperty("bolt.server.ssl.keystore", instance.getConfig(SERVER_RAFT_SSL_SERVER_KEYSTORE_PATH)); setSystemProperty("bolt.server.ssl.keystore.password", instance.getConfig(SERVER_RAFT_SSL_SERVER_KEYSTORE_PASSWORD)); - setSystemProperty("bolt.server.ssl.keystore.type", instance.getConfig(SERVER_RAFT_SSL_KEYSTORE_TYPE)); + setSystemProperty("bolt.server.ssl.keystore.type", instance.getConfig(SERVER_RAFT_SSL_SERVER_KEYSTORE_TYPE)); setSystemProperty("bolt.server.ssl.kmf.algorithm", instance.getConfig(SERVER_RAFT_SSL_KMF_ALGORITHM)); setSystemProperty("bolt.client.ssl.keystore", instance.getConfig(SERVER_RAFT_SSL_CLIENT_KEYSTORE_PATH)); setSystemProperty("bolt.client.ssl.keystore.password", instance.getConfig(SERVER_RAFT_SSL_CLIENT_KEYSTORE_PASSWORD)); - setSystemProperty("bolt.client.ssl.keystore.type", instance.getConfig(SERVER_RAFT_SSL_KEYSTORE_TYPE)); - setSystemProperty("bolt.client.ssl.tmf.algorithm", instance.getConfig(SERVER_RAFT_SSL_KMF_ALGORITHM)); + setSystemProperty("bolt.client.ssl.keystore.type", instance.getConfig(SERVER_RAFT_SSL_CLIENT_KEYSTORE_TYPE)); + setSystemProperty("bolt.client.ssl.tmf.algorithm", instance.getConfig(SERVER_RAFT_SSL_TMF_ALGORITHM)); logger.info("Enable ssl communication between raft nodes"); } diff --git a/server/src/main/resources/application.raft.example.yml b/server/src/main/resources/application.raft.example.yml index 241820a1d2..86c507777b 100644 --- a/server/src/main/resources/application.raft.example.yml +++ b/server/src/main/resources/application.raft.example.yml @@ -97,17 +97,15 @@ seata: client: keystore: path: ssl/cbolt.pfx - password: seata + password: type: pkcs12 server: keystore: path: ssl/bolt.pfx - password: seata + password: type: pkcs12 - kmf: - algorithm: SunX509 - tmf: - algorithm: SunX509 + kmf-algorithm: SunX509 + tmf-algorithm: SunX509 service-port: 8091 #If not configured, the default is '${server.port} + 1000' max-commit-retry-timeout: -1 max-rollback-retry-timeout: -1 diff --git a/server/src/test/java/org/apache/seata/server/raft/RaftServerTest.java b/server/src/test/java/org/apache/seata/server/raft/RaftServerTest.java index a85de53606..daa932d8ab 100644 --- a/server/src/test/java/org/apache/seata/server/raft/RaftServerTest.java +++ b/server/src/test/java/org/apache/seata/server/raft/RaftServerTest.java @@ -19,6 +19,7 @@ package org.apache.seata.server.raft; import org.apache.seata.common.ConfigurationKeys; import org.apache.seata.common.XID; import org.apache.seata.config.ConfigurationCache; +import org.apache.seata.config.ConfigurationFactory; import org.apache.seata.server.cluster.raft.RaftServerManager; import org.apache.seata.server.lock.LockerManagerFactory; import org.apache.seata.server.session.SessionHolder; @@ -30,6 +31,13 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.context.ApplicationContext; + +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_CLIENT_KEYSTORE_PATH; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_ENABLED; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_KMF_ALGORITHM; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_SERVER_KEYSTORE_PATH; +import static org.apache.seata.common.ConfigurationKeys.SERVER_RAFT_SSL_TMF_ALGORITHM; + @SpringBootTest public class RaftServerTest { @@ -51,6 +59,11 @@ public class RaftServerTest { @Test public void initRaftServerStart() { + Assertions.assertDoesNotThrow(()-> ConfigurationFactory.getInstance().getConfig(SERVER_RAFT_SSL_ENABLED)); + Assertions.assertDoesNotThrow(()-> ConfigurationFactory.getInstance().getConfig(SERVER_RAFT_SSL_CLIENT_KEYSTORE_PATH)); + Assertions.assertDoesNotThrow(()-> ConfigurationFactory.getInstance().getConfig(SERVER_RAFT_SSL_SERVER_KEYSTORE_PATH)); + Assertions.assertDoesNotThrow(()-> ConfigurationFactory.getInstance().getConfig(SERVER_RAFT_SSL_KMF_ALGORITHM)); + Assertions.assertDoesNotThrow(()-> ConfigurationFactory.getInstance().getConfig(SERVER_RAFT_SSL_TMF_ALGORITHM)); System.setProperty("server.raftPort", "9091"); System.setProperty(ConfigurationKeys.SERVER_RAFT_SERVER_ADDR, XID.getIpAddress() + ":9091" + "," + XID.getIpAddress() + ":9092" + "," + XID.getIpAddress() + ":9093"); --------------------------------------------------------------------- To unsubscribe, e-mail: notifications-unsubscr...@seata.apache.org For additional commands, e-mail: notifications-h...@seata.apache.org