iT邦幫忙

0

如何在 JumpServer 配置 Applet / RemoteApp 遠端應用程式

  • 分享至 

  • xImage
  •  

還記得在 JumpServer 簡介中,我們有介紹到使用 Applet 連線至 Web 資產畫面,但該功能需要透過新增 Remote Host 與部署 RemoteApp 才能使用,今天就來家教大家如何在 JumpServer 配置 Applet 遠端應用程式。

在未新增 Remote Host 與部署 RemoteApp 之前,想要用 Applet 連線至 Web 資產可以看到連線方法與連線按鈕都是停用的。

必要條件
RemoteApp 是一種應用程式部署和運行的方式,允許使用者在本地設備上遠端運行應用程式,而不需要將應用程式直接安裝在他們的本地設備上。

我們需要一台 Windows Server 作為應用程式的發佈機,版本要求如下:

  • Windows Server 2016
  • Windows Server 2019

建議不要用現有的 Windows Server 來測試,獨立安裝一台伺服器讓環境單純一點。測試的發佈機規格如下,可以不加入網域。

設定允許遠端連線到此電腦

確認防火牆允許 Windows 遠端管理 5985 埠號通過

新增 Remote Hosts
切到 Settings 的 Applets,選擇 Remote Hosts 頁籤,點選 Create。

JumpServer 支援透過 WinRM 和 OpenSSH 的協定進行應用程式發佈機的部署,建議使用 Windows-Server 自帶的 WinRM 服務

若想使用 OpenSSH 協定進行應用程式發佈機的部署,則需要安裝 openSSH-win64.msi,你可以到 http://your_jumpserver_ip/core/download/ 下載所需的安裝程式。

接下來我們需要提供發佈機的管理員帳號與密碼

Auto Create Accounts:該選項創建的帳號用於連接已發布的應用程式,帳戶分為兩種類型,一種是每個帳戶專用的,每個用戶都有一個私人帳戶,另一種是公用的,當應用程式不支援多個開啟和專用時已使用,將使用公用帳號連接。

Accounts Create Amount:建立帳號的數量

Core API:遠端應用程式發布機的 Agent 與 JumpServer 的核心模組的通訊位址

Existing RDS License:提供 RDS 授權伺服器的資訊

  • JumpServer 會透過 WinRM 安裝遠端桌面服務 Remote Desktop Services,預設授權寬限期為 120 天,期間不需要授權伺服器。
  • 寬限期結束後,用戶端必須擁有授權伺服器發出的有效 RDS CAL,才能登入 RD 工作階段主機伺服器。

我們使用授權寬限期進行測試即可,若已經有 RDS 授權伺服器的朋友就可以考慮配置喔。

RDS Licensing Mode:選擇裝置或使用者設定授權模式

  • 裝置:允許一台設備(任何使用者使用的)連接到遠端應用程式發布機。
  • 使用者:授予一個使用者從任何的電腦或裝置存取遠端應用程式發布機。

RDS Single Session Per:選擇停用或啟用設定單一使用者單一會話模式

  • 停用:允許每個使用者可以同時多台電腦連接 RDS 伺服器。
  • 啟用:禁止每個使用者可以同時多台電腦連接 RDS 伺服器。

RDS Max Disconnection Time:限制會話的連線時間

RDS Remote App Logoff Time Limit:限制會話斷開後的註銷時間

初始化與發佈
建立好的 Remote Host 狀態為 Offline,可以點選名稱查看細節。

Account List 用於連接的帳號狀態也為停用

切換到 Remote Apps,我們可以看到發行的狀態都是 Pending,點選右邊 Quick Update 的 Initial Deploy,執行 Deploy。

JumpServer 會透過 WinRM 安裝 Remote Desktop Services 與 JumpServer Tinker 及所需之軟體與組態設定。

詳細的設定紀錄如下

PLAY [all] *********************************************************************

TASK [Gathering Facts] *********************************************************
ok: [JSAPPLTES]

TASK [Install RDS-RD-Server (RDS)] *********************************************
changed: [JSAPPLTES]

TASK [Stop Tinker before install (jumpserver)] *********************************
ok: [JSAPPLTES]

TASK [Stop Tinkerd before install (jumpserver)] ********************************
ok: [JSAPPLTES]

TASK [Download JumpServer Tinker installer (jumpserver)] ***********************
changed: [JSAPPLTES]

TASK [Install JumpServer Tinker (jumpserver)] **********************************
changed: [JSAPPLTES]

TASK [Set Tinkerd on the global system path (jumpserver)] **********************
changed: [JSAPPLTES]

TASK [Download python-3.10.11] *************************************************
changed: [JSAPPLTES]

TASK [Install the python-3.10.11] **********************************************
changed: [JSAPPLTES]

TASK [Check pip command exists] ************************************************
ok: [JSAPPLTES]

TASK [Reboot if installing requires it] ****************************************
changed: [JSAPPLTES]

TASK [Set RDS LicenseServer (regedit)] *****************************************
skipping: [JSAPPLTES]

TASK [Set RDS LicensingMode (regedit)] *****************************************
skipping: [JSAPPLTES]

TASK [Set RDS fSingleSessionPerUser (regedit)] *********************************
skipping: [JSAPPLTES]

TASK [Set RDS MaxDisconnectionTime (regedit)] **********************************
changed: [JSAPPLTES]

TASK [Set RDS RemoteAppLogoffTimeLimit (regedit)] ******************************
changed: [JSAPPLTES]

TASK [Download pip packages] ***************************************************
changed: [JSAPPLTES]

TASK [Unzip pip_packages] ******************************************************
changed: [JSAPPLTES]

TASK [Install python requirements offline] *************************************
changed: [JSAPPLTES]

TASK [Download chromedriver (Chrome)] ******************************************
changed: [JSAPPLTES]

TASK [Unzip chromedriver (Chrome)] *********************************************
changed: [JSAPPLTES]

TASK [Download Chrome zip package (Chrome)] ************************************
changed: [JSAPPLTES]

TASK [Unzip Chrome (Chrome)] ***************************************************
changed: [JSAPPLTES]

TASK [Check and Clean global system path (Chrome)] *****************************
ok: [JSAPPLTES]

TASK [Set Chrome and driver on the global system path (Chrome)] ****************
changed: [JSAPPLTES]

TASK [Set Chrome variables disable Google Api (Chrome)] ************************
ok: [JSAPPLTES]

TASK [Generate tinkerd component config] ***************************************
changed: [JSAPPLTES]

TASK [Install tinkerd service] *************************************************
changed: [JSAPPLTES]

TASK [Start tinkerd service] ***************************************************
changed: [JSAPPLTES]

TASK [Wait Tinker api health] **************************************************
ok: [JSAPPLTES]

TASK [Sync all remote applets] *************************************************
changed: [JSAPPLTES]

PLAY RECAP *********************************************************************
JSAPPLTES                  : ok=28   changed=21   unreachable=0    failed=0    skipped=3    rescued=0    ignored=0
Task terminal.tasks.run_applet_host_deployment[2ab6dbe7-d8fa-411d-adf1-233d7a07f41d] succeeded in 808.4335879271384s: None

重新整理後,預設的 Remote Apps 也幫我們部署完畢,狀態皆為 Success。

JumpServer 預設會建立 100 個系統使用者支援遠端應用程式會話

會在發佈機的本機使用者也同步了相關帳號

JumpServer 會將僅允許來自執行含有網路層級驗證之遠端桌面的電腦進行連線啟用,記得關閉。

JumpServer 會在發佈機自動安裝 Remote Desktop Services

若沒加入網域的畫面如下,不影響測試使用。

回到 Remote Host 重新整理,狀態已經為 Normal。

此時使用 Applet 連線至 Web 資產就可以使用 Chrome 瀏覽器了

可惜的是 Applet 在 Community 版本只支援 WebSite 的資產

官方文件將 Applet 的實作歸類在系統設置的篇幅,也沒有在資產管理與用戶手冊中提及,因此剛接觸到的朋友在使用上比較容易鬼打牆,以上筆記送給有緣的朋友。

常見錯誤
在 Applet 比較常見的錯誤就是沒有進行初始化或等待帳號沒有同步,但錯誤訊息只會告知 Core API failed,不知道怎麼抓問題。

可以使用以下指令來查看 Lion 容器的錯誤紀錄

docker logs -f jms_lion --tail 200

終於有比較清楚的表達 No host account available,表示 JumpServer 的自動建立的帳號還無法登入發佈機,可能需要嘗試 Regenerate Accounts 看看。

[GIN] 2023/11/20 - 15:32:01 | 200 |     718.266µs |       127.0.0.1 | GET      "/lion/health/"
[GIN] 2023/11/20 - 15:32:11 | 200 |      59.413µs |       127.0.0.1 | GET      "/lion/health/"
[GIN] 2023/11/20 - 15:32:13 | 200 |   64.397559ms |       10.7.3.52 | GET      "/lion/connect/?token=0a38b118-0981-4658-a1fe-29a2824aa43f"
2023-11-20 15:32:13 tunnel server.go [ERROR] Create token session err: connect API core err: POST http://core:8080/api/v1/authentication/super-connection-token/applet-option/ failed, get code: 400, {"error":"No host account available"}

參考文件

  1. https://docs.jumpserver.org/zh/v3/guide/system/remoteapp
  2. https://jumpserver.org/remoteapp.html
  3. https://learn.microsoft.com/zh-tw/troubleshoot/windows-server/remote/troubleshoot-rds-licensing-guidance
  4. https://learn.microsoft.com/zh-tw/windows-server/remote/remote-desktop-services/welcome-to-rds

圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言