public static NetworkSecurityConfig of(boolean sslEnabled, KeyStore keyStore, String keyStorePassword, String trustStoreFile) { return new NetworkSecurityConfig(sslEnabled, null, keyStorePassword, trustStoreFile, keyStore); }
@Override public SSLEngine newSSLEngine() { try { SSLContext ctx = newSSLContext(); return ctx.createSSLEngine(); } catch (Exception ex) { throw new IllegalStateException("Failed to create SSLEngine", ex); } }
@Override public SSLContext newSSLContext() { try { final char[] password = getKeyStorePassword(); KeyStore engineKeyStore = config.getKeyStore(); if (engineKeyStore == null) { engineKeyStore = loadKeyStoreFromFile(password); } final String defaultAlgorithm = KeyManagerFactory.getDefaultAlgorithm(); KeyManagerFactory keyManagerFactory = KeyManagerFactory.getInstance(defaultAlgorithm); TrustManagerFactory trustManagerFactory = TrustManagerFactory.getInstance(defaultAlgorithm); keyManagerFactory.init(engineKeyStore, "".toCharArray()); final KeyStore trustStore = loadTrustStoreFromFile(password); trustManagerFactory.init(trustStore); SSLContext ctx = SSLContext.getInstance(TSL_VERSION); ctx.init(keyManagerFactory.getKeyManagers(), trustManagerFactory.getTrustManagers(), new SecureRandom()); return ctx; } catch (Exception ex) { throw new IllegalStateException("Failed to create SSLEngine", ex); } }
protected INetworkSecurityConfig getNetworkSecurityConfig() { return NetworkSecurityConfig.of(ncConfig.isSslEnabled(), ncConfig.getKeyStorePath(), ncConfig.getKeyStorePassword(), ncConfig.getTrustStorePath()); } }
public ClusterControllerService(final CCConfig config, final ICCApplication application) throws Exception { this.ccConfig = config; this.configManager = ccConfig.getConfigManager(); if (application == null) { throw new IllegalArgumentException("ICCApplication cannot be null"); } this.application = application; File jobLogFolder = new File(ccConfig.getRootDir(), "logs/jobs"); jobLog = new LogFile(jobLogFolder); final INetworkSecurityConfig securityConfig = getNetworkSecurityConfig(); networkSecurityManager = new NetworkSecurityManager(securityConfig); // WorkQueue is in charge of heartbeat as well as other events. workQueue = new WorkQueue("ClusterController", Thread.MAX_PRIORITY); this.timer = new Timer(true); final ClusterTopology topology = computeClusterTopology(ccConfig); ccContext = new ClusterControllerContext(topology); sweeper = new DeadNodeSweeper(); resultDirectoryService = new ResultDirectoryService(ccConfig.getResultTTL(), ccConfig.getResultSweepThreshold()); deploymentRunMap = new HashMap<>(); stateDumpRunMap = new HashMap<>(); threadDumpRunMap = Collections.synchronizedMap(new HashMap<>()); // Node manager is in charge of cluster membership management. nodeManager = new NodeManager(this, ccConfig, resourceManager, application.getGatekeeper()); ccId = ccConfig.getCcId(); jobIdFactory = new JobIdFactory(ccId); deployedJobSpecIdFactory = new DeployedJobSpecIdFactory(); }
protected INetworkSecurityConfig getNetworkSecurityConfig() { return NetworkSecurityConfig.of(ccConfig.isSslEnabled(), ccConfig.getKeyStorePath(), ccConfig.getKeyStorePassword(), ccConfig.getTrustStorePath()); } }
networkSecurityManager = new NetworkSecurityManager(securityConfig); this.application = application; id = ncConfig.getNodeId();
public static NetworkSecurityConfig of(boolean sslEnabled, String keyStoreFile, String keyStorePassword, String trustStoreFile) { return new NetworkSecurityConfig(sslEnabled, keyStoreFile, keyStorePassword, trustStoreFile, null); }