

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 與 Amazon DCV 連線閘道整合
<a name="configure-gateway-integration"></a>

[Amazon DCV Connection Gateway](https://docs.aws.amazon.com/dcv/latest/gw-admin/what-is-gw.html) 是一種可安裝的軟體套件，可讓使用者透過 LAN 或 VPC 的單一存取點存取 Amazon DCV 伺服器機群。

 如果您的基礎設施包含可透過 Amazon DCV Connection Gateway 存取的 Amazon DCV 伺服器，您可以設定 Session Manager 來整合 Amazon DCV Connection Gateway。透過遵循下節中概述的步驟，代理程式將充當 Connection Gateway [的工作階段解析程式](https://docs.aws.amazon.com/dcv/latest/gw-admin/session-resolver.html)。換句話說，代理程式會公開額外的 HTTP 端點。Connection Gateway 將對端點進行 API 呼叫，以擷取將 Amazon DCV 連線路由至代理程式選取的主機所需的資訊。

**Topics**
+ [將 Session Manager Broker 設定為 Amazon DCV Connection Gateway 的工作階段解析程式](#set-up-sm-broker)
+ [選用 - 啟用 TLS 用戶端身分驗證](#enable-tls-client-auth)
+ [Amazon DCV 伺服器 - DNS 映射參考](dcv-server-dns-mapping.md)

## 將 Session Manager Broker 設定為 Amazon DCV Connection Gateway 的工作階段解析程式
<a name="set-up-sm-broker"></a>

**Session Manager 中介裝置端**

1. `/etc/dcv-session-manager-broker/session-manager-broker.properties` 使用您偏好的文字編輯器開啟 ，並套用下列變更：
   + 設定 `enable-gateway = true`
   + `gateway-to-broker-connector-https-port` 設定為可用的 TCP 連接埠 （預設為 8447)
   + `gateway-to-broker-connector-bind-host` 設定為代理程式為 Amazon DCV Connection Gateway 連線繫結的主機 IP 地址 （預設為 0.0.0.0) 

1. 然後執行下列命令來停止和重新啟動中介裝置：

   ```
   sudo systemctl stop dcv-session-manager-broker
   ```

   ```
   sudo systemctl start dcv-session-manager-broker
   ```

1. 擷取代理程式自我簽署憑證的副本，並將其放在您的使用者目錄中。

   ```
   sudo cp /var/lib/dcvsmbroker/security/dcvsmbroker_ca.pem $HOME
   ```

   在下一個步驟中安裝 Amazon DCV Connection Gateway 時會需要它。

**Amazon DCV Connection Gateway 端**
+ 請遵循 Amazon DCV Connection Gateway 文件中的 [一節](https://docs.aws.amazon.com/dcv/latest/gw-admin/setting-up-configuring.html#configuring-resolver)。

  由於 Amazon DCV Connection Gateway 會對代理程式進行 HTTP API 呼叫，如果代理程式使用自我簽署憑證，您將需要將代理程式憑證複製到 Amazon DCV Connection Gateway 主機 （在上一個步驟中擷取），並在 Amazon DCV Connection Gateway 組態的 `[resolver]`區段中設定 `ca-file` 參數。

## 選用 - 啟用 TLS 用戶端身分驗證
<a name="enable-tls-client-auth"></a>

完成上一個步驟後，Session Manager 和 Connection Gateway 可以透過安全頻道進行通訊，連線閘道可以驗證 Session Manager Brokers 的身分。如果您需要 Session Manager Brokers 在建立安全頻道之前驗證 Connection Gateway 的身分，則需要按照下一節中的步驟啟用 TLS 用戶端身分驗證功能。

**注意**  
如果 Session Manager 位於負載平衡器後方，則無法使用具有 TLS 連線終止的負載平衡器啟用 TLS 用戶端身分驗證，例如 Application Load Balancer (ALBs) 或 Gateway Load Balancer (GLBs)。僅支援沒有 TLS 終止的負載平衡器，例如 Network Load Balancer (NLBs)。如果您使用 ALBs 或 GLBs，您可以強制執行只有特定安全群組可以聯絡負載平衡器，確保額外的安全層級；此處的安全群組詳細資訊：[VPC 的安全群組](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html) 

**Session Manager 中介裝置端**

1. 若要啟用 Session Manager Brokers 與 Amazon DCV Connection Gateway 之間通訊的 TLS 用戶端身分驗證，請遵循下列步驟：

1.  透過執行 來產生所需的金鑰和憑證： 命令的輸出會告訴您產生登入資料的資料夾，以及用於建立 TrustStore 檔案的密碼。

   ```
   sudo /usr/share/dcv-session-manager-broker/bin/gen-gateway-certificates.sh
   ```

1.  將 Amazon DCV Connection Gateway 的私有金鑰和自我簽署憑證的副本放在您的使用者目錄中。在下一個步驟中，當您在 Amazon DCV Connection Gateway 中啟用 TLS 用戶端身分驗證時，將會需要它。

   ```
   sudo cp /etc/dcv-session-manager-broker/resolver-creds/dcv_gateway_key.pem $HOME 
   ```

   ```
   sudo cp /etc/dcv-session-manager-broker/resolver-creds/dcv_gateway_cert.pem $HOME
   ```

1.  然後使用您偏好的文字編輯器開啟 /etc/dcv-session-manager-broker/session-manager-broker.properties，並執行下列動作：
   + 將 `enable-tls-client-auth-gateway` 設定為 `true`
   + `gateway-to-broker-connector-trust-store-file` 設定為在上一個步驟中建立的 TrustStore 檔案路徑
   + 將 `gateway-to-broker-connector-trust-store-pass`設定為用於在上一個步驟中建立 TrustStore 檔案的密碼

1. 然後執行下列命令來停止並重新啟動中介裝置：

   ```
   sudo systemctl stop dcv-session-manager-broker
   ```

   ```
   sudo systemctl start dcv-session-manager-broker
   ```

**Amazon DCV Connection Gateway 端**
+ 請遵循 Amazon DCV Connection Gateway 文件中的 [一節](https://docs.aws.amazon.com/dcv/latest/gw-admin/setting-up-configuring.html)。
  + 在 `[resolver]`區段中設定 `cert-file` 參數時，使用您在上一個步驟中複製的憑證檔案的完整路徑
  + 在 `[resolver]`區段中設定 `cert-key-file` 參數時，使用您在上一個步驟中複製之金鑰檔案的完整路徑