This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 70b1d758ffc Refactor ProxySSLContext to unify log (#38054)
70b1d758ffc is described below
commit 70b1d758ffc1bf9d179cc99545e2f70b0f732e19
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Feb 16 01:02:47 2026 +0800
Refactor ProxySSLContext to unify log (#38054)
---
.../proxy/frontend/ssl/ProxySSLContext.java | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/ssl/ProxySSLContext.java
b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/ssl/ProxySSLContext.java
index ee256b16c7a..605fea35185 100644
---
a/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/ssl/ProxySSLContext.java
+++
b/proxy/frontend/core/src/main/java/org/apache/shardingsphere/proxy/frontend/ssl/ProxySSLContext.java
@@ -21,6 +21,7 @@ import io.netty.buffer.ByteBufAllocator;
import io.netty.handler.ssl.SslContext;
import io.netty.handler.ssl.SslContextBuilder;
import lombok.extern.slf4j.Slf4j;
+import org.apache.shardingsphere.infra.config.props.ConfigurationProperties;
import org.apache.shardingsphere.infra.config.props.ConfigurationPropertyKey;
import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
@@ -46,14 +47,15 @@ public final class ProxySSLContext {
* @throws SSLException SSL exception
*/
public static void init() throws SSLException {
- if
(!ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<Boolean>getValue(ConfigurationPropertyKey.PROXY_FRONTEND_SSL_ENABLED))
{
- log.info("Proxy frontend SSL/TLS is not enabled.");
+ ConfigurationProperties props =
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps();
+ if
(!props.<Boolean>getValue(ConfigurationPropertyKey.PROXY_FRONTEND_SSL_ENABLED))
{
+ log.info("Proxy frontend SSL/TLS is disabled.");
return;
}
- SslContextBuilder sslContextBuilder = prepareSslContextBuilder();
- String versions =
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<String>getValue(ConfigurationPropertyKey.PROXY_FRONTEND_SSL_VERSION).trim();
+ SslContextBuilder sslContextBuilder = prepareSSLContextBuilder();
+ String versions =
props.<String>getValue(ConfigurationPropertyKey.PROXY_FRONTEND_SSL_VERSION).trim();
sslContextBuilder.protocols(versions.split(","));
- String ciphers =
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getProps().<String>getValue(ConfigurationPropertyKey.PROXY_FRONTEND_SSL_CIPHER).trim();
+ String ciphers =
props.<String>getValue(ConfigurationPropertyKey.PROXY_FRONTEND_SSL_CIPHER).trim();
if (!ciphers.isEmpty()) {
sslContextBuilder.ciphers(Arrays.asList(ciphers.split(",")));
}
@@ -61,11 +63,11 @@ public final class ProxySSLContext {
log.info("Proxy frontend SSL/TLS is enabled. Supported protocols: {}",
versions);
}
- private static SslContextBuilder prepareSslContextBuilder() {
+ private static SslContextBuilder prepareSSLContextBuilder() {
KeyPair keyPair = SSLUtils.generateRSAKeyPair();
X509Certificate x509Certificate =
SSLUtils.generateSelfSignedX509Certificate(keyPair);
SslContextBuilder result =
SslContextBuilder.forServer(keyPair.getPrivate(), x509Certificate);
- log.warn("RSA key pair and CA certificate are generated by
ShardingSphere-Proxy and self-signed.");
+ log.info("RSA key pair and CA certificate are generated by Proxy and
self-signed.");
return result;
}