Commit 13968f72 authored by Matt Tucker's avatar Matt Tucker Committed by matt

Improved SSLConfig loading of custom values (JM-39).


git-svn-id: http://svn.igniterealtime.org/svn/repos/messenger/trunk@698 b35dd754-fafc-0310-a699-88a17e54d16e
parent 7d6051f8
This diff is collapsed.
...@@ -22,7 +22,7 @@ import java.net.ServerSocket; ...@@ -22,7 +22,7 @@ import java.net.ServerSocket;
import java.security.KeyStore; import java.security.KeyStore;
/** /**
* Configuration of Messenger's SSL settings. * Configuration of Jive Messenger's SSL settings.
* *
* @author Iain Shigeoka * @author Iain Shigeoka
*/ */
...@@ -42,17 +42,21 @@ public class SSLConfig { ...@@ -42,17 +42,21 @@ public class SSLConfig {
static { static {
String algorithm = JiveGlobals.getProperty("xmpp.socket.ssl.algorithm", "TLS"); String algorithm = JiveGlobals.getProperty("xmpp.socket.ssl.algorithm", "TLS");
String storeType = JiveGlobals.getProperty("xmpp.socket.ssl.storeType", "jks"); String storeType = JiveGlobals.getProperty("xmpp.socket.ssl.storeType", "jks");
// Get the keystore location. The default location is security/keystore // Get the keystore location. The default location is security/keystore
keyStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.keystore", keyStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.keystore",
JiveGlobals.getMessengerHome() + File.separator + "resources" + File.separator + "resources" + File.separator + "security" + File.separator + "keystore");
"security" + File.separator + "keystore"); keyStoreLocation = JiveGlobals.getMessengerHome() + File.separator + keyStoreLocation;
// Get the keystore password. The default password is "changeit". // Get the keystore password. The default password is "changeit".
keypass = JiveGlobals.getProperty("xmpp.socket.ssl.keypass", "changeit"); keypass = JiveGlobals.getProperty("xmpp.socket.ssl.keypass", "changeit");
keypass = keypass.trim(); keypass = keypass.trim();
// Get the truststore location; default at security/truststore // Get the truststore location; default at security/truststore
trustStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.truststore", trustStoreLocation = JiveGlobals.getProperty("xmpp.socket.ssl.truststore",
JiveGlobals.getMessengerHome() + File.separator + "resources" + File.separator + "resources" + File.separator + "security" + File.separator + "truststore");
"security" + File.separator + "truststore"); trustStoreLocation = JiveGlobals.getMessengerHome() + File.separator + trustStoreLocation;
// Get the truststore passwprd; default is "changeit". // Get the truststore passwprd; default is "changeit".
trustpass = JiveGlobals.getProperty("xmpp.socket.ssl.trustpass", "changeit"); trustpass = JiveGlobals.getProperty("xmpp.socket.ssl.trustpass", "changeit");
trustpass = trustpass.trim(); trustpass = trustpass.trim();
...@@ -64,12 +68,16 @@ public class SSLConfig { ...@@ -64,12 +68,16 @@ public class SSLConfig {
trustStore = KeyStore.getInstance(storeType); trustStore = KeyStore.getInstance(storeType);
trustStore.load(new FileInputStream(trustStoreLocation), trustpass.toCharArray()); trustStore.load(new FileInputStream(trustStoreLocation), trustpass.toCharArray());
sslFactory = (SSLJiveServerSocketFactory) sslFactory = (SSLJiveServerSocketFactory)SSLJiveServerSocketFactory.getInstance(
SSLJiveServerSocketFactory.getInstance(algorithm, algorithm, keyStore, trustStore);
keyStore, trustStore);
} }
catch (Exception e) { catch (Exception e) {
Log.error(e); Log.error("SSLConfig startup problem.\n" +
" storeType: [" + storeType + "]\n" +
" keyStoreLocation: [" + keyStoreLocation + "]\n" +
" keypass: [" + keypass + "]\n" +
" trustStoreLocation: [" + trustStoreLocation+ "]\n" +
" trustpass: [" + trustpass + "]", e);
keyStore = null; keyStore = null;
trustStore = null; trustStore = null;
sslFactory = null; sslFactory = null;
......
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