Skip to content

Commit

Permalink
server: add global setting consoleproxy.sslEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
weizhouapache committed Mar 20, 2024
1 parent fe5d741 commit 2261055
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
_consoleProxyPort = NumbersUtil.parseInt(value, ConsoleProxyManager.DEFAULT_PROXY_VNC_PORT);
}

value = configs.get("consoleproxy.sslEnabled");
value = configs.get(ConsoleProxySslEnabled.key());
if (value != null && value.equalsIgnoreCase("true")) {
_sslEnabled = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ public void startAgentHttpHandlerInVM(StartupProxyCommand startupCmd) {
byte[] ksBits = null;

String consoleProxyUrlDomain = _configDao.getValue(Config.ConsoleProxyUrlDomain.key());
String consoleProxySslEnabled = _configDao.getValue("consoleproxy.sslEnabled");
String consoleProxySslEnabled = _configDao.getValue(ConsoleProxyManager.ConsoleProxySslEnabled.key());
if (!StringUtils.isEmpty(consoleProxyUrlDomain) && !StringUtils.isEmpty(consoleProxySslEnabled)
&& consoleProxySslEnabled.equalsIgnoreCase("true")) {
ksBits = _ksMgr.getKeystoreBits(ConsoleProxyManager.CERTIFICATE_NAME, ConsoleProxyManager.CERTIFICATE_NAME, storePassword);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ public interface ConsoleProxyManager extends Manager, ConsoleProxyService {
String ALERT_SUBJECT = "proxy-alert";
String CERTIFICATE_NAME = "CPVMCertificate";

ConfigKey<Boolean> ConsoleProxySslEnabled = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Boolean.class, "consoleproxy.sslEnabled", "false",
"Enable SSL for console proxy", false);

ConfigKey<Boolean> NoVncConsoleDefault = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Boolean.class, "novnc.console.default", "true",
"If true, noVNC console will be default console for virtual machines", true);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu

Map<String, String> configs = configurationDao.getConfiguration("management-server", params);

String value = configs.get("consoleproxy.sslEnabled");
String value = configs.get(ConsoleProxySslEnabled.key());
if (value != null && value.equalsIgnoreCase("true")) {
sslEnabled = true;
}
Expand Down Expand Up @@ -1609,7 +1609,7 @@ public String getConfigComponentName() {

@Override
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] { NoVncConsoleDefault, NoVncConsoleSourceIpCheckEnabled };
return new ConfigKey<?>[] { ConsoleProxySslEnabled, NoVncConsoleDefault, NoVncConsoleSourceIpCheckEnabled };
}

protected ConsoleProxyStatus parseJsonToConsoleProxyStatus(String json) throws JsonParseException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public boolean configure(String name, Map<String, Object> params) throws Configu
_ip = "127.0.0.1";
}

String value = (String)params.get("consoleproxy.sslEnabled");
String value = (String)params.get(ConsoleProxySslEnabled.key());
if (value != null && value.equalsIgnoreCase("true")) {
_sslEnabled = true;
}
Expand Down

0 comments on commit 2261055

Please sign in to comment.