Search in sources :

Example 1 with SymmetricEncryptionConfig

use of com.hazelcast.config.SymmetricEncryptionConfig in project hazelcast by hazelcast.

the class DefaultNodeExtension method checkSecurityAllowed.

private void checkSecurityAllowed() {
    SecurityConfig securityConfig = node.getConfig().getSecurityConfig();
    if (securityConfig != null && securityConfig.isEnabled()) {
        if (!BuildInfoProvider.getBuildInfo().isEnterprise()) {
            throw new IllegalStateException("Security requires Hazelcast Enterprise Edition");
        }
    }
    SymmetricEncryptionConfig symmetricEncryptionConfig = getActiveMemberNetworkConfig(node.getConfig()).getSymmetricEncryptionConfig();
    if (symmetricEncryptionConfig != null && symmetricEncryptionConfig.isEnabled()) {
        if (!BuildInfoProvider.getBuildInfo().isEnterprise()) {
            throw new IllegalStateException("Symmetric Encryption requires Hazelcast Enterprise Edition");
        }
    }
    AuditlogConfig auditlogConfig = node.getConfig().getAuditlogConfig();
    if (auditlogConfig != null && auditlogConfig.isEnabled()) {
        if (!BuildInfoProvider.getBuildInfo().isEnterprise()) {
            throw new IllegalStateException("Auditlog requires Hazelcast Enterprise Edition");
        }
    }
}
Also used : SecurityConfig(com.hazelcast.config.SecurityConfig) AuditlogConfig(com.hazelcast.config.AuditlogConfig) SymmetricEncryptionConfig(com.hazelcast.config.SymmetricEncryptionConfig)

Example 2 with SymmetricEncryptionConfig

use of com.hazelcast.config.SymmetricEncryptionConfig in project hazelcast by hazelcast.

the class SecurityWithoutEnterpriseTest method testSymmetricEncryption.

@Test
public void testSymmetricEncryption() {
    SymmetricEncryptionConfig symmetricEncryptionConfig = new SymmetricEncryptionConfig().setEnabled(true);
    Config config = new Config();
    config.getNetworkConfig().setSymmetricEncryptionConfig(symmetricEncryptionConfig);
    expected.expect(IllegalStateException.class);
    createHazelcastInstance(config);
}
Also used : Config(com.hazelcast.config.Config) SymmetricEncryptionConfig(com.hazelcast.config.SymmetricEncryptionConfig) SecurityConfig(com.hazelcast.config.SecurityConfig) SymmetricEncryptionConfig(com.hazelcast.config.SymmetricEncryptionConfig) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Example 3 with SymmetricEncryptionConfig

use of com.hazelcast.config.SymmetricEncryptionConfig in project hazelcast by hazelcast.

the class TestFullApplicationContext method testNetworkConfig.

@Test
public void testNetworkConfig() {
    NetworkConfig networkConfig = config.getNetworkConfig();
    assertNotNull(networkConfig);
    assertEquals(5700, networkConfig.getPort());
    assertTrue(networkConfig.isPortAutoIncrement());
    Collection<String> allowedPorts = networkConfig.getOutboundPortDefinitions();
    assertEquals(2, allowedPorts.size());
    Iterator portIter = allowedPorts.iterator();
    assertEquals("35000-35100", portIter.next());
    assertEquals("36000,36100", portIter.next());
    assertFalse(networkConfig.getJoin().getAutoDetectionConfig().isEnabled());
    assertFalse(networkConfig.getJoin().getMulticastConfig().isEnabled());
    assertEquals(networkConfig.getJoin().getMulticastConfig().getMulticastTimeoutSeconds(), 8);
    assertEquals(networkConfig.getJoin().getMulticastConfig().getMulticastTimeToLive(), 16);
    assertEquals(Boolean.FALSE, networkConfig.getJoin().getMulticastConfig().getLoopbackModeEnabled());
    Set<String> tis = networkConfig.getJoin().getMulticastConfig().getTrustedInterfaces();
    assertEquals(1, tis.size());
    assertEquals("10.10.10.*", tis.iterator().next());
    assertFalse(networkConfig.getInterfaces().isEnabled());
    assertEquals(1, networkConfig.getInterfaces().getInterfaces().size());
    assertEquals("10.10.1.*", networkConfig.getInterfaces().getInterfaces().iterator().next());
    TcpIpConfig tcp = networkConfig.getJoin().getTcpIpConfig();
    assertNotNull(tcp);
    assertFalse(tcp.isEnabled());
    SymmetricEncryptionConfig symmetricEncryptionConfig = networkConfig.getSymmetricEncryptionConfig();
    assertFalse(symmetricEncryptionConfig.isEnabled());
    assertEquals("PBEWithMD5AndDES", symmetricEncryptionConfig.getAlgorithm());
    assertEquals("thesalt", symmetricEncryptionConfig.getSalt());
    assertEquals("thepass", symmetricEncryptionConfig.getPassword());
    assertEquals(19, symmetricEncryptionConfig.getIterationCount());
    List<String> members = tcp.getMembers();
    assertEquals(members.toString(), 2, members.size());
    assertEquals("127.0.0.1:5700", members.get(0));
    assertEquals("127.0.0.1:5701", members.get(1));
    assertEquals("127.0.0.1:5700", tcp.getRequiredMember());
    assertAwsConfig(networkConfig.getJoin().getAwsConfig());
    assertGcpConfig(networkConfig.getJoin().getGcpConfig());
    assertAzureConfig(networkConfig.getJoin().getAzureConfig());
    assertKubernetesConfig(networkConfig.getJoin().getKubernetesConfig());
    assertEurekaConfig(networkConfig.getJoin().getEurekaConfig());
    assertTrue("reuse-address", networkConfig.isReuseAddress());
    MemberAddressProviderConfig memberAddressProviderConfig = networkConfig.getMemberAddressProviderConfig();
    assertFalse(memberAddressProviderConfig.isEnabled());
    assertEquals("com.hazelcast.spring.DummyMemberAddressProvider", memberAddressProviderConfig.getClassName());
    assertFalse(memberAddressProviderConfig.getProperties().isEmpty());
    assertEquals("value", memberAddressProviderConfig.getProperties().getProperty("dummy.property"));
    assertEquals("value2", memberAddressProviderConfig.getProperties().getProperty("dummy.property.2"));
    IcmpFailureDetectorConfig icmpFailureDetectorConfig = networkConfig.getIcmpFailureDetectorConfig();
    assertFalse(icmpFailureDetectorConfig.isEnabled());
    assertTrue(icmpFailureDetectorConfig.isParallelMode());
    assertTrue(icmpFailureDetectorConfig.isFailFastOnStartup());
    assertEquals(500, icmpFailureDetectorConfig.getTimeoutMilliseconds());
    assertEquals(1002, icmpFailureDetectorConfig.getIntervalMilliseconds());
    assertEquals(2, icmpFailureDetectorConfig.getMaxAttempts());
    assertEquals(1, icmpFailureDetectorConfig.getTtl());
}
Also used : MemberAddressProviderConfig(com.hazelcast.config.MemberAddressProviderConfig) IcmpFailureDetectorConfig(com.hazelcast.config.IcmpFailureDetectorConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) Iterator(java.util.Iterator) TcpIpConfig(com.hazelcast.config.TcpIpConfig) SymmetricEncryptionConfig(com.hazelcast.config.SymmetricEncryptionConfig) Test(org.junit.Test) QuickTest(com.hazelcast.test.annotation.QuickTest)

Aggregations

SymmetricEncryptionConfig (com.hazelcast.config.SymmetricEncryptionConfig)3 SecurityConfig (com.hazelcast.config.SecurityConfig)2 QuickTest (com.hazelcast.test.annotation.QuickTest)2 Test (org.junit.Test)2 AuditlogConfig (com.hazelcast.config.AuditlogConfig)1 Config (com.hazelcast.config.Config)1 IcmpFailureDetectorConfig (com.hazelcast.config.IcmpFailureDetectorConfig)1 MemberAddressProviderConfig (com.hazelcast.config.MemberAddressProviderConfig)1 NetworkConfig (com.hazelcast.config.NetworkConfig)1 TcpIpConfig (com.hazelcast.config.TcpIpConfig)1 ParallelJVMTest (com.hazelcast.test.annotation.ParallelJVMTest)1 Iterator (java.util.Iterator)1