diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientSSLProperties.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientSSLProperties.java index c1bba3784c2..193a563fa09 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientSSLProperties.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/client/ClientSSLProperties.java @@ -17,10 +17,10 @@ package org.eclipse.dstore.core.client; import org.eclipse.dstore.core.model.ISSLProperties; - public class ClientSSLProperties implements ISSLProperties { private boolean _enableSSL = false; + private boolean _disableServerSSL = false; private String _daemonKeyStorePath; private String _daemonKeyStorePassword; @@ -38,6 +38,18 @@ public class ClientSSLProperties implements ISSLProperties _serverKeyStorePassword = serverPassword; } + public ClientSSLProperties(boolean enableSSL, boolean disableServerSSL, + String daemonKeystore, String daemonPassword, + String serverKeystore, String serverPassword) + { + _enableSSL = enableSSL; + _disableServerSSL = disableServerSSL; + _daemonKeyStorePath = daemonKeystore; + _daemonKeyStorePassword = daemonPassword; + _serverKeyStorePath = serverKeystore; + _serverKeyStorePassword = serverPassword; + } + public ClientSSLProperties(boolean enableSSL, String keystore, String password) { _enableSSL = enableSSL; @@ -48,10 +60,27 @@ public class ClientSSLProperties implements ISSLProperties _serverKeyStorePassword = password; } + public ClientSSLProperties(boolean enableSSL, boolean disableServerSSL, String keystore, String password) + { + _enableSSL = enableSSL; + _disableServerSSL = disableServerSSL; + _daemonKeyStorePath = keystore; + _daemonKeyStorePassword = password; + + _serverKeyStorePath = keystore; + _serverKeyStorePassword = password; + } + + public boolean usingSSL() { return _enableSSL; } + + public boolean usingServerSSL() + { + return !_disableServerSSL; + } public String getDaemonKeyStorePassword() diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java index 59d02549bd6..ae45b27a11f 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/DataStore.java @@ -291,16 +291,16 @@ public final class DataStore _loaders.add(loader); } + public boolean usingSSL() { if (_sslProperties != null) { - return _sslProperties.usingSSL(); + return _sslProperties.usingSSL() && _sslProperties.usingServerSSL(); } return false; } - /** * Specifies the security properties of this DataStore. * These properties indicate whether or not to use ssl, diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ISSLProperties.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ISSLProperties.java index 24654107a06..02b9f49a332 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ISSLProperties.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/model/ISSLProperties.java @@ -19,6 +19,7 @@ package org.eclipse.dstore.core.model; public interface ISSLProperties { public boolean usingSSL(); + public boolean usingServerSSL(); public String getDaemonKeyStorePassword(); public String getDaemonKeyStorePath(); public String getServerKeyStorePassword(); diff --git a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerSSLProperties.java b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerSSLProperties.java index 7acdae6a70b..c05f20a411a 100644 --- a/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerSSLProperties.java +++ b/rse/plugins/org.eclipse.dstore.core/src/org/eclipse/dstore/core/server/ServerSSLProperties.java @@ -21,10 +21,11 @@ import java.util.ResourceBundle; import org.eclipse.dstore.core.model.ISSLProperties; - public class ServerSSLProperties implements ISSLProperties { private boolean _enableSSL = false; + private boolean _disableServerSSL = false; + private String _daemonKeyStorePath; private String _daemonKeyStorePassword; @@ -33,6 +34,7 @@ public class ServerSSLProperties implements ISSLProperties private static final String ENABLE_SSL = "enable_ssl"; + private static final String DISABLE_SERVER_SSL = "disable_server_ssl"; private static final String DAEMON_KEYSTORE_FILE = "daemon_keystore_file"; private static final String DAEMON_KEYSTORE_PASSWORD = "daemon_keystore_password"; @@ -46,19 +48,29 @@ public class ServerSSLProperties implements ISSLProperties try { ResourceBundle properties = ResourceBundle.getBundle("ssl"); - if (properties != null) + _enableSSL = properties.getString(ENABLE_SSL).trim().equals("true"); + if (_enableSSL) { - _enableSSL = properties.getString(ENABLE_SSL).trim().equals("true"); - if (_enableSSL) + try + { + _disableServerSSL = properties.getString(DISABLE_SERVER_SSL).trim().equals("true"); + } + catch (Exception e) + { + + } + + try + { + _daemonKeyStorePath = properties.getString(DAEMON_KEYSTORE_FILE).trim(); + _daemonKeyStorePassword = properties.getString(DAEMON_KEYSTORE_PASSWORD).trim(); + } + catch (Exception e) + { + } + + if (!_disableServerSSL) { - try - { - _daemonKeyStorePath = properties.getString(DAEMON_KEYSTORE_FILE).trim(); - _daemonKeyStorePassword = properties.getString(DAEMON_KEYSTORE_PASSWORD).trim(); - } - catch (Exception e) - { - } try { _serverKeyStorePath = properties.getString(SERVER_KEYSTORE_FILE).trim(); @@ -67,40 +79,36 @@ public class ServerSSLProperties implements ISSLProperties catch (Exception e) { } - - if (_daemonKeyStorePath == null && _serverKeyStorePath != null) - { - _daemonKeyStorePath = _serverKeyStorePath; - _daemonKeyStorePassword = _serverKeyStorePassword; - } - if (_serverKeyStorePath == null && _daemonKeyStorePath != null) - { - _serverKeyStorePath = _daemonKeyStorePath; - _serverKeyStorePassword = _daemonKeyStorePassword; - } - } - if (_enableSSL) + if (_daemonKeyStorePath == null && _serverKeyStorePath != null) + { + _daemonKeyStorePath = _serverKeyStorePath; + _daemonKeyStorePassword = _serverKeyStorePassword; + } + if (!_disableServerSSL && _serverKeyStorePath == null && _daemonKeyStorePath != null) + { + _serverKeyStorePath = _daemonKeyStorePath; + _serverKeyStorePassword = _daemonKeyStorePassword; + } + + } + + if (_enableSSL) + { + System.out.println("SSL Settings"); + System.out.println("[daemon keystore:\t"+_daemonKeyStorePath+"]"); + System.out.println("[daemon keystore pw:\t"+_daemonKeyStorePassword+"]"); + if (!_disableServerSSL) { - System.out.println("SSL Settings"); - System.out.println("[daemon keystore:\t"+_daemonKeyStorePath+"]"); - System.out.println("[daemon keystore pw:\t"+_daemonKeyStorePassword+"]"); System.out.println("[server keystore:\t"+_serverKeyStorePath+"]"); System.out.println("[server keystore pw:\t"+_serverKeyStorePassword+"]"); } } - else - { - _enableSSL = false; - } } catch (Exception e) { - // no ssl properties...set to disabled - _enableSSL = false; - - //e.printStackTrace(); + e.printStackTrace(); } } @@ -110,6 +118,11 @@ public class ServerSSLProperties implements ISSLProperties return _enableSSL; } + public boolean usingServerSSL() + { + return !_disableServerSSL; + } + public String getDaemonKeyStorePath() { @@ -131,5 +144,4 @@ public class ServerSSLProperties implements ISSLProperties return _serverKeyStorePassword; } - } \ No newline at end of file diff --git a/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/data/ssl.properties b/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/data/ssl.properties index cf522e0b443..fdeb76073c2 100644 --- a/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/data/ssl.properties +++ b/rse/plugins/org.eclipse.rse.services.dstore/serverruntime/data/ssl.properties @@ -21,6 +21,9 @@ # Specify this property as true to enable SSL enable_ssl=false +# Specify this property as true to disable SSL for the server when daemon ssl is enabled +disable_server_ssl=false + ################################### # Daemon Properties ###################################