-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure support of the transport-nio by security plugin (HTTP)
Signed-off-by: Andriy Redko <[email protected]>
- Loading branch information
Showing
18 changed files
with
865 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
plugins/transport-nio/licenses/netty-transport-native-unix-common-4.1.114.Final.jar.sha1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
d1171bb99411f282068f49d780cedf8c9adeabfd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
plugins/transport-nio/src/main/java/org/opensearch/http/nio/ssl/SslUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
package org.opensearch.http.nio.ssl; | ||
|
||
import org.opensearch.OpenSearchSecurityException; | ||
|
||
import javax.net.ssl.SSLContext; | ||
import javax.net.ssl.SSLEngine; | ||
|
||
import java.security.NoSuchAlgorithmException; | ||
|
||
public class SslUtils { | ||
private static final String[] DEFAULT_SSL_PROTOCOLS = { "TLSv1.3", "TLSv1.2", "TLSv1.1" }; | ||
|
||
private SslUtils() { | ||
|
||
} | ||
|
||
public static SSLEngine createDefaultServerSSLEngine() { | ||
try { | ||
final SSLEngine engine = SSLContext.getDefault().createSSLEngine(); | ||
engine.setEnabledProtocols(DEFAULT_SSL_PROTOCOLS); | ||
engine.setUseClientMode(false); | ||
return engine; | ||
} catch (final NoSuchAlgorithmException ex) { | ||
throw new OpenSearchSecurityException("Unable to initialize default server SSL engine", ex); | ||
} | ||
} | ||
|
||
public static SSLEngine createDefaultClientSSLEngine() { | ||
try { | ||
final SSLEngine engine = SSLContext.getDefault().createSSLEngine(); | ||
engine.setEnabledProtocols(DEFAULT_SSL_PROTOCOLS); | ||
engine.setUseClientMode(true); | ||
return engine; | ||
} catch (final NoSuchAlgorithmException ex) { | ||
throw new OpenSearchSecurityException("Unable to initialize default client SSL engine", ex); | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
plugins/transport-nio/src/main/java/org/opensearch/http/nio/ssl/package-info.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
/** | ||
* SSL supporting utility classes | ||
*/ | ||
package org.opensearch.http.nio.ssl; |
Oops, something went wrong.