mirror of https://github.com/apache/cloudstack.git
missed code in merge of Avoid distributing private key for realhostip.com
This commit is contained in:
parent
c2dc53c2a1
commit
f9dce0bf23
|
|
@ -17,9 +17,11 @@
|
|||
|
||||
package com.cloud.consoleproxy;
|
||||
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.SecureRandom;
|
||||
import java.util.Date;
|
||||
import java.util.Random;
|
||||
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
|
@ -66,7 +68,6 @@ public abstract class AgentHookBase implements AgentHook {
|
|||
ConfigurationDao _configDao;
|
||||
AgentManager _agentMgr;
|
||||
KeystoreManager _ksMgr;
|
||||
final Random _random = new Random(System.currentTimeMillis());
|
||||
KeysManager _keysMgr;
|
||||
|
||||
public AgentHookBase(VMInstanceDao instanceDao, HostDao hostDao, ConfigurationDao cfgDao, KeystoreManager ksMgr, AgentManager agentMgr, KeysManager keysMgr) {
|
||||
|
|
@ -188,8 +189,6 @@ public abstract class AgentHookBase implements AgentHook {
|
|||
@Override
|
||||
public void startAgentHttpHandlerInVM(StartupProxyCommand startupCmd) {
|
||||
StartConsoleProxyAgentHttpHandlerCommand cmd = null;
|
||||
String storePassword = String.valueOf(_random.nextLong());
|
||||
byte[] ksBits = _ksMgr.getKeystoreBits(ConsoleProxyManager.CERTIFICATE_NAME, ConsoleProxyManager.CERTIFICATE_NAME, storePassword);
|
||||
|
||||
try {
|
||||
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
|
||||
|
|
@ -213,13 +212,16 @@ public abstract class AgentHookBase implements AgentHook {
|
|||
HostVO consoleProxyHost = findConsoleProxyHost(startupCmd);
|
||||
|
||||
assert (consoleProxyHost != null);
|
||||
|
||||
Answer answer = _agentMgr.send(consoleProxyHost.getId(), cmd);
|
||||
if (answer == null || !answer.getResult()) {
|
||||
s_logger.error("Console proxy agent reported that it failed to execute http handling startup command");
|
||||
} else {
|
||||
s_logger.info("Successfully sent out command to start HTTP handling in console proxy agent");
|
||||
if (consoleProxyHost != null) {
|
||||
Answer answer = _agentMgr.send(consoleProxyHost.getId(), cmd);
|
||||
if (answer == null || !answer.getResult()) {
|
||||
s_logger.error("Console proxy agent reported that it failed to execute http handling startup command");
|
||||
} else {
|
||||
s_logger.info("Successfully sent out command to start HTTP handling in console proxy agent");
|
||||
}
|
||||
}
|
||||
}catch (NoSuchAlgorithmException e) {
|
||||
s_logger.error("Unexpected exception in SecureRandom Algorithm selection ", e);
|
||||
} catch (AgentUnavailableException e) {
|
||||
s_logger.error("Unable to send http handling startup command to the console proxy resource for proxy:" + startupCmd.getProxyVmId(), e);
|
||||
} catch (OperationTimedoutException e) {
|
||||
|
|
|
|||
|
|
@ -16,11 +16,10 @@
|
|||
// under the License.
|
||||
package com.cloud.consoleproxy;
|
||||
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import com.sun.net.httpserver.HttpsConfigurator;
|
||||
import com.sun.net.httpserver.HttpsParameters;
|
||||
import com.sun.net.httpserver.HttpsServer;
|
||||
import org.apache.cloudstack.utils.security.SSLUtils;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.security.KeyStore;
|
||||
|
||||
import javax.net.ssl.KeyManagerFactory;
|
||||
import javax.net.ssl.SSLContext;
|
||||
|
|
@ -28,10 +27,14 @@ import javax.net.ssl.SSLParameters;
|
|||
import javax.net.ssl.SSLServerSocket;
|
||||
import javax.net.ssl.SSLServerSocketFactory;
|
||||
import javax.net.ssl.TrustManagerFactory;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.security.KeyStore;
|
||||
|
||||
import org.apache.cloudstack.utils.security.SSLUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.sun.net.httpserver.HttpServer;
|
||||
import com.sun.net.httpserver.HttpsConfigurator;
|
||||
import com.sun.net.httpserver.HttpsParameters;
|
||||
import com.sun.net.httpserver.HttpsServer;
|
||||
|
||||
public class ConsoleProxySecureServerFactoryImpl implements ConsoleProxyServerFactory {
|
||||
private static final Logger s_logger = Logger.getLogger(ConsoleProxySecureServerFactoryImpl.class);
|
||||
|
|
|
|||
Loading…
Reference in New Issue