cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/4.4 to f9dce0b
Date Thu, 19 Mar 2015 07:35:56 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 c2dc53c2a -> f9dce0bf2


missed code in merge of Avoid distributing private key for realhostip.com


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/f9dce0bf
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/f9dce0bf
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/f9dce0bf

Branch: refs/heads/4.4
Commit: f9dce0bf23a4e2e8b42cfa5137d850c4ea86fe76
Parents: c2dc53c
Author: Daan Hoogland <daan@onecht.net>
Authored: Thu Mar 19 08:34:36 2015 +0100
Committer: Daan Hoogland <daan@onecht.net>
Committed: Thu Mar 19 08:34:36 2015 +0100

----------------------------------------------------------------------
 .../com/cloud/consoleproxy/AgentHookBase.java   | 22 +++++++++++---------
 .../ConsoleProxySecureServerFactoryImpl.java    | 21 +++++++++++--------
 2 files changed, 24 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f9dce0bf/server/src/com/cloud/consoleproxy/AgentHookBase.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/consoleproxy/AgentHookBase.java b/server/src/com/cloud/consoleproxy/AgentHookBase.java
index 05f2b44..c391182 100644
--- a/server/src/com/cloud/consoleproxy/AgentHookBase.java
+++ b/server/src/com/cloud/consoleproxy/AgentHookBase.java
@@ -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) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/f9dce0bf/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxySecureServerFactoryImpl.java
----------------------------------------------------------------------
diff --git a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxySecureServerFactoryImpl.java
b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxySecureServerFactoryImpl.java
index d111527..f28a9f4 100644
--- a/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxySecureServerFactoryImpl.java
+++ b/services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxySecureServerFactoryImpl.java
@@ -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);


Mime
View raw message