0

I'm using Guacamole 0.9.12-incubating - on server-side extending GuacamoleHTTPTunnelServlet, on client using official JavaScript code. Guacamole server is compiled from source and is running on Ubuntu 17.04.

SSH connection is successfully established, but disconnects after 15 seconds. No keyboard strokes nor mouse are working.

May  7 17:14:09 dev guacd[4071]: Creating new client for protocol "ssh"
May  7 17:14:09 dev guacd[4071]: Connection ID is "$30e2e833-5640-4bc9-92c3-929ced3d6e0e"
May  7 17:14:09 dev guacd[4382]: User "@4209df46-e26a-4ced-93c4-c264578f85a5" joined connection "$30e2e833-5640-4bc9-92c3-929ced3d6e0e" (1 users now present)
May  7 17:14:10 dev guacd[4382]: SSH connection successful.
May  7 17:14:24 dev guacd[4382]: User is not responding.
May  7 17:14:24 dev guacd[4382]: User "@4209df46-e26a-4ced-93c4-c264578f85a5" disconnected (0 users remain)
May  7 17:14:24 dev guacd[4382]: Last user of connection "$30e2e833-5640-4bc9-92c3-929ced3d6e0e" disconnected
May  7 17:14:25 dev guacd[4382]: SSH connection ended.
May  7 17:14:25 dev guacd[4071]: Connection "$30e2e833-5640-4bc9-92c3-929ced3d6e0e" removed.

Client JavaScript is the same as in documentation - https://guacamole.incubator.apache.org/doc/gug/writing-you-own-guacamole-app.html .

When I Override methods in servlet, they show me that key strokes go to it. So problem is probably somewhere between servlet and guacd?

@Override
protected void doWrite(HttpServletRequest request, HttpServletResponse response, String tunnelUUID) throws GuacamoleException {
        LOGGER.debug("Do WRITE to session " + tunnelUUID);
        super.doWrite(request, response, tunnelUUID);
    }

@Override
protected void doRead(HttpServletRequest request, HttpServletResponse response, String tunnelUUID) throws GuacamoleException {
        LOGGER.debug("Do read to session " + tunnelUUID);
        super.doRead(request, response, tunnelUUID);
    }

Connection is established, but no key strokes are working: SSH connection established (in browser)

Thanks.

Xdg
  • 1,735
  • 2
  • 27
  • 42

1 Answers1

0

Problem was in Spring Boot, as discussed there - https://glyptodon.org/jira/si/jira.issueviews:issue-html/GUAC-1252/GUAC-1252.html .

Solution is to create own implementation of HiddenHttpMethodFilter:

@Configuration
public class GuacamoleServletConfiguration {

    @Bean
    public GuacamoleServlet guacamoleTunnelServlet() {
        return new GuacamoleServlet();
    }

    @Bean
    public ServletRegistrationBean servletRegistrationBean() {
        ServletRegistrationBean bean = new ServletRegistrationBean(guacamoleTunnelServlet(), "/remote/tunnel");
        bean.setOrder(Ordered.HIGHEST_PRECEDENCE);
        return bean;
    }

    @Bean
    public HiddenHttpMethodFilter hiddenHttpMethodFilter() {
        return new HiddenHttpMethodFilter() {
            @Override
            protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) throws ServletException, IOException {
                if ("POST".equals(request.getMethod()) && request.getRequestURI().startsWith("/remote/tunnel")) {
                    filterChain.doFilter(request, response);
                } else {
                    super.doFilterInternal(request, response, filterChain);
                }
            }
        };
    }
}
Xdg
  • 1,735
  • 2
  • 27
  • 42