【问题标题】:Guacamole SSH disconnecting, no keyboard鳄梨酱 SSH 断开连接,没有键盘
【发布时间】:2017-10-05 14:33:28
【问题描述】:

我正在使用 Guacamole 0.9.12-incubating - 在服务器端扩展 GuacamoleHTTPTunnelServlet,在客户端使用官方 JavaScript 代码。鳄梨酱服务器是从源代码编译的,在 Ubuntu 17.04 上运行。

SSH 连接已成功建立,但 15 秒后断开。键盘敲击和鼠标都不起作用。

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.

客户端 JavaScript 与文档中的相同 - https://guacamole.incubator.apache.org/doc/gug/writing-you-own-guacamole-app.html

当我在 servlet 中使用Override 方法时,它们向我展示了击键。那么问题可能出在 servlet 和 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);
    }

连接已建立,但没有击键工作:

谢谢。

【问题讨论】:

    标签: guacamole


    【解决方案1】:

    问题出在 Spring Boot 中,正如那里所讨论的那样 - https://glyptodon.org/jira/si/jira.issueviews:issue-html/GUAC-1252/GUAC-1252.html

    解决方案是创建自己的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);
                    }
                }
            };
        }
    }
    

    【讨论】:

      猜你喜欢
      • 2021-10-06
      • 2021-09-28
      • 2020-10-15
      • 2017-04-13
      • 2017-01-04
      • 2018-01-01
      • 2017-03-28
      • 2019-04-04
      • 2018-03-05
      相关资源
      最近更新 更多