FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

agent: enable ssl only for kvm agent (not in system vms) by weizhouapache · Pull Request #6371 · apache/cloudstack · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (2) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
23 changes: 0 additions & 23 deletions agent/src/main/java/com/cloud/agent/AgentShell.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.cloud.utils.backoff.BackoffAlgorithm;
import com.cloud.utils.backoff.impl.ConstantTimeBackoff;
import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.cloudstack.utils.security.KeyStoreUtils;
import org.apache.commons.daemon.Daemon;
import org.apache.commons.daemon.DaemonContext;
import org.apache.commons.daemon.DaemonInitException;
Expand Down Expand Up @@ -375,7 +374,6 @@ public void init(String[] args) throws ConfigurationException {

loadProperties();
parseCommand(args);
enableSSL();

if (s_logger.isDebugEnabled()) {
List<String> properties = Collections.list((Enumeration<String>)_properties.propertyNames());
Expand All @@ -399,27 +397,6 @@ public void init(String[] args) throws ConfigurationException {
_backoff.configure("ConstantTimeBackoff", new HashMap<String, Object>());
}

private void enableSSL() {
final File agentFile = PropertiesUtil.findConfigFile("agent.properties");
if (agentFile == null) {
s_logger.info("Failed to find agent.properties file");
return;
}
String keystorePass = getProperty(null, "keystore.passphrase");
if (StringUtils.isBlank(keystorePass)) {
s_logger.info("Failed to find passphrase for keystore: " + KeyStoreUtils.KS_FILENAME);
return;
}
final String keyStoreFile = agentFile.getParent() + "/" + KeyStoreUtils.KS_FILENAME;
File f = new File(keyStoreFile);
if (f.exists() && !f.isDirectory()) {
System.setProperty("javax.net.ssl.trustStore", keyStoreFile);
System.setProperty("javax.net.ssl.trustStorePassword", keystorePass);
} else {
s_logger.info("Failed to find keystore file: " + keyStoreFile);
}
}

private void launchAgent() throws ConfigurationException {
String resourceClassNames = getProperty(null, "resource");
s_logger.trace("resource=" + resourceClassNames);
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ public boolean configure(final String name, final Map<String, Object> params) th
}
}

enableSSLForKvmAgent(params);
configureLocalStorage(params);

/* Directory to use for Qemu sockets like for the Qemu Guest Agent */
Expand Down Expand Up @@ -1282,6 +1283,23 @@ public boolean configure(final String name, final Map<String, Object> params) th
return true;
}

private void enableSSLForKvmAgent(final Map<String, Object> params) {
final File keyStoreFile = PropertiesUtil.findConfigFile(KeyStoreUtils.KS_FILENAME);
if (keyStoreFile == null) {
s_logger.info("Failed to find keystore file: " + KeyStoreUtils.KS_FILENAME);
return;
}
String keystorePass = (String)params.get(KeyStoreUtils.KS_PASSPHRASE_PROPERTY);
if (StringUtils.isBlank(keystorePass)) {
s_logger.info("Failed to find passphrase for keystore: " + KeyStoreUtils.KS_FILENAME);
return;
}
if (keyStoreFile.exists() && !keyStoreFile.isDirectory()) {
System.setProperty("javax.net.ssl.trustStore", keyStoreFile.getAbsolutePath());
System.setProperty("javax.net.ssl.trustStorePassword", keystorePass);
}
}

protected void configureLocalStorage(final Map<String, Object> params) throws ConfigurationException {
String localStoragePath = (String)params.get(LOCAL_STORAGE_PATH);
if (localStoragePath == null) {
Expand Down

Back | FazBrowse Home | New Git URL