Search in sources :

Example 1 with SecurityRulesV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response in project cloudbreak by hortonworks.

the class SecurityRuleService method getDefaultSecurityRules.

public SecurityRulesV4Response getDefaultSecurityRules() {
    SecurityRulesV4Response ret = new SecurityRulesV4Response();
    Set<String> defaultGatewayCidrs = defaultGatewayCidr.stream().filter(StringUtils::isNotBlank).collect(Collectors.toSet());
    if (!defaultGatewayCidrs.isEmpty()) {
        defaultGatewayCidr.forEach(cloudbreakCidr -> addCidrAndPort(ret, cloudbreakCidr));
    }
    return ret;
}
Also used : SecurityRulesV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response)

Example 2 with SecurityRulesV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response in project cloudbreak by hortonworks.

the class SecurityRuleServiceTest method getDefaultSecurityRulesWhenKnoxIsDisabledAndHttpsPortIsSet.

@Test
public void getDefaultSecurityRulesWhenKnoxIsDisabledAndHttpsPortIsSet() {
    SecurityRulesV4Response defaultSecurityRules = underTest.getDefaultSecurityRules();
    Assert.assertEquals(3, defaultSecurityRules.getGateway().size());
    Assert.assertEquals(1, defaultSecurityRules.getCore().size());
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "9443"));
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "443"));
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "22"));
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getCore(), "22"));
}
Also used : SecurityRulesV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response) Test(org.junit.Test)

Example 3 with SecurityRulesV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response in project cloudbreak by hortonworks.

the class SecurityRuleServiceTest method getDefaultSecurityRulesWhenKnoxIsEnabledAndKnoxPortIsSet.

@Test
public void getDefaultSecurityRulesWhenKnoxIsEnabledAndKnoxPortIsSet() {
    SecurityRulesV4Response defaultSecurityRules = underTest.getDefaultSecurityRules();
    Assert.assertEquals(3, defaultSecurityRules.getGateway().size());
    Assert.assertEquals(1, defaultSecurityRules.getCore().size());
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "9443"));
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "443"));
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "22"));
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getCore(), "22"));
}
Also used : SecurityRulesV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response) Test(org.junit.Test)

Example 4 with SecurityRulesV4Response

use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response in project cloudbreak by hortonworks.

the class SecurityRuleServiceTest method getDefaultSecurityRulesWhenKnoxIsEnabled.

@Test
public void getDefaultSecurityRulesWhenKnoxIsEnabled() {
    SecurityRulesV4Response defaultSecurityRules = underTest.getDefaultSecurityRules();
    Assert.assertEquals(3, defaultSecurityRules.getGateway().size());
    Assert.assertEquals(1, defaultSecurityRules.getCore().size());
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "9443"));
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "443"));
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getGateway(), "22"));
    Assert.assertTrue(containsServicePort(defaultSecurityRules.getCore(), "22"));
}
Also used : SecurityRulesV4Response(com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response) Test(org.junit.Test)

Aggregations

SecurityRulesV4Response (com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.SecurityRulesV4Response)4 Test (org.junit.Test)3