use of com.sequenceiq.cloudbreak.domain.SecurityConfig in project cloudbreak by hortonworks.
the class ImageService method create.
@Transactional(TxType.NEVER)
public void create(Stack stack, PlatformParameters params, String imageCatalog, Optional<String> imageId, Optional<Blueprint> blueprint) throws CloudbreakImageNotFoundException, CloudbreakImageCatalogException {
try {
Platform platform = platform(stack.cloudPlatform());
String platformString = platform(stack.cloudPlatform()).value().toLowerCase();
String region = stack.getRegion();
SecurityConfig securityConfig = stack.getSecurityConfig();
String cbPrivKey = securityConfig.getCloudbreakSshPrivateKeyDecoded();
byte[] cbSshKeyDer = PkiUtil.getPublicKeyDer(cbPrivKey);
String sshUser = stack.getStackAuthentication().getLoginUserName();
String cbCert = securityConfig.getClientCertRaw();
Map<InstanceGroupType, String> userData = userDataBuilder.buildUserData(platform, cbSshKeyDer, sshUser, params, securityConfig.getSaltBootPassword(), cbCert);
StatedImage imgFromCatalog = determineImageFromCatalog(imageId, platformString, imageCatalog, blueprint);
LOGGER.info("Determined image from catalog: {}", imgFromCatalog);
String imageName = determineImageName(platformString, region, imgFromCatalog.getImage());
LOGGER.info("Selected VM image for CloudPlatform '{}' and region '{}' is: {} from: {} image catalog", platformString, region, imageName, imgFromCatalog.getImageCatalogUrl());
List<Component> components = getComponents(stack, userData, imgFromCatalog.getImage(), imageName, imgFromCatalog.getImageCatalogUrl(), imgFromCatalog.getImageCatalogName(), imgFromCatalog.getImage().getUuid());
componentConfigProvider.store(components);
} catch (JsonProcessingException e) {
throw new CloudbreakServiceException("Failed to create json", e);
}
}
use of com.sequenceiq.cloudbreak.domain.SecurityConfig in project cloudbreak by hortonworks.
the class TlsSecurityService method buildGatewayConfig.
public GatewayConfig buildGatewayConfig(Long stackId, InstanceMetaData gatewayInstance, Integer gatewayPort, SaltClientConfig saltClientConfig, Boolean knoxGatewayEnabled) {
SecurityConfig securityConfig = securityConfigRepository.findOneByStackId(stackId);
String connectionIp = getGatewayIp(securityConfig, gatewayInstance);
HttpClientConfig conf = buildTLSClientConfig(stackId, connectionIp, gatewayInstance);
return new GatewayConfig(connectionIp, gatewayInstance.getPublicIpWrapper(), gatewayInstance.getPrivateIp(), gatewayInstance.getDiscoveryFQDN(), gatewayPort, conf.getServerCert(), conf.getClientCert(), conf.getClientKey(), saltClientConfig.getSaltPassword(), saltClientConfig.getSaltBootPassword(), saltClientConfig.getSignatureKeyPem(), knoxGatewayEnabled, InstanceMetadataType.GATEWAY_PRIMARY.equals(gatewayInstance.getInstanceMetadataType()), securityConfig.getSaltSignPrivateKeyDecoded(), securityConfig.getSaltSignPublicKeyDecoded());
}
Aggregations