Commit bb37a37c authored by Matt Tucker's avatar Matt Tucker Committed by matt

Allow admin console ports to be disabled (JM-209).


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1123 b35dd754-fafc-0310-a699-88a17e54d16e
parent 0cad5b7f
......@@ -17,6 +17,7 @@
<!-- root element, all properties must be under this element -->
<jive>
<adminConsole>
<!-- Disable either port by setting the value to -1 -->
<port>9090</port>
<securePort>9091</securePort>
<!-- By default, only the user with the username "admin" can login
......
......@@ -329,7 +329,7 @@ public class JiveGlobals {
* @return the property value specified by name or <tt>defaultValue</tt>.
*/
public static int getXMLProperty(String name, int defaultValue) {
String value = getProperty(name);
String value = getXMLProperty(name);
if (value != null) {
try {
return Integer.parseInt(value);
......
......@@ -77,38 +77,46 @@ public class AdminConsolePlugin implements Plugin {
jetty = new Server();
// Configure HTTP socket listener
boolean plainStarted = false;
port = JiveGlobals.getXMLProperty("adminConsole.port", 9090);
jetty.addListener(Integer.toString(port));
if (port > 0) {
jetty.addListener(Integer.toString(port));
plainStarted = true;
}
boolean secureStarted = false;
try {
SunJsseListener listener = new SunJsseListener();
// Get the keystore location. The default location is security/keystore
String keyStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.keystore",
"resources" + File.separator + "security" + File.separator + "keystore");
keyStoreLocation = JiveGlobals.getMessengerHome() + File.separator + keyStoreLocation;
// Get the keystore password. The default password is "changeit".
String keypass = JiveGlobals.getProperty("xmpp.socket.ssl.keypass", "changeit");
keypass = keypass.trim();
// Get the truststore location; default at security/truststore
String trustStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.truststore",
"resources" + File.separator + "security" + File.separator + "truststore");
trustStoreLocation = JiveGlobals.getMessengerHome() + File.separator + trustStoreLocation;
// Get the truststore passwprd; default is "changeit".
String trustpass = JiveGlobals.getProperty("xmpp.socket.ssl.trustpass", "changeit");
trustpass = trustpass.trim();
listener.setKeystore(keyStoreLocation);
listener.setKeyPassword(keypass);
listener.setPassword(keypass);
securePort = JiveGlobals.getXMLProperty("adminConsole.securePort", 9091);
listener.setPort(securePort);
jetty.addListener(listener);
secureStarted = true;
if (securePort > 0) {
SunJsseListener listener = new SunJsseListener();
// Get the keystore location. The default location is security/keystore
String keyStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.keystore",
"resources" + File.separator + "security" + File.separator + "keystore");
keyStoreLocation = JiveGlobals.getMessengerHome() + File.separator + keyStoreLocation;
// Get the keystore password. The default password is "changeit".
String keypass = JiveGlobals.getProperty("xmpp.socket.ssl.keypass", "changeit");
keypass = keypass.trim();
// Get the truststore location; default at security/truststore
String trustStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.truststore",
"resources" + File.separator + "security" + File.separator + "truststore");
trustStoreLocation = JiveGlobals.getMessengerHome() + File.separator +
trustStoreLocation;
// Get the truststore passwprd; default is "changeit".
String trustpass = JiveGlobals.getProperty("xmpp.socket.ssl.trustpass", "changeit");
trustpass = trustpass.trim();
listener.setKeystore(keyStoreLocation);
listener.setKeyPassword(keypass);
listener.setPassword(keypass);
listener.setPort(securePort);
jetty.addListener(listener);
secureStarted = true;
}
}
catch (Exception e) {
Log.error(e);
......@@ -121,18 +129,30 @@ public class AdminConsolePlugin implements Plugin {
jetty.start();
Log.info("Started admin console on port: " + port);
if (!secureStarted) {
if (!plainStarted && !secureStarted) {
Log.info("Warning: admin console not started due to configuration settings.");
System.out.println("Warning: admin console not started due to configuration settings.");
}
else if (!plainStarted && secureStarted) {
Log.info("Admin console listening at https://" +
XMPPServer.getInstance().getServerInfo().getName() + ":" + securePort);
System.out.println("Admin console listening at https://" +
XMPPServer.getInstance().getServerInfo().getName() + ":" + securePort);
}
else if (!secureStarted && plainStarted) {
Log.info("Admin console listening at http://" +
XMPPServer.getInstance().getServerInfo().getName() + ":" + port);
System.out.println("Admin console listening at http://" +
XMPPServer.getInstance().getServerInfo().getName() + ":" + port);
}
else {
Log.info("Started secure admin console on port: " + securePort);
System.out.println("Admin console listening at:");
System.out.println(" http://" +
XMPPServer.getInstance().getServerInfo().getName() + ":" + port);
System.out.println(" https://" +
XMPPServer.getInstance().getServerInfo().getName() + ":" + securePort);
String msg = "Admin console listening at:\n" +
" http://" + XMPPServer.getInstance().getServerInfo().getName() + ":" +
port + "\n" +
" https://" + XMPPServer.getInstance().getServerInfo().getName() + ":" +
securePort;
Log.info(msg);
System.out.println(msg);
}
}
catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment