mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 05:07:41 +00:00
GUAC-587: Default to localhost:4822 for guacd. Fix absence of SSL support within JDBC auth tunnels.
This commit is contained in:
@@ -98,6 +98,18 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
|
||||
@Inject
|
||||
private ConnectionRecordMapper connectionRecordMapper;
|
||||
|
||||
/**
|
||||
* The hostname to use when connecting to guacd if no hostname is provided
|
||||
* within guacamole.properties.
|
||||
*/
|
||||
private static final String DEFAULT_GUACD_HOSTNAME = "localhost";
|
||||
|
||||
/**
|
||||
* The port to use when connecting to guacd if no port is provided within
|
||||
* guacamole.properties.
|
||||
*/
|
||||
private static final int DEFAULT_GUACD_PORT = 4822;
|
||||
|
||||
/**
|
||||
* All active connections through the tunnel having a given UUID.
|
||||
*/
|
||||
@@ -266,17 +278,17 @@ public abstract class AbstractGuacamoleTunnelService implements GuacamoleTunnelS
|
||||
throws GuacamoleException {
|
||||
|
||||
// Use SSL if requested
|
||||
if (environment.getProperty(Environment.GUACD_SSL, true))
|
||||
return new ManagedInetGuacamoleSocket(
|
||||
environment.getRequiredProperty(Environment.GUACD_HOSTNAME),
|
||||
environment.getRequiredProperty(Environment.GUACD_PORT),
|
||||
if (environment.getProperty(Environment.GUACD_SSL, false))
|
||||
return new ManagedSSLGuacamoleSocket(
|
||||
environment.getProperty(Environment.GUACD_HOSTNAME, DEFAULT_GUACD_HOSTNAME),
|
||||
environment.getProperty(Environment.GUACD_PORT, DEFAULT_GUACD_PORT),
|
||||
socketClosedCallback
|
||||
);
|
||||
|
||||
// Otherwise, just use straight TCP
|
||||
return new ManagedInetGuacamoleSocket(
|
||||
environment.getRequiredProperty(Environment.GUACD_HOSTNAME),
|
||||
environment.getRequiredProperty(Environment.GUACD_PORT),
|
||||
environment.getProperty(Environment.GUACD_HOSTNAME, DEFAULT_GUACD_HOSTNAME),
|
||||
environment.getProperty(Environment.GUACD_PORT, DEFAULT_GUACD_PORT),
|
||||
socketClosedCallback
|
||||
);
|
||||
|
||||
|
@@ -23,15 +23,15 @@
|
||||
package org.glyptodon.guacamole.auth.jdbc.tunnel;
|
||||
|
||||
import org.glyptodon.guacamole.GuacamoleException;
|
||||
import org.glyptodon.guacamole.net.InetGuacamoleSocket;
|
||||
import org.glyptodon.guacamole.net.SSLGuacamoleSocket;
|
||||
|
||||
/**
|
||||
* Implementation of GuacamoleSocket which connects via TCP to a given hostname
|
||||
* Implementation of GuacamoleSocket which connects via SSL to a given hostname
|
||||
* and port. If the socket is closed for any reason, a given task is run.
|
||||
*
|
||||
* @author Michael Jumper
|
||||
*/
|
||||
public class ManagedInetGuacamoleSocket extends InetGuacamoleSocket {
|
||||
public class ManagedSSLGuacamoleSocket extends SSLGuacamoleSocket {
|
||||
|
||||
/**
|
||||
* The task to run when the socket is closed.
|
||||
@@ -39,7 +39,7 @@ public class ManagedInetGuacamoleSocket extends InetGuacamoleSocket {
|
||||
private final Runnable socketClosedTask;
|
||||
|
||||
/**
|
||||
* Creates a new socket which connects via TCP to a given hostname and
|
||||
* Creates a new socket which connects via SSL to a given hostname and
|
||||
* port. If the socket is closed for any reason, the given task is run.
|
||||
*
|
||||
* @param hostname
|
||||
@@ -56,7 +56,7 @@ public class ManagedInetGuacamoleSocket extends InetGuacamoleSocket {
|
||||
* @throws GuacamoleException
|
||||
* If an error occurs while connecting to the Guacamole proxy server.
|
||||
*/
|
||||
public ManagedInetGuacamoleSocket(String hostname, int port,
|
||||
public ManagedSSLGuacamoleSocket(String hostname, int port,
|
||||
Runnable socketClosedTask) throws GuacamoleException {
|
||||
super(hostname, port);
|
||||
this.socketClosedTask = socketClosedTask;
|
||||
|
@@ -45,6 +45,18 @@ import org.glyptodon.guacamole.protocol.GuacamoleConfiguration;
|
||||
*/
|
||||
public class SimpleConnection extends AbstractConnection {
|
||||
|
||||
/**
|
||||
* The hostname to use when connecting to guacd if no hostname is provided
|
||||
* within guacamole.properties.
|
||||
*/
|
||||
private static final String DEFAULT_GUACD_HOSTNAME = "localhost";
|
||||
|
||||
/**
|
||||
* The port to use when connecting to guacd if no port is provided within
|
||||
* guacamole.properties.
|
||||
*/
|
||||
private static final int DEFAULT_GUACD_PORT = 4822;
|
||||
|
||||
/**
|
||||
* Backing configuration, containing all sensitive information.
|
||||
*/
|
||||
@@ -92,8 +104,8 @@ public class SimpleConnection extends AbstractConnection {
|
||||
Environment env = new LocalEnvironment();
|
||||
|
||||
// Get guacd connection parameters
|
||||
String hostname = env.getProperty(Environment.GUACD_HOSTNAME);
|
||||
int port = env.getProperty(Environment.GUACD_PORT);
|
||||
String hostname = env.getProperty(Environment.GUACD_HOSTNAME, DEFAULT_GUACD_HOSTNAME);
|
||||
int port = env.getProperty(Environment.GUACD_PORT, DEFAULT_GUACD_PORT);
|
||||
|
||||
GuacamoleSocket socket;
|
||||
|
||||
|
Reference in New Issue
Block a user