mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-06 13:17:41 +00:00
GUAC-915: Clean up all log messages within Guacamole.
This commit is contained in:
@@ -113,7 +113,7 @@ public class NoAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
|
|
||||||
// Get configuration file
|
// Get configuration file
|
||||||
File configFile = getConfigurationFile();
|
File configFile = getConfigurationFile();
|
||||||
logger.info("Reading configuration file: {}", configFile);
|
logger.debug("Reading configuration file: \"{}\"", configFile);
|
||||||
|
|
||||||
// Parse document
|
// Parse document
|
||||||
try {
|
try {
|
||||||
@@ -135,10 +135,10 @@ public class NoAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
throw new GuacamoleServerException("Error reading configuration file: " + e.getMessage(), e);
|
throw new GuacamoleServerException("Error reading configuration file.", e);
|
||||||
}
|
}
|
||||||
catch (SAXException e) {
|
catch (SAXException e) {
|
||||||
throw new GuacamoleServerException("Error parsing XML file: " + e.getMessage(), e);
|
throw new GuacamoleServerException("Error parsing XML file.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -153,7 +153,7 @@ public class NoAuthenticationProvider extends SimpleAuthenticationProvider {
|
|||||||
// If modified recently, gain exclusive access and recheck
|
// If modified recently, gain exclusive access and recheck
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
if (configFile.exists() && configTime < configFile.lastModified()) {
|
if (configFile.exists() && configTime < configFile.lastModified()) {
|
||||||
logger.info("Config file {} has been modified.", configFile);
|
logger.debug("Configuration file \"{}\" has been modified.", configFile);
|
||||||
init(); // If still not up to date, re-init
|
init(); // If still not up to date, re-init
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -417,7 +417,7 @@ public abstract class GuacamoleHTTPTunnelServlet extends HttpServlet {
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (GuacamoleConnectionClosedException e) {
|
catch (GuacamoleConnectionClosedException e) {
|
||||||
logger.debug("Connection closed.", e);
|
logger.debug("Connection to guacd closed.", e);
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
|
||||||
|
@@ -119,7 +119,7 @@ public abstract class GuacamoleWebSocketTunnelEndpoint extends Endpoint {
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Connection failed: {}", e.getMessage());
|
logger.error("Creation of WebSocket tunnel to guacd failed: {}", e.getMessage());
|
||||||
logger.debug("Error connecting WebSocket tunnel.", e);
|
logger.debug("Error connecting WebSocket tunnel.", e);
|
||||||
closeConnection(session, e.getStatus());
|
closeConnection(session, e.getStatus());
|
||||||
return;
|
return;
|
||||||
@@ -177,16 +177,17 @@ public abstract class GuacamoleWebSocketTunnelEndpoint extends Endpoint {
|
|||||||
// to pass within the WebSocket connection, logging
|
// to pass within the WebSocket connection, logging
|
||||||
// each error appropriately.
|
// each error appropriately.
|
||||||
catch (GuacamoleClientException e) {
|
catch (GuacamoleClientException e) {
|
||||||
logger.warn("Client request rejected: {}", e.getMessage());
|
logger.info("WebSocket connection terminated: {}", e.getMessage());
|
||||||
|
logger.debug("WebSocket connection terminated due to client error.", e);
|
||||||
closeConnection(session, e.getStatus());
|
closeConnection(session, e.getStatus());
|
||||||
}
|
}
|
||||||
catch (GuacamoleConnectionClosedException e) {
|
catch (GuacamoleConnectionClosedException e) {
|
||||||
logger.debug("Connection closed.", e);
|
logger.debug("Connection to guacd closed.", e);
|
||||||
closeConnection(session, GuacamoleStatus.SUCCESS);
|
closeConnection(session, GuacamoleStatus.SUCCESS);
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Connection terminated abnormally: {}", e.getMessage());
|
logger.error("Connection to guacd terminated abnormally: {}", e.getMessage());
|
||||||
logger.debug("Internal error during connection.", e);
|
logger.debug("Internal error during connection to guacd.", e);
|
||||||
closeConnection(session, e.getStatus());
|
closeConnection(session, e.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,10 +214,10 @@ public abstract class GuacamoleWebSocketTunnelEndpoint extends Endpoint {
|
|||||||
writer.write(message.toCharArray());
|
writer.write(message.toCharArray());
|
||||||
}
|
}
|
||||||
catch (GuacamoleConnectionClosedException e) {
|
catch (GuacamoleConnectionClosedException e) {
|
||||||
logger.debug("Connection closed.", e);
|
logger.debug("Connection to guacd closed.", e);
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.debug("Tunnel write failed.", e);
|
logger.debug("WebSocket tunnel write failed.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
tunnel.releaseWriter();
|
tunnel.releaseWriter();
|
||||||
|
@@ -101,7 +101,7 @@ public class BasicFileAuthenticationProvider extends SimpleAuthenticationProvide
|
|||||||
(user_mapping_file.exists()
|
(user_mapping_file.exists()
|
||||||
&& mod_time < user_mapping_file.lastModified())) {
|
&& mod_time < user_mapping_file.lastModified())) {
|
||||||
|
|
||||||
logger.info("Reading user mapping file: {}", user_mapping_file);
|
logger.debug("Reading user mapping file: \"{}\"", user_mapping_file);
|
||||||
|
|
||||||
// Parse document
|
// Parse document
|
||||||
try {
|
try {
|
||||||
|
@@ -116,8 +116,8 @@ public class AuthenticatingFilter implements Filter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Unable to read Guacamole configuration: {}", e.getMessage());
|
logger.error("Unable to read guacamole.properties: {}", e.getMessage());
|
||||||
logger.debug("Error reading Guacamole configuration.", e);
|
logger.debug("Error reading guacamole.properties.", e);
|
||||||
throw new ServletException(e);
|
throw new ServletException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -364,7 +364,7 @@ public class AuthenticatingFilter implements Filter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
logger.warn("Invalid HTTP Basic \"Authorization\" header received.");
|
logger.info("Invalid HTTP Basic \"Authorization\" header received.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,9 +398,16 @@ public class AuthenticatingFilter implements Filter {
|
|||||||
// If auth failed, notify listeners
|
// If auth failed, notify listeners
|
||||||
if (context == null) {
|
if (context == null) {
|
||||||
|
|
||||||
if (logger.isWarnEnabled())
|
if (logger.isWarnEnabled()) {
|
||||||
logger.warn("Authentication attempt from {} for user \"{}\" failed.",
|
|
||||||
|
// Only bother logging failures involving usernames
|
||||||
|
if (credentials.getUsername() != null)
|
||||||
|
logger.info("Authentication attempt from {} for user \"{}\" failed.",
|
||||||
getLoggableAddress(request), credentials.getUsername());
|
getLoggableAddress(request), credentials.getUsername());
|
||||||
|
else
|
||||||
|
logger.debug("Authentication attempt from {} without username failed.",
|
||||||
|
getLoggableAddress(request));
|
||||||
|
}
|
||||||
|
|
||||||
notifyFailed(listeners, credentials);
|
notifyFailed(listeners, credentials);
|
||||||
}
|
}
|
||||||
@@ -425,12 +432,13 @@ public class AuthenticatingFilter implements Filter {
|
|||||||
// Catch any thrown guacamole exception and attempt to pass within the
|
// Catch any thrown guacamole exception and attempt to pass within the
|
||||||
// HTTP response, logging each error appropriately.
|
// HTTP response, logging each error appropriately.
|
||||||
catch (GuacamoleClientException e) {
|
catch (GuacamoleClientException e) {
|
||||||
logger.warn("Client request rejected: {}", e.getMessage());
|
logger.info("HTTP request rejected: {}", e.getMessage());
|
||||||
|
logger.debug("HTTP request rejected by AuthenticatingFilter.", e);
|
||||||
sendError(response, e.getStatus(), e.getMessage());
|
sendError(response, e.getStatus(), e.getMessage());
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Authentication failed internally: {}", e.getMessage());
|
logger.error("Authentication failed internally: {}", e.getMessage());
|
||||||
logger.debug("Internal server error.", e);
|
logger.debug("Internal server error during authentication.", e);
|
||||||
sendError(response, e.getStatus(), "Internal server error.");
|
sendError(response, e.getStatus(), "Internal server error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -45,11 +45,14 @@ public class BasicGuacamoleTunnelServlet extends GuacamoleHTTPTunnelServlet {
|
|||||||
@Override
|
@Override
|
||||||
protected GuacamoleTunnel doConnect(HttpServletRequest request) throws GuacamoleException {
|
protected GuacamoleTunnel doConnect(HttpServletRequest request) throws GuacamoleException {
|
||||||
|
|
||||||
// Warn of lack of WebSocket
|
// Attempt to create HTTP tunnel
|
||||||
logger.warn("Using HTTP tunnel (not WebSocket). Performance may be sub-optimal.");
|
GuacamoleTunnel tunnel = BasicTunnelRequestUtility.createTunnel(new HTTPTunnelRequest(request));
|
||||||
|
|
||||||
return BasicTunnelRequestUtility.createTunnel(new HTTPTunnelRequest(request));
|
// If successful, warn of lack of WebSocket
|
||||||
}
|
logger.info("Using HTTP tunnel (not WebSocket). Performance may be sub-optimal.");
|
||||||
|
|
||||||
|
return tunnel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@@ -45,7 +45,7 @@ public class BasicLogin extends RestrictedHttpServlet {
|
|||||||
protected void restrictedService(
|
protected void restrictedService(
|
||||||
UserContext context,
|
UserContext context,
|
||||||
HttpServletRequest request, HttpServletResponse response) {
|
HttpServletRequest request, HttpServletResponse response) {
|
||||||
logger.info("Login was successful.");
|
logger.debug("Login was successful for user \"{}\".", context.self().getUsername());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -164,7 +164,7 @@ public class BasicTunnelRequestUtility {
|
|||||||
listeners = new SessionListenerCollection(httpSession);
|
listeners = new SessionListenerCollection(httpSession);
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Authentication canceled: failed to retrieve listeners: {}", e.getMessage());
|
logger.error("Creation of tunnel to guacd aborted: Failed to retrieve listeners: {}", e.getMessage());
|
||||||
logger.debug("Error retrieving listeners.", e);
|
logger.debug("Error retrieving listeners.", e);
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
@@ -235,13 +235,13 @@ public class BasicTunnelRequestUtility {
|
|||||||
// Get authorized connection
|
// Get authorized connection
|
||||||
Connection connection = directory.get(id);
|
Connection connection = directory.get(id);
|
||||||
if (connection == null) {
|
if (connection == null) {
|
||||||
logger.warn("Connection id={} not found.", id);
|
logger.info("Connection \"{}\" does not exist for user \"{}\".", id, context.self().getUsername());
|
||||||
throw new GuacamoleSecurityException("Requested connection is not authorized.");
|
throw new GuacamoleSecurityException("Requested connection is not authorized.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect socket
|
// Connect socket
|
||||||
socket = connection.connect(info);
|
socket = connection.connect(info);
|
||||||
logger.info("Successful connection to \"{}\".", id);
|
logger.info("User \"{}\" successfully connected to \"{}\".", context.self().getUsername(), id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -255,13 +255,13 @@ public class BasicTunnelRequestUtility {
|
|||||||
// Get authorized connection group
|
// Get authorized connection group
|
||||||
ConnectionGroup group = directory.get(id);
|
ConnectionGroup group = directory.get(id);
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
logger.warn("Connection group id={} not found.", id);
|
logger.info("Connection group \"{}\" does not exist for user \"{}\".", id, context.self().getUsername());
|
||||||
throw new GuacamoleSecurityException("Requested connection group is not authorized.");
|
throw new GuacamoleSecurityException("Requested connection group is not authorized.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Connect socket
|
// Connect socket
|
||||||
socket = group.connect(info);
|
socket = group.connect(info);
|
||||||
logger.info("Successful connection to group \"{}\".", id);
|
logger.info("User \"{}\" successfully connected to group \"{}\".", context.self().getUsername(), id);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,7 +283,8 @@ public class BasicTunnelRequestUtility {
|
|||||||
return new MonitoringGuacamoleReader(clipboard, super.acquireReader());
|
return new MonitoringGuacamoleReader(clipboard, super.acquireReader());
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.warn("Clipboard integration disabled due to error.", e);
|
logger.warn("Clipboard integration failed to initialize: {}", e.getMessage());
|
||||||
|
logger.debug("Error setting up clipboard integration.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pass through by default.
|
// Pass through by default.
|
||||||
@@ -307,7 +308,7 @@ public class BasicTunnelRequestUtility {
|
|||||||
|
|
||||||
// Notify listeners about connection
|
// Notify listeners about connection
|
||||||
if (!notifyConnect(listeners, context, credentials, tunnel)) {
|
if (!notifyConnect(listeners, context, credentials, tunnel)) {
|
||||||
logger.info("Connection canceled by listener.");
|
logger.info("Successful connection canceled by hook.");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -77,7 +77,7 @@ public class RestrictedFilter implements Filter {
|
|||||||
final GuacamoleStatus status = GuacamoleStatus.CLIENT_UNAUTHORIZED;
|
final GuacamoleStatus status = GuacamoleStatus.CLIENT_UNAUTHORIZED;
|
||||||
final String message = "Not authenticated";
|
final String message = "Not authenticated";
|
||||||
|
|
||||||
logger.warn("Client request rejected: {}", message);
|
logger.info("HTTP request rejected: {}", message);
|
||||||
response.addHeader("Guacamole-Status-Code", Integer.toString(status.getGuacamoleStatusCode()));
|
response.addHeader("Guacamole-Status-Code", Integer.toString(status.getGuacamoleStatusCode()));
|
||||||
response.addHeader("Guacamole-Error-Message", message);
|
response.addHeader("Guacamole-Error-Message", message);
|
||||||
response.sendError(status.getHttpStatusCode());
|
response.sendError(status.getHttpStatusCode());
|
||||||
|
@@ -118,7 +118,7 @@ public abstract class RestrictedHttpServlet extends HttpServlet {
|
|||||||
// Catch any thrown guacamole exception and attempt to pass within the
|
// Catch any thrown guacamole exception and attempt to pass within the
|
||||||
// HTTP response, logging each error appropriately.
|
// HTTP response, logging each error appropriately.
|
||||||
catch (GuacamoleClientException e) {
|
catch (GuacamoleClientException e) {
|
||||||
logger.warn("Client request rejected: {}", e.getMessage());
|
logger.debug("HTTP request rejected by RestrictedHttpServlet.", e);
|
||||||
sendError(response, e.getStatus(), e.getMessage());
|
sendError(response, e.getStatus(), e.getMessage());
|
||||||
}
|
}
|
||||||
catch (GuacamoleUnsupportedException e) {
|
catch (GuacamoleUnsupportedException e) {
|
||||||
@@ -126,8 +126,8 @@ public abstract class RestrictedHttpServlet extends HttpServlet {
|
|||||||
sendError(response, e.getStatus(), e.getMessage());
|
sendError(response, e.getStatus(), e.getMessage());
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Request failed: {}", e.getMessage());
|
logger.error("HTTP request failed: {}", e.getMessage());
|
||||||
logger.debug("Internal server error.", e);
|
logger.debug("Internal server error while handling HTTP request to restricted resource.", e);
|
||||||
sendError(response, e.getStatus(), "Internal server error.");
|
sendError(response, e.getStatus(), "Internal server error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -47,7 +47,7 @@ public class SessionKeepAlive extends RestrictedHttpServlet {
|
|||||||
HttpServletRequest request, HttpServletResponse response) {
|
HttpServletRequest request, HttpServletResponse response) {
|
||||||
|
|
||||||
// Do nothing
|
// Do nothing
|
||||||
logger.trace("Keep-alive signal received.");
|
logger.debug("Keep-alive signal received from user \"{}\".", context.self().getUsername());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -249,7 +249,7 @@ public class List extends RestrictedHttpServlet {
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
logger.error("Unable to read \"{}\": {}", file.getAbsolutePath(), e.getMessage());
|
logger.error("Unable to read connection parameter information from \"{}\": {}", file.getAbsolutePath(), e.getMessage());
|
||||||
logger.debug("Error reading protocol XML.", e);
|
logger.debug("Error reading protocol XML.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,6 +66,8 @@ public class LogbackInitializer implements ServletContextListener {
|
|||||||
logger.info("Loading logback configuration from \"{}\".", logbackConfiguration);
|
logger.info("Loading logback configuration from \"{}\".", logbackConfiguration);
|
||||||
|
|
||||||
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
|
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
|
||||||
|
context.reset();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Initialize logback
|
// Initialize logback
|
||||||
|
@@ -181,7 +181,7 @@ public class WebSocketSupportLoader implements ServletContextListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Warn of lack of WebSocket
|
// Warn of lack of WebSocket
|
||||||
logger.debug("WebSocket support NOT present. Only HTTP will be used.");
|
logger.info("WebSocket support NOT present. Only HTTP will be used.");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -79,7 +79,7 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
|
|||||||
tunnel = doConnect(request);
|
tunnel = doConnect(request);
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Connection failed: {}", e.getMessage());
|
logger.error("Creation of WebSocket tunnel to guacd failed: {}", e.getMessage());
|
||||||
logger.debug("Error connecting WebSocket tunnel.", e);
|
logger.debug("Error connecting WebSocket tunnel.", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -96,10 +96,10 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
|
|||||||
writer.write(string.toCharArray());
|
writer.write(string.toCharArray());
|
||||||
}
|
}
|
||||||
catch (GuacamoleConnectionClosedException e) {
|
catch (GuacamoleConnectionClosedException e) {
|
||||||
logger.debug("Connection closed.", e);
|
logger.debug("Connection to guacd closed.", e);
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.debug("Tunnel write failed.", e);
|
logger.debug("WebSocket tunnel write failed.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
tunnel.releaseWriter();
|
tunnel.releaseWriter();
|
||||||
@@ -150,22 +150,23 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
|
|||||||
// to pass within the WebSocket connection, logging
|
// to pass within the WebSocket connection, logging
|
||||||
// each error appropriately.
|
// each error appropriately.
|
||||||
catch (GuacamoleClientException e) {
|
catch (GuacamoleClientException e) {
|
||||||
logger.warn("Client request rejected: {}", e.getMessage());
|
logger.info("WebSocket connection terminated: {}", e.getMessage());
|
||||||
|
logger.debug("WebSocket connection terminated due to client error.", e);
|
||||||
closeConnection(connection, e.getStatus());
|
closeConnection(connection, e.getStatus());
|
||||||
}
|
}
|
||||||
catch (GuacamoleConnectionClosedException e) {
|
catch (GuacamoleConnectionClosedException e) {
|
||||||
logger.debug("Connection closed.", e);
|
logger.debug("Connection to guacd closed.", e);
|
||||||
closeConnection(connection, GuacamoleStatus.SUCCESS);
|
closeConnection(connection, GuacamoleStatus.SUCCESS);
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Connection terminated abnormally: {}", e.getMessage());
|
logger.error("Connection to guacd terminated abnormally: {}", e.getMessage());
|
||||||
logger.debug("Internal error during connection.", e);
|
logger.debug("Internal error during connection to guacd.", e);
|
||||||
closeConnection(connection, e.getStatus());
|
closeConnection(connection, e.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
logger.debug("Tunnel read failed due to I/O error.", e);
|
logger.debug("WebSocket tunnel read failed due to I/O error.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -183,7 +184,7 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
|
|||||||
tunnel.close();
|
tunnel.close();
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.debug("Unable to close WebSocket tunnel.", e);
|
logger.debug("Unable to close connection to guacd.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -107,7 +107,7 @@ public abstract class GuacamoleWebSocketTunnelListener implements WebSocketListe
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Connection failed: {}", e.getMessage());
|
logger.error("Creation of WebSocket tunnel to guacd failed: {}", e.getMessage());
|
||||||
logger.debug("Error connecting WebSocket tunnel.", e);
|
logger.debug("Error connecting WebSocket tunnel.", e);
|
||||||
closeConnection(session, e.getStatus());
|
closeConnection(session, e.getStatus());
|
||||||
return;
|
return;
|
||||||
@@ -163,16 +163,17 @@ public abstract class GuacamoleWebSocketTunnelListener implements WebSocketListe
|
|||||||
// to pass within the WebSocket connection, logging
|
// to pass within the WebSocket connection, logging
|
||||||
// each error appropriately.
|
// each error appropriately.
|
||||||
catch (GuacamoleClientException e) {
|
catch (GuacamoleClientException e) {
|
||||||
logger.warn("Client request rejected: {}", e.getMessage());
|
logger.info("WebSocket connection terminated: {}", e.getMessage());
|
||||||
|
logger.debug("WebSocket connection terminated due to client error.", e);
|
||||||
closeConnection(session, e.getStatus());
|
closeConnection(session, e.getStatus());
|
||||||
}
|
}
|
||||||
catch (GuacamoleConnectionClosedException e) {
|
catch (GuacamoleConnectionClosedException e) {
|
||||||
logger.debug("Connection closed.", e);
|
logger.debug("Connection to guacd closed.", e);
|
||||||
closeConnection(session, GuacamoleStatus.SUCCESS);
|
closeConnection(session, GuacamoleStatus.SUCCESS);
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Connection terminated abnormally: {}", e.getMessage());
|
logger.error("Connection to guacd terminated abnormally: {}", e.getMessage());
|
||||||
logger.debug("Internal error during connection.", e);
|
logger.debug("Internal error during connection to guacd.", e);
|
||||||
closeConnection(session, e.getStatus());
|
closeConnection(session, e.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -199,10 +200,10 @@ public abstract class GuacamoleWebSocketTunnelListener implements WebSocketListe
|
|||||||
writer.write(message.toCharArray());
|
writer.write(message.toCharArray());
|
||||||
}
|
}
|
||||||
catch (GuacamoleConnectionClosedException e) {
|
catch (GuacamoleConnectionClosedException e) {
|
||||||
logger.debug("Connection closed.", e);
|
logger.debug("Connection to guacd closed.", e);
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.debug("Tunnel write failed.", e);
|
logger.debug("WebSocket tunnel write failed.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
tunnel.releaseWriter();
|
tunnel.releaseWriter();
|
||||||
@@ -224,7 +225,7 @@ public abstract class GuacamoleWebSocketTunnelListener implements WebSocketListe
|
|||||||
tunnel.close();
|
tunnel.close();
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.debug("Unable to close WebSocket tunnel.", e);
|
logger.debug("Unable to close connection to guacd.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -238,7 +239,7 @@ public abstract class GuacamoleWebSocketTunnelListener implements WebSocketListe
|
|||||||
tunnel.close();
|
tunnel.close();
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.debug("Unable to close WebSocket tunnel.", e);
|
logger.debug("Unable to close connection to guacd.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -65,14 +65,16 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
|
|||||||
*
|
*
|
||||||
* @param outbound The outbound WebSocket connection to close.
|
* @param outbound The outbound WebSocket connection to close.
|
||||||
* @param guac_status The status to send.
|
* @param guac_status The status to send.
|
||||||
* @throws IOException If an error prevents proper closure of the WebSocket
|
|
||||||
* connection.
|
|
||||||
*/
|
*/
|
||||||
public static void closeConnection(WsOutbound outbound,
|
public void closeConnection(WsOutbound outbound, GuacamoleStatus guac_status) {
|
||||||
GuacamoleStatus guac_status) throws IOException {
|
|
||||||
|
|
||||||
|
try {
|
||||||
byte[] message = Integer.toString(guac_status.getGuacamoleStatusCode()).getBytes("UTF-8");
|
byte[] message = Integer.toString(guac_status.getGuacamoleStatusCode()).getBytes("UTF-8");
|
||||||
outbound.close(guac_status.getWebSocketCode(), ByteBuffer.wrap(message));
|
outbound.close(guac_status.getWebSocketCode(), ByteBuffer.wrap(message));
|
||||||
|
}
|
||||||
|
catch (IOException e) {
|
||||||
|
logger.debug("Unable to close WebSocket tunnel.", e);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,7 +101,7 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
|
|||||||
tunnel = doConnect(request);
|
tunnel = doConnect(request);
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Connection failed: {}", e.getMessage());
|
logger.error("Creation of WebSocket tunnel to guacd failed: {}", e.getMessage());
|
||||||
logger.debug("Error connecting WebSocket tunnel.", e);
|
logger.debug("Error connecting WebSocket tunnel.", e);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -123,10 +125,10 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
|
|||||||
|
|
||||||
}
|
}
|
||||||
catch (GuacamoleConnectionClosedException e) {
|
catch (GuacamoleConnectionClosedException e) {
|
||||||
logger.debug("Connection closed.", e);
|
logger.debug("Connection to guacd closed.", e);
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.debug("Tunnel write failed.", e);
|
logger.debug("WebSocket tunnel write failed.", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
tunnel.releaseWriter();
|
tunnel.releaseWriter();
|
||||||
@@ -137,12 +139,7 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
|
|||||||
|
|
||||||
// Do not start connection if tunnel does not exist
|
// Do not start connection if tunnel does not exist
|
||||||
if (tunnel == null) {
|
if (tunnel == null) {
|
||||||
try {
|
|
||||||
closeConnection(outbound, GuacamoleStatus.RESOURCE_NOT_FOUND);
|
closeConnection(outbound, GuacamoleStatus.RESOURCE_NOT_FOUND);
|
||||||
}
|
|
||||||
catch (IOException e) {
|
|
||||||
logger.debug("Tunnel not found, but unable to signal closure of WebSocket.", e);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -182,16 +179,17 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
|
|||||||
// to pass within the WebSocket connection, logging
|
// to pass within the WebSocket connection, logging
|
||||||
// each error appropriately.
|
// each error appropriately.
|
||||||
catch (GuacamoleClientException e) {
|
catch (GuacamoleClientException e) {
|
||||||
logger.warn("Client request rejected: {}", e.getMessage());
|
logger.info("WebSocket connection terminated: {}", e.getMessage());
|
||||||
|
logger.debug("WebSocket connection terminated due to client error.", e);
|
||||||
closeConnection(outbound, e.getStatus());
|
closeConnection(outbound, e.getStatus());
|
||||||
}
|
}
|
||||||
catch (GuacamoleConnectionClosedException e) {
|
catch (GuacamoleConnectionClosedException e) {
|
||||||
logger.debug("Connection closed.", e);
|
logger.debug("Connection to guacd closed.", e);
|
||||||
closeConnection(outbound, GuacamoleStatus.SUCCESS);
|
closeConnection(outbound, GuacamoleStatus.SUCCESS);
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.error("Connection terminated abnormally: {}", e.getMessage());
|
logger.error("Connection to guacd terminated abnormally: {}", e.getMessage());
|
||||||
logger.debug("Internal error during connection.", e);
|
logger.debug("Internal error during connection to guacd.", e);
|
||||||
closeConnection(outbound, e.getStatus());
|
closeConnection(outbound, e.getStatus());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -215,7 +213,7 @@ public abstract class GuacamoleWebSocketTunnelServlet extends WebSocketServlet {
|
|||||||
tunnel.close();
|
tunnel.close();
|
||||||
}
|
}
|
||||||
catch (GuacamoleException e) {
|
catch (GuacamoleException e) {
|
||||||
logger.debug("Unable to close WebSocket tunnel.", e);
|
logger.debug("Unable to close connection to guacd.", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user