Checklist for someone who can't connect to Guacamole Server via RDP

들어가며

Apache Guacamole가 설치된 서버에 RDP로 접속 시도 중 발생하는 문제의 해결 방법을 다룹니다. Docker를 통한 구동이 아닌 Ubuntu 로컬 설치 기준입니다.

문제 상황

접속 시 다음과 같은 화면과 함께 접속이 불가능합니다.

표시되는 텍스트에는 다소 차이가 있을 수 있습니다.

로그 확인

시스템 로그를 확인해 봅시다. 서비스 상태 확인으로도 확인 가능합니다.

cat /var/log/syslog | grep tomcat
cat /var/log/syslog | grep guacd

Guacmole 관련에서 다음 사항이 눈에 띕니다. 위 명령어의 각 실행 결과는 별도 문단에 두었습니다.

... guacd[8395]: RDP server closed/refused connection: Server refused connection (wrong security type?)

로그 원문

... tomcat9[3892]: 웹 애플리케이션 디렉토리 [/var/lib/tomcat9/webapps/ROOT]에 대한 배치가 [480] 밀리초에 완료되었습니다.
... tomcat9[3892]: 프로토콜 핸들러 ["http-..."]을(를) 시작합니다.
... tomcat9[3892]: 서버가 [5139] 밀리초 내에 시작되었습니다.
... tomcat9[3892]: Loading class `com.mysql.jdbc.Driver'. This is deprecated. The new driver class is `com.mysql.cj.jdbc.Driver'. The driver is automatically registered via the SPI and manual loading of the driver class is generally unnecessary.
... tomcat9[3892]: 20:19:21.836 [http-...-exec-10] WARN  o.a.g.r.auth.AuthenticationService - Authentication attempt from [..., 127.0.0.1] for user "..." failed.
... tomcat9[3892]: 20:19:26.203 [http-...-exec-8] INFO  o.a.g.r.auth.AuthenticationService - User "..." successfully authenticated from [..., 127.0.0.1].
... tomcat9[3892]: 20:19:27.484 [http-...-exec-5] INFO  o.a.g.tunnel.TunnelRequestService - User "..." connected to connection "2".
... tomcat9[3892]: 20:19:27.486 [http-...-exec-5] INFO  o.a.g.t.h.RestrictedGuacamoleHTTPTunnelServlet - Using HTTP tunnel (not WebSocket). Performance may be sub-optimal.
... tomcat9[3892]: 20:19:42.682 [http-...-exec-9] INFO  o.a.g.tunnel.TunnelRequestService - User "..." disconnected from connection "2". Duration: 15196 milliseconds
... tomcat9[3892]: 20:19:42.688 [http-...-exec-9] ERROR o.a.g.s.GuacamoleHTTPTunnelServlet - HTTP tunnel request failed: Connection to guacd timed out.
... guacd[3875]: Creating new client for protocol "rdp"
... guacd[3875]: Connection ID is "..."
... guacd[8395]: Security mode: Negotiate (ANY)
... guacd[8395]: Resize method: none
... guacd[8395]: No clipboard line-ending normalization specified. Defaulting to preserving the format of all line endings.
... guacd[8395]: User "..." joined connection "..." (1 users now present)
... guacd[8395]: Loading keymap "base"
... guacd[8395]: Loading keymap "en-us-qwerty"
... guacd[8395]: RDP server closed/refused connection: Server refused connection (wrong security type?)
... guacd[8395]: User "..." disconnected (0 users remain)
... guacd[8395]: Last user of connection "..." disconnected
... guacd[3875]: Connection "..." removed.

원인

크게 다음과 같습니다.

  • 서버 설정 문제
    잘못된 설정, 주로 지원하지 않는 안전 모드 설정으로 인한 문제
  • 구성 요소 누락
    예를 들어 RDP 접속하려는데 freerdp2와 xrdp가 설치 및 설정되지 않은 경우
  • 방화벽에서 차단
    연결에 사용할 방화벽에서 포트가 열려 있지 않으면 오류가 발생합니다.

이하 내용은 각 원인에 맞는 확인 및 조치 사항입니다.

점검 사항

연결 속성 설정

과카몰리 서버에서, 연결 속성에 대한 정의가 올바른지 확인합니다.
호스트 이름에는 서버의 공인IP를 입력하면 됩니다. 포트는 실제로 RDP 접속에 사용하는 포트를 입력해야 합니다. 미입력시 기본적으로 3389번 포트로 접속합니다.

설정 완료시 다음과 같은 모습입니다. 이외에도 여러 칸들이 있지만 건드릴 필요 없습니다.

/guacamole/#/settings/mysql/connections

구성 요소 설치 현황

과카몰리 서버 설치 디렉토리에 있는 configure파일을 실행하시면 됩니다.

./configure

다음은 실행 결과로 출력되는 내용입니다.

------------------------------------------------
guacamole-server version 1.4.0
------------------------------------------------

   Library status:

     freerdp2 ............ yes
     pango ............... no
     libavcodec .......... no
     libavformat.......... no
     libavutil ........... no
     libssh2 ............. yes
     libssl .............. yes
     libswscale .......... no
     libtelnet ........... no
     libVNCServer ........ yes
     libvorbis ........... no
     libpulse ............ no
     libwebsockets ....... no
     libwebp ............. no
     wsock32 ............. no

   Protocol support:

      Kubernetes .... no
      RDP ........... yes
      SSH ........... no
      Telnet ........ no
      VNC ........... yes

   Services / tools:

      guacd ...... yes
      guacenc .... no
      guaclog .... yes

   FreeRDP plugins: /usr/lib/aarch64-linux-gnu/freerdp2
   Init scripts: no
   Systemd units: no

Type "make" to compile guacamole-server.

RDP 접속시 위 결과 중 RDP 부분이 다음과 같이 되어 있어야 합니다.

   Library status:
      freerdp2 ............ yes
 
   Protocol support:
      RDP ........... yes

   FreeRDP plugins: /usr/lib/aarch64-linux-gnu/freerdp2

no로 표시되거나 기타 문제가 있다면 패키지 매니저로 누락된 라이브러리를 설치합니다. 타 프로토콜 이용시에도 동일하게, 상황에 맞는 필요 구성요소를 설치하면 됩니다. 어떤 서비스에 어떤 라이브러리가 필요한지는 다음 페이지를 참조 바랍니다.

Installing Guacamole natively — Apache Guacamole Manual v1.4.0

누락된 라이브러리를 새로 설치하셨다면 configure를 다시 실행하고, 서버 설치 디렉토리에서 다음을 실행해 새로 서버를 설치 및 적용해 줍시다.

$ sudo make install CFLAGS='-O2 -Wno-error'
$ sudo ldconfig
$ sudo systemctl reload
$ sudo systemctl restart guacd
$ sudo systemctl restart tomcat9

방화벽 설정 확인

iptables 기준으로 서술합니다.

$ sudo iptables --list

만약 RDP 통신에 필요한 포트 허용 정책이 없으면 새로 추가해 줍시다.

$ sudo iptables -I INPUT 1 --dport 포트번호 -j ACCEPT