GUAC-587: Default to localhost:4822 for guacd. Fix absence of SSL support within JDBC auth tunnels.

This commit is contained in:
Michael Jumper
2015-05-12 13:59:10 -07:00
parent 190f61d927
commit 2c027e9cb2
3 changed files with 37 additions and 13 deletions

View File

@@ -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
);

View File

@@ -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;