Java Code Examples for org.apache.rocketmq.remoting.common.TlsMode#PERMISSIVE
The following examples show how to use
org.apache.rocketmq.remoting.common.TlsMode#PERMISSIVE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TlsTest.java From DDMQ with Apache License 2.0 | 4 votes |
@Before public void setUp() throws InterruptedException { tlsMode = TlsMode.ENFORCING; tlsTestModeEnable = false; tlsServerNeedClientAuth = "require"; tlsServerKeyPath = getCertsPath("server.key"); tlsServerCertPath = getCertsPath("server.pem"); tlsServerAuthClient = true; tlsServerTrustCertPath = getCertsPath("ca.pem"); tlsClientKeyPath = getCertsPath("client.key"); tlsClientCertPath = getCertsPath("client.pem"); tlsClientAuthServer = true; tlsClientTrustCertPath = getCertsPath("ca.pem"); tlsClientKeyPassword = "1234"; tlsServerKeyPassword = ""; NettyClientConfig clientConfig = new NettyClientConfig(); clientConfig.setUseTLS(true); if ("serverRejectsUntrustedClientCert".equals(name.getMethodName())) { // Create a client. Its credentials come from a CA that the server does not trust. The client // trusts both test CAs to ensure the handshake failure is due to the server rejecting the client's cert. tlsClientKeyPath = getCertsPath("badClient.key"); tlsClientCertPath = getCertsPath("badClient.pem"); } else if ("serverAcceptsUntrustedClientCert".equals(name.getMethodName())) { tlsClientKeyPath = getCertsPath("badClient.key"); tlsClientCertPath = getCertsPath("badClient.pem"); tlsServerAuthClient = false; } else if ("noClientAuthFailure".equals(name.getMethodName())) { //Clear the client cert config to ensure produce the handshake error tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("clientRejectsUntrustedServerCert".equals(name.getMethodName())) { tlsServerKeyPath = getCertsPath("badServer.key"); tlsServerCertPath = getCertsPath("badServer.pem"); } else if ("clientAcceptsUntrustedServerCert".equals(name.getMethodName())) { tlsServerKeyPath = getCertsPath("badServer.key"); tlsServerCertPath = getCertsPath("badServer.pem"); tlsClientAuthServer = false; } else if ("serverNotNeedClientAuth".equals(name.getMethodName())) { tlsServerNeedClientAuth = "none"; tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("serverWantClientAuth".equals(name.getMethodName())) { tlsServerNeedClientAuth = "optional"; } else if ("serverWantClientAuth_ButClientNoCert".equals(name.getMethodName())) { tlsServerNeedClientAuth = "optional"; tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("serverAcceptsUnAuthClient".equals(name.getMethodName())) { tlsMode = TlsMode.PERMISSIVE; tlsClientKeyPath = ""; tlsClientCertPath = ""; clientConfig.setUseTLS(false); } else if ("serverRejectsSSLClient".equals(name.getMethodName())) { tlsMode = TlsMode.DISABLED; } remotingServer = RemotingServerTest.createRemotingServer(); remotingClient = RemotingServerTest.createRemotingClient(clientConfig); }
Example 2
Source File: TlsTest.java From DDMQ with Apache License 2.0 | 4 votes |
@After public void tearDown() { remotingClient.shutdown(); remotingServer.shutdown(); tlsMode = TlsMode.PERMISSIVE; }
Example 3
Source File: TlsTest.java From rocketmq-4.3.0 with Apache License 2.0 | 4 votes |
@Before public void setUp() throws InterruptedException { tlsMode = TlsMode.ENFORCING; tlsTestModeEnable = false; tlsServerNeedClientAuth = "require"; tlsServerKeyPath = getCertsPath("server.key"); tlsServerCertPath = getCertsPath("server.pem"); tlsServerAuthClient = true; tlsServerTrustCertPath = getCertsPath("ca.pem"); tlsClientKeyPath = getCertsPath("client.key"); tlsClientCertPath = getCertsPath("client.pem"); tlsClientAuthServer = true; tlsClientTrustCertPath = getCertsPath("ca.pem"); tlsClientKeyPassword = "1234"; tlsServerKeyPassword = ""; NettyClientConfig clientConfig = new NettyClientConfig(); clientConfig.setUseTLS(true); if ("serverRejectsUntrustedClientCert".equals(name.getMethodName())) { // Create a client. Its credentials come from a CA that the server does not trust. The client // trusts both test CAs to ensure the handshake failure is due to the server rejecting the client's cert. tlsClientKeyPath = getCertsPath("badClient.key"); tlsClientCertPath = getCertsPath("badClient.pem"); } else if ("serverAcceptsUntrustedClientCert".equals(name.getMethodName())) { tlsClientKeyPath = getCertsPath("badClient.key"); tlsClientCertPath = getCertsPath("badClient.pem"); tlsServerAuthClient = false; } else if ("noClientAuthFailure".equals(name.getMethodName())) { //Clear the client cert config to ensure produce the handshake error tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("clientRejectsUntrustedServerCert".equals(name.getMethodName())) { tlsServerKeyPath = getCertsPath("badServer.key"); tlsServerCertPath = getCertsPath("badServer.pem"); } else if ("clientAcceptsUntrustedServerCert".equals(name.getMethodName())) { tlsServerKeyPath = getCertsPath("badServer.key"); tlsServerCertPath = getCertsPath("badServer.pem"); tlsClientAuthServer = false; } else if ("serverNotNeedClientAuth".equals(name.getMethodName())) { tlsServerNeedClientAuth = "none"; tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("serverWantClientAuth".equals(name.getMethodName())) { tlsServerNeedClientAuth = "optional"; } else if ("serverWantClientAuth_ButClientNoCert".equals(name.getMethodName())) { tlsServerNeedClientAuth = "optional"; tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("serverAcceptsUnAuthClient".equals(name.getMethodName())) { tlsMode = TlsMode.PERMISSIVE; tlsClientKeyPath = ""; tlsClientCertPath = ""; clientConfig.setUseTLS(false); } else if ("serverRejectsSSLClient".equals(name.getMethodName())) { tlsMode = TlsMode.DISABLED; } else if ("reloadSslContextForServer".equals(name.getMethodName())) { tlsClientAuthServer = false; tlsServerNeedClientAuth = "none"; } remotingServer = RemotingServerTest.createRemotingServer(); remotingClient = RemotingServerTest.createRemotingClient(clientConfig); }
Example 4
Source File: TlsTest.java From rocketmq-4.3.0 with Apache License 2.0 | 4 votes |
@After public void tearDown() { remotingClient.shutdown(); remotingServer.shutdown(); tlsMode = TlsMode.PERMISSIVE; }
Example 5
Source File: TlsTest.java From rocketmq-read with Apache License 2.0 | 4 votes |
@Before public void setUp() throws InterruptedException { tlsMode = TlsMode.ENFORCING; tlsTestModeEnable = false; tlsServerNeedClientAuth = "require"; tlsServerKeyPath = getCertsPath("server.key"); tlsServerCertPath = getCertsPath("server.pem"); tlsServerAuthClient = true; tlsServerTrustCertPath = getCertsPath("ca.pem"); tlsClientKeyPath = getCertsPath("client.key"); tlsClientCertPath = getCertsPath("client.pem"); tlsClientAuthServer = true; tlsClientTrustCertPath = getCertsPath("ca.pem"); tlsClientKeyPassword = "1234"; tlsServerKeyPassword = ""; NettyClientConfig clientConfig = new NettyClientConfig(); clientConfig.setUseTLS(true); if ("serverRejectsUntrustedClientCert".equals(name.getMethodName())) { // Create a client. Its credentials come from a CA that the server does not trust. The client // trusts both test CAs to ensure the handshake failure is due to the server rejecting the client's cert. tlsClientKeyPath = getCertsPath("badClient.key"); tlsClientCertPath = getCertsPath("badClient.pem"); } else if ("serverAcceptsUntrustedClientCert".equals(name.getMethodName())) { tlsClientKeyPath = getCertsPath("badClient.key"); tlsClientCertPath = getCertsPath("badClient.pem"); tlsServerAuthClient = false; } else if ("noClientAuthFailure".equals(name.getMethodName())) { //Clear the client cert config to ensure produce the handshake error tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("clientRejectsUntrustedServerCert".equals(name.getMethodName())) { tlsServerKeyPath = getCertsPath("badServer.key"); tlsServerCertPath = getCertsPath("badServer.pem"); } else if ("clientAcceptsUntrustedServerCert".equals(name.getMethodName())) { tlsServerKeyPath = getCertsPath("badServer.key"); tlsServerCertPath = getCertsPath("badServer.pem"); tlsClientAuthServer = false; } else if ("serverNotNeedClientAuth".equals(name.getMethodName())) { tlsServerNeedClientAuth = "none"; tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("serverWantClientAuth".equals(name.getMethodName())) { tlsServerNeedClientAuth = "optional"; } else if ("serverWantClientAuth_ButClientNoCert".equals(name.getMethodName())) { tlsServerNeedClientAuth = "optional"; tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("serverAcceptsUnAuthClient".equals(name.getMethodName())) { tlsMode = TlsMode.PERMISSIVE; tlsClientKeyPath = ""; tlsClientCertPath = ""; clientConfig.setUseTLS(false); } else if ("serverRejectsSSLClient".equals(name.getMethodName())) { tlsMode = TlsMode.DISABLED; } else if ("reloadSslContextForServer".equals(name.getMethodName())) { tlsClientAuthServer = false; tlsServerNeedClientAuth = "none"; } remotingServer = RemotingServerTest.createRemotingServer(); remotingClient = RemotingServerTest.createRemotingClient(clientConfig); }
Example 6
Source File: TlsTest.java From rocketmq-read with Apache License 2.0 | 4 votes |
@After public void tearDown() { remotingClient.shutdown(); remotingServer.shutdown(); tlsMode = TlsMode.PERMISSIVE; }
Example 7
Source File: TlsTest.java From DDMQ with Apache License 2.0 | 4 votes |
@Before public void setUp() throws InterruptedException { tlsMode = TlsMode.ENFORCING; tlsTestModeEnable = false; tlsServerNeedClientAuth = "require"; tlsServerKeyPath = getCertsPath("server.key"); tlsServerCertPath = getCertsPath("server.pem"); tlsServerAuthClient = true; tlsServerTrustCertPath = getCertsPath("ca.pem"); tlsClientKeyPath = getCertsPath("client.key"); tlsClientCertPath = getCertsPath("client.pem"); tlsClientAuthServer = true; tlsClientTrustCertPath = getCertsPath("ca.pem"); tlsClientKeyPassword = "1234"; tlsServerKeyPassword = ""; NettyClientConfig clientConfig = new NettyClientConfig(); clientConfig.setUseTLS(true); if ("serverRejectsUntrustedClientCert".equals(name.getMethodName())) { // Create a client. Its credentials come from a CA that the server does not trust. The client // trusts both test CAs to ensure the handshake failure is due to the server rejecting the client's cert. tlsClientKeyPath = getCertsPath("badClient.key"); tlsClientCertPath = getCertsPath("badClient.pem"); } else if ("serverAcceptsUntrustedClientCert".equals(name.getMethodName())) { tlsClientKeyPath = getCertsPath("badClient.key"); tlsClientCertPath = getCertsPath("badClient.pem"); tlsServerAuthClient = false; } else if ("noClientAuthFailure".equals(name.getMethodName())) { //Clear the client cert config to ensure produce the handshake error tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("clientRejectsUntrustedServerCert".equals(name.getMethodName())) { tlsServerKeyPath = getCertsPath("badServer.key"); tlsServerCertPath = getCertsPath("badServer.pem"); } else if ("clientAcceptsUntrustedServerCert".equals(name.getMethodName())) { tlsServerKeyPath = getCertsPath("badServer.key"); tlsServerCertPath = getCertsPath("badServer.pem"); tlsClientAuthServer = false; } else if ("serverNotNeedClientAuth".equals(name.getMethodName())) { tlsServerNeedClientAuth = "none"; tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("serverWantClientAuth".equals(name.getMethodName())) { tlsServerNeedClientAuth = "optional"; } else if ("serverWantClientAuth_ButClientNoCert".equals(name.getMethodName())) { tlsServerNeedClientAuth = "optional"; tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("serverAcceptsUnAuthClient".equals(name.getMethodName())) { tlsMode = TlsMode.PERMISSIVE; tlsClientKeyPath = ""; tlsClientCertPath = ""; clientConfig.setUseTLS(false); } else if ("serverRejectsSSLClient".equals(name.getMethodName())) { tlsMode = TlsMode.DISABLED; } remotingServer = RemotingServerTest.createRemotingServer(); remotingClient = RemotingServerTest.createRemotingClient(clientConfig); }
Example 8
Source File: TlsTest.java From DDMQ with Apache License 2.0 | 4 votes |
@After public void tearDown() { remotingClient.shutdown(); remotingServer.shutdown(); tlsMode = TlsMode.PERMISSIVE; }
Example 9
Source File: TlsTest.java From rocketmq with Apache License 2.0 | 4 votes |
@Before public void setUp() throws InterruptedException { tlsMode = TlsMode.ENFORCING; tlsTestModeEnable = false; tlsServerNeedClientAuth = "require"; tlsServerKeyPath = getCertsPath("server.key"); tlsServerCertPath = getCertsPath("server.pem"); tlsServerAuthClient = true; tlsServerTrustCertPath = getCertsPath("ca.pem"); tlsClientKeyPath = getCertsPath("client.key"); tlsClientCertPath = getCertsPath("client.pem"); tlsClientAuthServer = true; tlsClientTrustCertPath = getCertsPath("ca.pem"); tlsClientKeyPassword = "1234"; tlsServerKeyPassword = ""; NettyClientConfig clientConfig = new NettyClientConfig(); clientConfig.setUseTLS(true); if ("serverRejectsUntrustedClientCert".equals(name.getMethodName())) { // Create a client. Its credentials come from a CA that the server does not trust. The client // trusts both test CAs to ensure the handshake failure is due to the server rejecting the client's cert. tlsClientKeyPath = getCertsPath("badClient.key"); tlsClientCertPath = getCertsPath("badClient.pem"); } else if ("serverAcceptsUntrustedClientCert".equals(name.getMethodName())) { tlsClientKeyPath = getCertsPath("badClient.key"); tlsClientCertPath = getCertsPath("badClient.pem"); tlsServerAuthClient = false; } else if ("noClientAuthFailure".equals(name.getMethodName())) { //Clear the client cert config to ensure produce the handshake error tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("clientRejectsUntrustedServerCert".equals(name.getMethodName())) { tlsServerKeyPath = getCertsPath("badServer.key"); tlsServerCertPath = getCertsPath("badServer.pem"); } else if ("clientAcceptsUntrustedServerCert".equals(name.getMethodName())) { tlsServerKeyPath = getCertsPath("badServer.key"); tlsServerCertPath = getCertsPath("badServer.pem"); tlsClientAuthServer = false; } else if ("serverNotNeedClientAuth".equals(name.getMethodName())) { tlsServerNeedClientAuth = "none"; tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("serverWantClientAuth".equals(name.getMethodName())) { tlsServerNeedClientAuth = "optional"; } else if ("serverWantClientAuth_ButClientNoCert".equals(name.getMethodName())) { tlsServerNeedClientAuth = "optional"; tlsClientKeyPath = ""; tlsClientCertPath = ""; } else if ("serverAcceptsUnAuthClient".equals(name.getMethodName())) { tlsMode = TlsMode.PERMISSIVE; tlsClientKeyPath = ""; tlsClientCertPath = ""; clientConfig.setUseTLS(false); } else if ("serverRejectsSSLClient".equals(name.getMethodName())) { tlsMode = TlsMode.DISABLED; } else if ("reloadSslContextForServer".equals(name.getMethodName())) { tlsClientAuthServer = false; tlsServerNeedClientAuth = "none"; } remotingServer = RemotingServerTest.createRemotingServer(); remotingClient = RemotingServerTest.createRemotingClient(clientConfig); }
Example 10
Source File: TlsTest.java From rocketmq with Apache License 2.0 | 4 votes |
@After public void tearDown() { remotingClient.shutdown(); remotingServer.shutdown(); tlsMode = TlsMode.PERMISSIVE; }