Commit 89bc7545 authored by Derek DeMoro's avatar Derek DeMoro Committed by derek

Resolve issue with IP Binding.


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@1043 b35dd754-fafc-0310-a699-88a17e54d16e
parent 5f3a49a3
...@@ -15,13 +15,14 @@ import org.jivesoftware.messenger.JiveGlobals; ...@@ -15,13 +15,14 @@ import org.jivesoftware.messenger.JiveGlobals;
import org.jivesoftware.messenger.XMPPServer; import org.jivesoftware.messenger.XMPPServer;
import org.jivesoftware.util.LocaleUtils; import org.jivesoftware.util.LocaleUtils;
import org.jivesoftware.util.Log; import org.jivesoftware.util.Log;
import java.io.File; import org.mortbay.http.SunJsseListener;
import org.mortbay.jetty.Server; import org.mortbay.jetty.Server;
import org.mortbay.jetty.servlet.WebApplicationContext; import org.mortbay.jetty.servlet.WebApplicationContext;
import org.mortbay.log.*; import org.mortbay.log.Factory;
import org.mortbay.http.SunJsseListener; import org.mortbay.log.LogImpl;
import org.mortbay.http.HttpListener; import org.mortbay.log.OutputStreamLogSink;
import org.mortbay.util.InetAddrPort;
import java.io.File;
/** /**
* The admin console plugin. It starts a Jetty instance on the configured * The admin console plugin. It starts a Jetty instance on the configured
...@@ -60,7 +61,7 @@ public class AdminConsolePlugin implements Plugin { ...@@ -60,7 +61,7 @@ public class AdminConsolePlugin implements Plugin {
public void initializePlugin(PluginManager manager, File pluginDir) { public void initializePlugin(PluginManager manager, File pluginDir) {
try { try {
// Configure logging to a file, creating log dir if needed // Configure logging to a file, creating log dir if needed
System.setProperty("org.apache.commons.logging.LogFactory","org.mortbay.log.Factory"); System.setProperty("org.apache.commons.logging.LogFactory", "org.mortbay.log.Factory");
File logDir = new File(JiveGlobals.getMessengerHome(), "logs"); File logDir = new File(JiveGlobals.getMessengerHome(), "logs");
if (!logDir.exists()) { if (!logDir.exists()) {
logDir.mkdirs(); logDir.mkdirs();
...@@ -68,23 +69,20 @@ public class AdminConsolePlugin implements Plugin { ...@@ -68,23 +69,20 @@ public class AdminConsolePlugin implements Plugin {
File logFile = new File(logDir, "admin-console.log"); File logFile = new File(logDir, "admin-console.log");
OutputStreamLogSink logSink = new OutputStreamLogSink(logFile.toString()); OutputStreamLogSink logSink = new OutputStreamLogSink(logFile.toString());
logSink.start(); logSink.start();
LogImpl log = (LogImpl)Factory.getFactory().getInstance(""); LogImpl log = (LogImpl) Factory.getFactory().getInstance("");
// Ignore INFO logs. // Ignore INFO logs.
log.setVerbose(-1); log.setVerbose(-1);
log.add(logSink); log.add(logSink);
jetty = new Server(); jetty = new Server();
// Configure HTTP socket secureListener // Configure HTTP socket listener
port = JiveGlobals.getXMLProperty("adminConsole.port", 9090); port = JiveGlobals.getXMLProperty("adminConsole.port", 9090);
String domain = JiveGlobals.getProperty("xmpp.domain"); jetty.addListener(Integer.toString(port));
HttpListener httpListener = jetty.addListener(new InetAddrPort(domain, port));
SunJsseListener secureListener = new SunJsseListener();
boolean secureStarted = false; boolean secureStarted = false;
try { try {
SunJsseListener listener = new SunJsseListener();
// Get the keystore location. The default location is security/keystore // Get the keystore location. The default location is security/keystore
String keyStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.keystore", String keyStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.keystore",
"resources" + File.separator + "security" + File.separator + "keystore"); "resources" + File.separator + "security" + File.separator + "keystore");
...@@ -103,14 +101,13 @@ public class AdminConsolePlugin implements Plugin { ...@@ -103,14 +101,13 @@ public class AdminConsolePlugin implements Plugin {
String trustpass = JiveGlobals.getProperty("xmpp.socket.ssl.trustpass", "changeit"); String trustpass = JiveGlobals.getProperty("xmpp.socket.ssl.trustpass", "changeit");
trustpass = trustpass.trim(); trustpass = trustpass.trim();
secureListener.setHost(domain); listener.setKeystore(keyStoreLocation);
secureListener.setKeystore(keyStoreLocation); listener.setKeyPassword(keypass);
secureListener.setKeyPassword(keypass); listener.setPassword(keypass);
secureListener.setPassword(keypass);
securePort = JiveGlobals.getXMLProperty("adminConsole.securePort", 9091); securePort = JiveGlobals.getXMLProperty("adminConsole.securePort", 9091);
secureListener.setPort(securePort); listener.setPort(securePort);
jetty.addListener(secureListener); jetty.addListener(listener);
secureStarted = true; secureStarted = true;
} }
catch (Exception e) { catch (Exception e) {
...@@ -133,9 +130,9 @@ public class AdminConsolePlugin implements Plugin { ...@@ -133,9 +130,9 @@ public class AdminConsolePlugin implements Plugin {
Log.info("Started secure admin console on port: " + securePort); Log.info("Started secure admin console on port: " + securePort);
System.out.println("Admin console listening at:"); System.out.println("Admin console listening at:");
System.out.println(" http://" + System.out.println(" http://" +
httpListener.getHost() + ":" + port); XMPPServer.getInstance().getServerInfo().getName() + ":" + port);
System.out.println(" https://" + System.out.println(" https://" +
secureListener.getHost()+ ":" + securePort); XMPPServer.getInstance().getServerInfo().getName() + ":" + securePort);
} }
} }
catch (Exception e) { 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