Search in sources :

Example 1 with ClientCertificate

use of com.sequenceiq.cloudbreak.clusterproxy.ClientCertificate in project cloudbreak by hortonworks.

the class ClusterProxyService method clientCertificates.

private ClientCertificate clientCertificates(Stack stack) {
    Optional<SecurityConfig> securityConfigOptional = securityConfigService.findOneByStackId(stack.getId());
    ClientCertificate clientCertificate = null;
    if (securityConfigOptional.isPresent() && StringUtils.isNoneBlank(securityConfigOptional.get().getClientCert(), securityConfigOptional.get().getClientCertSecret())) {
        SecurityConfig securityConfig = securityConfigOptional.get();
        String clientCertRef = vaultPath(securityConfig.getClientCertSecret(), true);
        String clientKeyRef = vaultPath(securityConfig.getClientKeySecret(), true);
        clientCertificate = new ClientCertificate(clientKeyRef, clientCertRef);
    }
    return clientCertificate;
}
Also used : SecurityConfig(com.sequenceiq.cloudbreak.domain.SecurityConfig) ClientCertificate(com.sequenceiq.cloudbreak.clusterproxy.ClientCertificate)

Example 2 with ClientCertificate

use of com.sequenceiq.cloudbreak.clusterproxy.ClientCertificate in project cloudbreak by hortonworks.

the class ClusterProxyServiceTest method cmServiceConfigWithInstanceId.

private ClusterServiceConfig cmServiceConfigWithInstanceId(String ipAddress, String instanceId) {
    ClusterServiceCredential cloudbreakUser = new ClusterServiceCredential("cloudbreak", "/cb/test-data/secret/cbpassword:secret");
    ClusterServiceCredential dpUser = new ClusterServiceCredential("cmmgmt", "/cb/test-data/secret/dppassword:secret", true);
    ClientCertificate clientCertificate = new ClientCertificate("/cb/test-data/secret/clientKey:secret:base64", "/cb/test-data/secret/clientCert:secret:base64");
    return new ClusterServiceConfig("cb-internal-" + instanceId, List.of("https://" + ipAddress + ":9443"), null, false, asList(cloudbreakUser, dpUser), clientCertificate, null);
}
Also used : ClusterServiceConfig(com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceConfig) ClusterServiceCredential(com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceCredential) ClientCertificate(com.sequenceiq.cloudbreak.clusterproxy.ClientCertificate)

Example 3 with ClientCertificate

use of com.sequenceiq.cloudbreak.clusterproxy.ClientCertificate in project cloudbreak by hortonworks.

the class ClusterProxyServiceTest method cmServiceConfig.

private ClusterServiceConfig cmServiceConfig() {
    ClusterServiceCredential cloudbreakUser = new ClusterServiceCredential("cloudbreak", "/cb/test-data/secret/cbpassword:secret");
    ClusterServiceCredential dpUser = new ClusterServiceCredential("cmmgmt", "/cb/test-data/secret/dppassword:secret", true);
    ClientCertificate clientCertificate = new ClientCertificate("/cb/test-data/secret/clientKey:secret:base64", "/cb/test-data/secret/clientCert:secret:base64");
    return new ClusterServiceConfig(CLOUDERA_MANAGER_SERVICE, List.of("https://10.10.10.10:9443"), null, false, asList(cloudbreakUser, dpUser), clientCertificate, null);
}
Also used : ClusterServiceConfig(com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceConfig) ClusterServiceCredential(com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceCredential) ClientCertificate(com.sequenceiq.cloudbreak.clusterproxy.ClientCertificate)

Example 4 with ClientCertificate

use of com.sequenceiq.cloudbreak.clusterproxy.ClientCertificate in project cloudbreak by hortonworks.

the class ClusterProxyService method createDnsMappedServiceConfigs.

private List<ClusterServiceConfig> createDnsMappedServiceConfigs(Stack stack, List<GatewayConfig> gatewayConfigs, ClientCertificate clientCertificate, boolean preferPrivateIp) {
    List<ClusterServiceConfig> serviceConfigs = gatewayConfigs.stream().map(gatewayConfig -> createServiceConfig(stack, gatewayConfig.getHostname(), gatewayConfig, clientCertificate, preferPrivateIp)).collect(Collectors.toList());
    List<String> endpoints = gatewayConfigs.stream().map(gatewayConfig -> getNginxEndpointForRegistration(stack, gatewayConfig, preferPrivateIp)).collect(Collectors.toList());
    serviceConfigs.add(new ClusterServiceConfig(generateFreeIpaFqdn(stack), endpoints, null, false, List.of(), clientCertificate, getHealthCheck(stack)));
    return serviceConfigs;
}
Also used : FreeIpaCertVaultComponent(com.sequenceiq.freeipa.vault.FreeIpaCertVaultComponent) CCMV2_BACKEND_ID_FORMAT(com.sequenceiq.cloudbreak.ccm.cloudinit.CcmV2ParameterConstants.CCMV2_BACKEND_ID_FORMAT) FreeIpaDomainUtils(com.sequenceiq.freeipa.service.config.FreeIpaDomainUtils) LoggerFactory(org.slf4j.LoggerFactory) ConfigRegistrationRequestBuilder(com.sequenceiq.cloudbreak.clusterproxy.ConfigRegistrationRequestBuilder) ConfigRegistrationResponse(com.sequenceiq.cloudbreak.clusterproxy.ConfigRegistrationResponse) MDCBuilder(com.sequenceiq.cloudbreak.logger.MDCBuilder) JsonUtil(com.sequenceiq.cloudbreak.common.json.JsonUtil) ConfigRegistrationRequest(com.sequenceiq.cloudbreak.clusterproxy.ConfigRegistrationRequest) StringUtils(org.apache.commons.lang3.StringUtils) ClusterProxyConfiguration(com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyConfiguration) Inject(javax.inject.Inject) Value(org.springframework.beans.factory.annotation.Value) VaultSecret(com.sequenceiq.cloudbreak.service.secret.vault.VaultSecret) TunnelEntry(com.sequenceiq.cloudbreak.clusterproxy.TunnelEntry) Service(org.springframework.stereotype.Service) LinkedList(java.util.LinkedList) ServiceFamilies(com.sequenceiq.cloudbreak.ccm.endpoint.ServiceFamilies) Tunnel(com.sequenceiq.common.api.type.Tunnel) Stack(com.sequenceiq.freeipa.entity.Stack) VaultConfigException(com.sequenceiq.cloudbreak.service.secret.vault.VaultConfigException) ClientCertificate(com.sequenceiq.cloudbreak.clusterproxy.ClientCertificate) ClusterServiceConfig(com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceConfig) Logger(org.slf4j.Logger) FreeIpa(com.sequenceiq.freeipa.entity.FreeIpa) ClusterServiceHealthCheck(com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceHealthCheck) ReadConfigResponse(com.sequenceiq.cloudbreak.clusterproxy.ReadConfigResponse) IOException(java.io.IOException) ServiceEndpointHealthListenerTask(com.sequenceiq.freeipa.service.polling.clusterproxy.ServiceEndpointHealthListenerTask) SecurityConfigService(com.sequenceiq.freeipa.service.SecurityConfigService) ClusterProxyServiceAvailabilityChecker(com.sequenceiq.freeipa.util.ClusterProxyServiceAvailabilityChecker) ClusterProxyEnablementService(com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyEnablementService) ServiceEndpointHealthPollerObject(com.sequenceiq.freeipa.service.polling.clusterproxy.ServiceEndpointHealthPollerObject) Collectors(java.util.stream.Collectors) Objects(java.util.Objects) SecurityConfig(com.sequenceiq.freeipa.entity.SecurityConfig) List(java.util.List) ClusterProxyRegistrationClient(com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyRegistrationClient) GatewayConfigService(com.sequenceiq.freeipa.service.GatewayConfigService) PollingService(com.sequenceiq.cloudbreak.polling.PollingService) FreeIpaService(com.sequenceiq.freeipa.service.freeipa.FreeIpaService) CcmV2Config(com.sequenceiq.cloudbreak.clusterproxy.CcmV2Config) GatewayConfig(com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig) Optional(java.util.Optional) HealthCheckAvailabilityChecker(com.sequenceiq.freeipa.util.HealthCheckAvailabilityChecker) ClusterServiceConfig(com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceConfig)

Example 5 with ClientCertificate

use of com.sequenceiq.cloudbreak.clusterproxy.ClientCertificate in project cloudbreak by hortonworks.

the class ClusterProxyServiceTest method cmInternalServiceConfig.

private ClusterServiceConfig cmInternalServiceConfig(boolean withPrivateIp) {
    ClusterServiceCredential cloudbreakUser = new ClusterServiceCredential("cloudbreak", "/cb/test-data/secret/cbpassword:secret");
    ClusterServiceCredential dpUser = new ClusterServiceCredential("cmmgmt", "/cb/test-data/secret/dppassword:secret", true);
    ClientCertificate clientCertificate = new ClientCertificate("/cb/test-data/secret/clientKey:secret:base64", "/cb/test-data/secret/clientCert:secret:base64");
    return new ClusterServiceConfig("cb-internal", List.of(withPrivateIp ? "https://10.10.10.10:9443" : "https://1.2.3.4:9443"), null, false, asList(cloudbreakUser, dpUser), clientCertificate, null);
}
Also used : ClusterServiceConfig(com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceConfig) ClusterServiceCredential(com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceCredential) ClientCertificate(com.sequenceiq.cloudbreak.clusterproxy.ClientCertificate)

Aggregations

ClientCertificate (com.sequenceiq.cloudbreak.clusterproxy.ClientCertificate)7 ClusterServiceConfig (com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceConfig)5 ClusterServiceCredential (com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceCredential)3 SecurityConfig (com.sequenceiq.freeipa.entity.SecurityConfig)3 CCMV2_BACKEND_ID_FORMAT (com.sequenceiq.cloudbreak.ccm.cloudinit.CcmV2ParameterConstants.CCMV2_BACKEND_ID_FORMAT)2 ServiceFamilies (com.sequenceiq.cloudbreak.ccm.endpoint.ServiceFamilies)2 CcmV2Config (com.sequenceiq.cloudbreak.clusterproxy.CcmV2Config)2 ClusterProxyConfiguration (com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyConfiguration)2 ClusterProxyEnablementService (com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyEnablementService)2 ClusterProxyRegistrationClient (com.sequenceiq.cloudbreak.clusterproxy.ClusterProxyRegistrationClient)2 ClusterServiceHealthCheck (com.sequenceiq.cloudbreak.clusterproxy.ClusterServiceHealthCheck)2 ConfigRegistrationRequest (com.sequenceiq.cloudbreak.clusterproxy.ConfigRegistrationRequest)2 ConfigRegistrationRequestBuilder (com.sequenceiq.cloudbreak.clusterproxy.ConfigRegistrationRequestBuilder)2 ConfigRegistrationResponse (com.sequenceiq.cloudbreak.clusterproxy.ConfigRegistrationResponse)2 ReadConfigResponse (com.sequenceiq.cloudbreak.clusterproxy.ReadConfigResponse)2 TunnelEntry (com.sequenceiq.cloudbreak.clusterproxy.TunnelEntry)2 JsonUtil (com.sequenceiq.cloudbreak.common.json.JsonUtil)2 MDCBuilder (com.sequenceiq.cloudbreak.logger.MDCBuilder)2 GatewayConfig (com.sequenceiq.cloudbreak.orchestrator.model.GatewayConfig)2 PollingService (com.sequenceiq.cloudbreak.polling.PollingService)2