use of com.sequenceiq.freeipa.entity.SecurityConfig in project cloudbreak by hortonworks.
the class GatewayConfigService method getSaltClientConfig.
private SaltClientConfig getSaltClientConfig(Stack stack) {
SecurityConfig securityConfig = stack.getSecurityConfig();
SaltSecurityConfig saltSecurityConfig = securityConfig.getSaltSecurityConfig();
String privateKey = saltSecurityConfig.getSaltBootSignPrivateKey();
String saltBootPassword = saltSecurityConfig.getSaltBootPassword();
String saltPassword = saltSecurityConfig.getSaltPassword();
return new SaltClientConfig(saltPassword, saltBootPassword, new String(Base64.decodeBase64(privateKey)));
}
use of com.sequenceiq.freeipa.entity.SecurityConfig in project cloudbreak by hortonworks.
the class SecurityConfigService method findOneByStack.
public SecurityConfig findOneByStack(Stack stack) {
SecurityConfig securityConfig = securityConfigRepository.findOneByStackId(stack.getId());
if (securityConfig != null && securityConfig.getSaltSecurityConfig() != null) {
SaltSecurityConfig saltSecurityConfig = securityConfig.getSaltSecurityConfig();
if (StringUtils.isAnyBlank(saltSecurityConfig.getSaltBootPasswordVault(), saltSecurityConfig.getSaltBootSignPrivateKeyVault(), saltSecurityConfig.getSaltPasswordVault(), saltSecurityConfig.getSaltSignPrivateKeyVault())) {
LOGGER.debug("Migrate SaltSecurityConfig with id [{}] to vault", saltSecurityConfig.getId());
if (!saltSecurityConfig.getSaltBootPassword().equals(saltSecurityConfig.getSaltBootPasswordVault())) {
saltSecurityConfig.setSaltBootPasswordVault(saltSecurityConfig.getSaltBootPassword());
}
if (!saltSecurityConfig.getSaltBootSignPrivateKey().equals(saltSecurityConfig.getSaltBootSignPrivateKeyVault())) {
saltSecurityConfig.setSaltBootSignPrivateKeyVault(saltSecurityConfig.getSaltBootSignPrivateKey());
}
if (!saltSecurityConfig.getSaltSignPrivateKey().equals(saltSecurityConfig.getSaltPasswordVault())) {
saltSecurityConfig.setSaltPasswordVault(saltSecurityConfig.getSaltPassword());
}
if (!saltSecurityConfig.getSaltSignPrivateKey().equals(saltSecurityConfig.getSaltSignPrivateKeyVault())) {
saltSecurityConfig.setSaltSignPrivateKeyVault(saltSecurityConfig.getSaltSignPrivateKey());
}
saltSecurityConfig = disabledSaltSecurityConfigRepository.save(saltSecurityConfig);
securityConfig.setSaltSecurityConfig(saltSecurityConfig);
}
}
return securityConfig;
}
use of com.sequenceiq.freeipa.entity.SecurityConfig in project cloudbreak by hortonworks.
the class TlsSecurityService method buildGatewayConfig.
public GatewayConfig buildGatewayConfig(Stack stack, InstanceMetaData gatewayInstance, SaltClientConfig saltClientConfig, Boolean knoxGatewayEnabled) {
SecurityConfig securityConfig = securityConfigService.findOneByStack(stack);
String connectionIp = getGatewayIp(securityConfig, gatewayInstance, stack);
HttpClientConfig conf = buildTLSClientConfig(stack, connectionIp, gatewayInstance);
SaltSecurityConfig saltSecurityConfig = securityConfig.getSaltSecurityConfig();
String saltSignPrivateKeyB64 = saltSecurityConfig.getSaltSignPrivateKeyVault();
GatewayConfig gatewayConfig = new GatewayConfig(connectionIp, gatewayInstance.getPublicIpWrapper(), gatewayInstance.getPrivateIp(), gatewayInstance.getDiscoveryFQDN(), getGatewayPort(stack.getGatewayport(), stack), gatewayInstance.getInstanceId(), conf.getServerCert(), conf.getClientCert(), conf.getClientKey(), saltClientConfig.getSaltPassword(), saltClientConfig.getSaltBootPassword(), saltClientConfig.getSignatureKeyPem(), knoxGatewayEnabled, InstanceMetadataType.GATEWAY_PRIMARY.equals(gatewayInstance.getInstanceMetadataType()), new String(decodeBase64(saltSignPrivateKeyB64)), new String(decodeBase64(saltSecurityConfig.getSaltSignPublicKey())), null, null);
if (clusterProxyService.isCreateConfigForClusterProxy(stack)) {
gatewayConfig.withPath(clusterProxyService.getProxyPathPgwAsFallBack(stack, Optional.ofNullable(gatewayInstance.getDiscoveryFQDN()))).withProtocol(clusterProxyConfiguration.getClusterProxyProtocol());
}
return gatewayConfig;
}
use of com.sequenceiq.freeipa.entity.SecurityConfig in project cloudbreak by hortonworks.
the class TlsSecurityService method generateSecurityKeys.
public SecurityConfig generateSecurityKeys(String accountId) {
SecurityConfig securityConfig = new SecurityConfig();
securityConfig.setAccountId(accountId);
SaltSecurityConfig saltSecurityConfig = new SaltSecurityConfig();
saltSecurityConfig.setAccountId(accountId);
securityConfig.setSaltSecurityConfig(saltSecurityConfig);
generateClientKeys(securityConfig);
generateSaltBootSignKeypair(saltSecurityConfig);
generateSaltSignKeypair(securityConfig);
generateSaltPassword(saltSecurityConfig);
generateSaltBootPassword(saltSecurityConfig);
return securityConfig;
}
use of com.sequenceiq.freeipa.entity.SecurityConfig in project cloudbreak by hortonworks.
the class ClusterProxyService method clientCertificates.
private ClientCertificate clientCertificates(Stack stack) {
SecurityConfig securityConfig = securityConfigService.findOneByStack(stack);
ClientCertificate clientCertificate = null;
if (securityConfig != null && StringUtils.isNoneBlank(securityConfig.getClientCertVaultSecret(), securityConfig.getClientKeyVaultSecret())) {
String clientCertRef = vaultPath(securityConfig.getClientCertVaultSecret());
String clientKeyRef = vaultPath(securityConfig.getClientKeyVaultSecret());
clientCertificate = new ClientCertificate(clientKeyRef, clientCertRef);
}
return clientCertificate;
}
Aggregations