use of com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabRequest in project cloudbreak by hortonworks.
the class CmServiceKeytabRequestFactory method create.
public ServiceKeytabRequest create(Stack stack, GatewayConfig primaryGatewayConfig) {
ServiceKeytabRequest request = new ServiceKeytabRequest();
request.setEnvironmentCrn(stack.getEnvironmentCrn());
request.setClusterCrn(stack.getResourceCrn());
String fqdn = primaryGatewayConfig.getHostname();
request.setServerHostName(fqdn);
String hostname = StringUtils.substringBefore(fqdn, ".");
if (!fqdn.equals(hostname)) {
request.setServerHostNameAlias(hostname);
}
request.setServiceName("CM");
request.setDoNotRecreateKeytab(Boolean.TRUE);
RoleRequest roleRequest = new RoleRequest();
roleRequest.setRoleName("hadoopadminrole-" + stack.getName());
roleRequest.setPrivileges(Set.of("Service Administrators", "Certificate Administrators", "Host Administrators", "CA Administrator"));
request.setRoleRequest(roleRequest);
return request;
}
use of com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabRequest in project cloudbreak by hortonworks.
the class FreeIpaUpgradeTests method generateServiceKeytab.
private void generateServiceKeytab(com.sequenceiq.freeipa.api.client.FreeIpaClient ipaClient, String environmentCrn) {
try {
ServiceKeytabRequest serviceKeytabRequest = new ServiceKeytabRequest();
serviceKeytabRequest.setEnvironmentCrn(environmentCrn);
serviceKeytabRequest.setServiceName("test");
serviceKeytabRequest.setServerHostName("test.local");
serviceKeytabRequest.setDoNotRecreateKeytab(Boolean.FALSE);
ipaClient.getKerberosMgmtV1Endpoint().generateServiceKeytab(serviceKeytabRequest, null);
} catch (Exception e) {
logger.error("Generate Service keytab test failed during upgrade", e);
throw new TestFailException("Generate Service keytab test failed during upgrade with: " + e.getMessage(), e);
}
}
use of com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabRequest in project cloudbreak by hortonworks.
the class CmServiceKeytabRequestFactoryTest method testAliasCreationWithFQDN.
@Test
public void testAliasCreationWithFQDN() {
Stack stack = TestUtil.stack();
GatewayConfig primaryGatewayConfig = create("fqdn.stest.cloudera.site");
ServiceKeytabRequest request = underTest.create(stack, primaryGatewayConfig);
assertEquals("CM", request.getServiceName());
assertEquals("fqdn.stest.cloudera.site", request.getServerHostName());
assertEquals("fqdn", request.getServerHostNameAlias());
}
use of com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabRequest in project cloudbreak by hortonworks.
the class CmServiceKeytabRequestFactoryTest method testAliasCreationWithHostname.
@Test
public void testAliasCreationWithHostname() {
Stack stack = TestUtil.stack();
GatewayConfig primaryGatewayConfig = create("fqdn");
ServiceKeytabRequest request = underTest.create(stack, primaryGatewayConfig);
assertEquals("CM", request.getServiceName());
assertEquals("fqdn", request.getServerHostName());
assertNull("Alias shall be null if it is identical with fqdn", request.getServerHostNameAlias());
}
use of com.sequenceiq.freeipa.api.v1.kerberosmgmt.model.ServiceKeytabRequest in project cloudbreak by hortonworks.
the class ServiceKeytabServiceTest method testGetExistingWithRoleRequest.
@Test
public void testGetExistingWithRoleRequest() {
ServiceKeytabRequest request = new ServiceKeytabRequest();
request.setEnvironmentCrn(ENVIRONMENT_CRN);
request.setServiceName(SERVICE_NAME);
request.setServerHostName(HOST);
request.setRoleRequest(new RoleRequest());
assertThrows(KeytabCreationException.class, () -> underTest.getExistingServiceKeytab(request, ACCOUNT_ID));
}
Aggregations