This is an automated email from the ASF dual-hosted git repository.
anton-vinogradov pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ignite.git
The following commit(s) were added to refs/heads/master by this push:
new a9421bd0662 IGNITE-29208 Preserve SSLEngine peer address in
SSLContextWrapper (#13750)
a9421bd0662 is described below
commit a9421bd066204bb4e41268732d4bb61652011120
Author: Anton Vinogradov <[email protected]>
AuthorDate: Tue Oct 27 14:57:35 2026 +0300
IGNITE-29208 Preserve SSLEngine peer address in SSLContextWrapper (#13750)
---
.../apache/ignite/ssl/DelegatingSSLContextSpi.java | 4 +-
.../apache/ignite/ssl/SSLContextWrapperTest.java | 57 ++++++++++++++++++++++
.../ignite/testsuites/SecurityTestSuite.java | 2 +
3 files changed, 61 insertions(+), 2 deletions(-)
diff --git
a/modules/commons/src/main/java/org/apache/ignite/ssl/DelegatingSSLContextSpi.java
b/modules/commons/src/main/java/org/apache/ignite/ssl/DelegatingSSLContextSpi.java
index 360e92239c6..767f51d6b01 100644
---
a/modules/commons/src/main/java/org/apache/ignite/ssl/DelegatingSSLContextSpi.java
+++
b/modules/commons/src/main/java/org/apache/ignite/ssl/DelegatingSSLContextSpi.java
@@ -70,8 +70,8 @@ class DelegatingSSLContextSpi extends SSLContextSpi {
}
/** {@inheritDoc} */
- @Override protected SSLEngine engineCreateSSLEngine(String s, int i) {
- final SSLEngine engine = delegate.createSSLEngine();
+ @Override protected SSLEngine engineCreateSSLEngine(String host, int port)
{
+ final SSLEngine engine = delegate.createSSLEngine(host, port);
if (parameters != null)
engine.setSSLParameters(parameters);
diff --git
a/modules/core/src/test/java/org/apache/ignite/ssl/SSLContextWrapperTest.java
b/modules/core/src/test/java/org/apache/ignite/ssl/SSLContextWrapperTest.java
new file mode 100644
index 00000000000..63bb1c5f214
--- /dev/null
+++
b/modules/core/src/test/java/org/apache/ignite/ssl/SSLContextWrapperTest.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.ignite.ssl;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLEngine;
+import javax.net.ssl.SSLParameters;
+import org.junit.Test;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+
+/** Tests that a context wrapper preserves engine addresses and applies its
SSL parameters. */
+public class SSLContextWrapperTest {
+ /** Both engine overloads apply the parameters, and the addressed overload
retains the peer host and port. */
+ @Test
+ public void testEnginePeerAddressAndParameters() throws Exception {
+ SSLContext delegate = SSLContext.getInstance("TLS");
+
+ delegate.init(null, null, null);
+
+ String[] protocols = {"TLSv1.2"};
+ String[] ciphers = {"TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256"};
+ String host = "peer.example";
+ int port = 10800;
+ SSLContext wrapper = new SSLContextWrapper(delegate, new
SSLParameters(ciphers, protocols));
+ SSLEngine addressed = wrapper.createSSLEngine(host, port);
+
+ assertEquals(host, addressed.getPeerHost());
+ assertEquals(port, addressed.getPeerPort());
+ assertArrayEquals(protocols, addressed.getEnabledProtocols());
+ assertArrayEquals(ciphers, addressed.getEnabledCipherSuites());
+
+ SSLEngine unaddressed = wrapper.createSSLEngine();
+
+ assertNull(unaddressed.getPeerHost());
+ assertEquals(-1, unaddressed.getPeerPort());
+ assertArrayEquals(protocols, unaddressed.getEnabledProtocols());
+ assertArrayEquals(ciphers, unaddressed.getEnabledCipherSuites());
+ }
+}
diff --git
a/modules/core/src/test/java/org/apache/ignite/testsuites/SecurityTestSuite.java
b/modules/core/src/test/java/org/apache/ignite/testsuites/SecurityTestSuite.java
index da768a22290..37fa57703b5 100644
---
a/modules/core/src/test/java/org/apache/ignite/testsuites/SecurityTestSuite.java
+++
b/modules/core/src/test/java/org/apache/ignite/testsuites/SecurityTestSuite.java
@@ -79,6 +79,7 @@ import
org.apache.ignite.internal.thread.context.OperationContextAttributePropag
import
org.apache.ignite.internal.thread.context.OperationContextAttributesTest;
import
org.apache.ignite.plugin.security.SecurityBasicPermissionSetSerializationTest;
import org.apache.ignite.ssl.MultipleSSLContextsTest;
+import org.apache.ignite.ssl.SSLContextWrapperTest;
import org.apache.ignite.tools.junit.JUnitTeamcityReporter;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
@@ -141,6 +142,7 @@ import org.junit.runners.Suite;
IgniteSecurityProcessorTest.class,
MultipleSSLContextsTest.class,
+ SSLContextWrapperTest.class,
MaintenanceModeNodeSecurityTest.class,
ServiceAuthorizationTest.class,
ServiceStaticConfigTest.class,