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

CLOUDSTACK-7242: Adding a securing config using configDepo doesnt work by karuturi · Pull Request #34 · apache/cloudstack · GitHub

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

Filter by extension

Filter by extension .java  (3) .js  (1) .sh  (1) All 3 file types 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
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 @@ -210,9 +210,6 @@ public String getValueAndInitIfNotExist(String name, String category, String ini
update(name, category, initValue);
}
} else {
if (category.equals("Hidden") || category.equals("Secure")) {
initValue = DBEncryptionUtil.encrypt(initValue);
}
ConfigurationVO newConfig = new ConfigurationVO(category, "DEFAULT", "management-server", name, initValue, desc);
persist(newConfig);
}
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 @@ -73,8 +73,8 @@ public ConfigurationVO(String category, String instance, String component, Strin
this.instance = instance;
this.component = component;
this.name = name;
this.value = value;
this.description = description;
setValue(value);
}

public ConfigurationVO(String component, ConfigKey<?> key) {
Expand Down Expand Up @@ -122,11 +122,23 @@ public void setName(String name) {

@Override
public String getValue() {
return (("Hidden".equals(getCategory()) || "Secure".equals(getCategory())) ? DBEncryptionUtil.decrypt(value) : value);
if(isEncryptedConfig()) {
return DBEncryptionUtil.decrypt(value);
} else {
return value;
}
}

public void setValue(String value) {
this.value = value;
if(isEncryptedConfig()) {
this.value = DBEncryptionUtil.encrypt(value);
} else {
this.value = value;
}
}

private boolean isEncryptedConfig() {
return "Hidden".equals(getCategory()) || "Secure".equals(getCategory());
}

@Override
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 @@ -203,7 +203,6 @@ public void persistDefaultValues() throws InternalErrorException {
String instance = "DEFAULT";
String component = c.getComponent();
String value = c.getDefaultValue();
value = ("Hidden".equals(category) || "Secure".equals(category)) ? DBEncryptionUtil.encrypt(value) : value;
String description = c.getDescription();
ConfigurationVO configVO = new ConfigurationVO(category, instance, component, name, value, description);
configVO.setDefaultValue(value);
Expand Down Expand Up @@ -635,7 +634,7 @@ protected void updateSSLKeystore() {
}
String base64Keystore = getBase64Keystore(keystorePath);
ConfigurationVO configVO =
new ConfigurationVO("Hidden", "DEFAULT", "management-server", "ssl.keystore", DBEncryptionUtil.encrypt(base64Keystore),
new ConfigurationVO("Hidden", "DEFAULT", "management-server", "ssl.keystore", base64Keystore,
"SSL Keystore for the management servers");
_configDao.persist(configVO);
s_logger.info("Stored SSL keystore to database.");
Expand Down
11 changes: 2 additions & 9 deletions systemvm/patches/debian/config/root/reconfigLB.sh
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 @@ -23,23 +23,16 @@ new_config=$1

# save previous state
mv /etc/haproxy/haproxy.cfg /etc/haproxy/haproxy.cfg.old
mv /var/run/haproxy.pid /var/run/haproxy.pid.old

mv $new_config /etc/haproxy/haproxy.cfg
kill -TTOU $(cat /var/run/haproxy.pid.old)
sleep 2
if haproxy -D -p /var/run/haproxy.pid -f /etc/haproxy/haproxy.cfg; then
if haproxy -p /var/run/haproxy.pid -f /etc/haproxy/haproxy.cfg -sf $(cat /var/run/haproxy.pid); then
logger -t cloud "New haproxy instance successfully loaded, stopping previous one."
kill -KILL $(cat /var/run/haproxy.pid.old)
rm -f /var/run/haproxy.pid.old
ret=0
else
logger -t cloud "New instance failed to start, resuming previous one."
kill -TTIN $(cat /var/run/haproxy.pid.old)
rm -f /var/run/haproxy.pid
mv /var/run/haproxy.pid.old /var/run/haproxy.pid
mv /etc/haproxy/haproxy.cfg $new_config
mv /etc/haproxy/haproxy.cfg.old /etc/haproxy/haproxy.cfg
haproxy -p /var/run/haproxy.pid -f /etc/haproxy/haproxy.cfg -sf $(cat /var/run/haproxy.pid)
ret=1
fi

Expand Down
16 changes: 12 additions & 4 deletions ui/scripts/instances.js
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 @@ -2248,13 +2248,17 @@
} else if (jsonObj.state == 'Running') {
allowedActions.push("stop");
allowedActions.push("restart");
if (jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true)

if ((jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true)
|| (jsonObj.hypervisor != 'LXC')) {
allowedActions.push("snapshot");
}

allowedActions.push("destroy");
allowedActions.push("reinstall");

//when userVm is running, scaleUp is not supported for KVM
if (jsonObj.hypervisor != 'KVM') {
//when userVm is running, scaleUp is not supported for KVM, LXC
if (jsonObj.hypervisor != 'KVM' && jsonObj.hypervisor != 'LXC') {
allowedActions.push("scaleUp");
}

Expand All @@ -2278,8 +2282,12 @@
allowedActions.push("start");
allowedActions.push("destroy");
allowedActions.push("reinstall");
if (jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true)

if ((jsonObj.hypervisor != 'KVM' || g_kvmsnapshotenabled == true)
|| (jsonObj.hypervisor != 'LXC')) {
allowedActions.push("snapshot");
}

allowedActions.push("scaleUp"); //when vm is stopped, scaleUp is supported for all hypervisors
allowedActions.push("changeAffinity");

Expand Down

Back | FazBrowse Home | New Git URL