Commit b719c7d6 authored by Dave Cridland's avatar Dave Cridland Committed by GitHub

Merge pull request #601 from danielhams/adminconsoleinterface

OF-1153 Optionally allow binding admin console to separate network interface
parents bbc3c83f 8f34557c
...@@ -76,6 +76,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana ...@@ -76,6 +76,8 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
super("Connection Manager"); super("Connection Manager");
InetAddress bindAddress = null; InetAddress bindAddress = null;
InetAddress adminConsoleBindAddress = null;
try try
{ {
bindAddress = getListenAddress(); bindAddress = getListenAddress();
...@@ -85,6 +87,19 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana ...@@ -85,6 +87,19 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
Log.warn( "Unable to resolve bind address: ", e ); Log.warn( "Unable to resolve bind address: ", e );
} }
try
{
adminConsoleBindAddress = getAdminConsoleListenAddress();
if( adminConsoleBindAddress == null )
{
adminConsoleBindAddress = bindAddress;
}
}
catch( UnknownHostException e )
{
Log.warn( "Unable to resolve admin console bind address: ", e );
}
final CertificateStoreManager certificateStoreManager = XMPPServer.getInstance().getCertificateStoreManager(); final CertificateStoreManager certificateStoreManager = XMPPServer.getInstance().getCertificateStoreManager();
// client-to-server // client-to-server
...@@ -230,7 +245,7 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana ...@@ -230,7 +245,7 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
null, null,
Connection.TLSPolicy.disabled.name(), // StartTLS over HTTP? Should use webAdminSslListener instead. Connection.TLSPolicy.disabled.name(), // StartTLS over HTTP? Should use webAdminSslListener instead.
null, null,
bindAddress, adminConsoleBindAddress,
certificateStoreManager.getIdentityStoreConfiguration( ConnectionType.WEBADMIN ), certificateStoreManager.getIdentityStoreConfiguration( ConnectionType.WEBADMIN ),
certificateStoreManager.getTrustStoreConfiguration( ConnectionType.WEBADMIN ), certificateStoreManager.getTrustStoreConfiguration( ConnectionType.WEBADMIN ),
null // Should we have compression on the admin console? null // Should we have compression on the admin console?
...@@ -245,7 +260,7 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana ...@@ -245,7 +260,7 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
null, null,
Connection.TLSPolicy.legacyMode.name(), Connection.TLSPolicy.legacyMode.name(),
null, null,
bindAddress, adminConsoleBindAddress,
certificateStoreManager.getIdentityStoreConfiguration( ConnectionType.WEBADMIN ), certificateStoreManager.getIdentityStoreConfiguration( ConnectionType.WEBADMIN ),
certificateStoreManager.getTrustStoreConfiguration( ConnectionType.WEBADMIN ), certificateStoreManager.getTrustStoreConfiguration( ConnectionType.WEBADMIN ),
null // Should we have compression on the admin console? null // Should we have compression on the admin console?
...@@ -343,6 +358,26 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana ...@@ -343,6 +358,26 @@ public class ConnectionManagerImpl extends BasicModule implements ConnectionMana
return bindInterface; return bindInterface;
} }
/**
* Returns the specific network interface on which the Openfire administration
* console should be configured to listen, or null when no such preference
* has been configured.
*
* @return A network interface or null.
* @throws UnknownHostException When the configured network name cannot be resolved.
*/
public InetAddress getAdminConsoleListenAddress() throws UnknownHostException
{
String acInterfaceName = JiveGlobals.getXMLProperty( "adminConsole.interface" );
InetAddress acBindInterface = null;
if (acInterfaceName != null) {
if (acInterfaceName.trim().length() > 0) {
acBindInterface = InetAddress.getByName(acInterfaceName);
}
}
return acBindInterface;
}
/** /**
* Returns all connection listeners. * Returns all connection listeners.
* *
......
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