

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

# 安全通道
<a name="secure-tunneling-component"></a>

透過 `aws.greengrass.SecureTunneling`元件，您可以與位於受限防火牆後方的 Greengrass 核心裝置建立安全的雙向通訊。

例如，假設防火牆後方有一個 Greengrass 核心裝置，禁止所有傳入連線。安全通道使用 MQTT 將存取字符傳輸至裝置，然後使用 WebSockets 透過防火牆與裝置進行 SSH 連線。使用此 AWS IoT 受管通道，您可以開啟裝置所需的 SSH 連線。如需使用 AWS IoT 安全通道連線至遠端裝置的詳細資訊，請參閱《 *AWS IoT 開發人員指南*》中的[AWS IoT 安全通道](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html)。

此元件會訂閱`$aws/things/greengrass-core-device/tunnels/notify`主題上的 AWS IoT Core MQTT 訊息中介裝置，以接收安全通道通知。

**Topics**
+ [版本](#secure-tunneling-component-versions)
+ [Type](#secure-tunneling-component-type)
+ [作業系統](#secure-tunneling-component-os-support)
+ [要求](#secure-tunneling-component-requirements)
+ [相依性](#secure-tunneling-component-dependencies)
+ [Configuration](#secure-tunneling-component-configuration)
+ [本機日誌檔案](#secure-tunneling-component-log-file)
+ [授權](#secure-tunneling-component-licenses)
+ [Usage](#secure-tunneling-component-usage)
+ [另請參閱](#secure-tunneling-component-see-also)
+ [變更記錄](#secure-tunneling-component-changelog)

## 版本
<a name="secure-tunneling-component-versions"></a>

此元件具有下列版本：
+ 2.0.x
+ 1.1.x
+ 1.0.x

## Type
<a name="secure-tunneling-component-type"></a>

<a name="public-component-type-generic"></a>此<a name="public-component-type-generic-phrase"></a>元件是一般元件 (`aws.greengrass.generic`)。[Greengrass 核](greengrass-nucleus-component.md)會執行元件的生命週期指令碼。

<a name="public-component-type-more-information"></a>如需詳細資訊，請參閱[元件類型](develop-greengrass-components.md#component-types)。

## 作業系統
<a name="secure-tunneling-component-os-support"></a>

此元件只能在 Linux 核心裝置上安裝。

架構：
+ Armv71
+ Armv8 (AArch64)
+ x86\$164

## 要求
<a name="secure-tunneling-component-requirements"></a>

此元件有下列需求：

------
#### [ 2.0.x ]
+ 安全通道元件的可用磁碟空間至少為 4 MB。此要求不包含 Greengrass 核心軟體或在相同裝置上執行的其他元件。
+ 安全通道元件至少可使用 3 MB RAM。此要求不包含 Greengrass 核心軟體或在相同裝置上執行的其他元件。
+ GNU C 程式庫 (glibc) 2.35 版或更新版本。不支援超過長期支援生命週期結束日期的作業系統和程式庫版本。您應該使用具有長期支援的作業系統和程式庫。
+ 下列執行期程式庫安裝在 Greengrass 核心裝置上：
  + `libstdc++` 3.4.29 版或更新版本
  + `libgcc_s` 3.0 版或更新版本
  + OpenSSL 3.0.0 版或更新版本
+ 在 Greengrass 核心裝置上的連接埠 443 上開啟傳出流量。
+ 開啟您想要用來與 Greengrass 核心裝置通訊的通訊服務支援。例如，若要開啟裝置的 SSH 連線，您必須在該裝置上開啟 SSH。

------
#### [ 1.0.x - 1.1.x ]
+ 安全通道元件可用的磁碟空間至少為 32 MB。此要求不包含 Greengrass 核心軟體或在相同裝置上執行的其他元件。
+ 安全通道元件至少可使用 16 MB RAM。此要求不包含 Greengrass 核心軟體或在相同裝置上執行的其他元件。如需詳細資訊，請參閱[使用 JVM 選項控制記憶體配置](configure-greengrass-core-v2.md#jvm-tuning)。
+ 安全通道元件 1.0.12 版和更新版本需要 GNU C Library (glibc) 2.25 版或更新版本，Linux 核心為 3.2 版或更新版本。不支援超過長期支援生命週期結束日期的作業系統和程式庫版本。您應該使用具有長期支援的作業系統和程式庫。
+ 作業系統和 Java 執行期都必須安裝為 64 位元。
+ 在 Greengrass 核心裝置上安裝 [Python](https://www.python.org/) 3.5 或更新版本，並新增至 PATH 環境變數。
+ `libcrypto.so.1.1` 安裝在 Greengrass 核心裝置上，並新增至 PATH 環境變數。
+ 在 Greengrass 核心裝置上的連接埠 443 上開啟傳出流量。
+ 開啟您想要用來與 Greengrass 核心裝置通訊的通訊服務支援。例如，若要開啟裝置的 SSH 連線，您必須在該裝置上開啟 SSH。

------

### 端點和連接埠
<a name="secure-tunneling-component-endpoints"></a>

除了基本操作所需的端點和連接埠之外，此元件還必須能夠對下列端點和連接埠執行傳出請求。如需詳細資訊，請參閱[允許透過代理或防火牆的裝置流量](allow-device-traffic.md)。


| Endpoint | 站點 | 必要 | Description | 
| --- | --- | --- | --- | 
|  `data.tunneling.iot.region.amazonaws.com`  | 443 | 是 |  建立安全通道。  | 

## 相依性
<a name="secure-tunneling-component-dependencies"></a>

當您部署元件時， AWS IoT Greengrass 也會部署其相依性的相容版本。這表示您必須符合元件及其所有相依性的要求，才能成功部署元件。本節列出此元件[發行版本的](#secure-tunneling-component-changelog)相依性，以及為每個相依性定義元件版本的語意版本限制。您也可以在[AWS IoT Greengrass 主控台](https://console.aws.amazon.com//greengrass)中檢視每個版本元件的相依性。在元件詳細資訊頁面上，尋找**相依性**清單。

------
#### [ 2.0.0 ]

此元件的 2.0.0 版同時支援 Greengrass 核和 Greengrass 核精簡。下表列出此元件 2.0.0 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md)或 [Greengrass 核精簡](greengrass-nucleus-lite-component.md) |  >=2.0.0 <3.0.0  | 軟式 | 

------
#### [ 1.0.19 – 1.1.3 ]

下表列出此元件 1.0.19 到 1.1.3 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <3.0.0  | 軟式 | 

------
#### [ 1.0.18 ]

下表列出此元件 1.0.18 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.13.0  | 軟式 | 

------
#### [ 1.0.16 – 1.0.17 ]

下表列出此元件 1.0.16 至 1.0.17 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.12.0  | 軟式 | 

------
#### [ 1.0.14 – 1.0.15 ]

下表列出此元件 1.0.14 至 1.0.15 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.11.0  | 軟式 | 

------
#### [ 1.0.11 – 1.0.13 ]

下表列出此元件 1.0.11 – 1.0.13 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.10.0  | 軟式 | 

------
#### [ 1.0.10 ]

下表列出此元件 1.0.10 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.9.0  | 軟式 | 

------
#### [ 1.0.9 ]

下表列出此元件 1.0.9 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.8.0  | 軟式 | 

------
#### [ 1.0.8 ]

下表列出此元件 1.0.8 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.7.0  | 軟式 | 

------
#### [ 1.0.5 - 1.0.7 ]

下表列出此元件 1.0.5 到 1.0.7 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.6.0  | 軟式 | 

------
#### [ 1.0.4 ]

下表列出此元件 1.0.4 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.5.0  | 軟式 | 

------
#### [ 1.0.3 ]

下表列出此元件 1.0.3 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.4.0  | 軟式 | 

------
#### [ 1.0.2 ]

下表列出此元件 1.0.2 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.3.0  | 軟式 | 

------
#### [ 1.0.1 ]

下表列出此元件 1.0.1 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.0 <2.2.0  | 軟式 | 

------
#### [ 1.0.0 ]

下表列出此元件 1.0.0 版的相依性。


| 相依性 | 相容版本 | 相依性類型 | 
| --- | --- | --- | 
| [Greengrass 核](greengrass-nucleus-component.md) |  >=2.0.3 <2.1.0  | 軟式 | 

------

如需元件相依性的詳細資訊，請參閱[元件配方參考](component-recipe-reference.md#recipe-reference-component-dependencies)。

## Configuration
<a name="secure-tunneling-component-configuration"></a>

此元件提供下列組態參數，您可以在部署元件時自訂這些參數。

------
#### [ 2.0.x ]

`maxConcurrentTunnels`  
（選用） 允許並行通道的數量上限。  
值不能超過 20。
預設：`20`

`tunnelTimeoutSeconds`  
（選用） 通道逾時持續時間，以秒為單位。  
預設：`43200`(12 小時）

`accessControl`  
（選用） 包含[授權政策](interprocess-communication.md#ipc-authorization-policies)的物件，允許元件訂閱安全通道通知主題。  
如果您的部署以物件群組為目標，請勿修改此組態參數。如果您的部署以個別核心裝置為目標，而且您想要限制其訂閱裝置的主題，請指定核心裝置的物件名稱。在裝置的授權政策中的 `resources`值中，將 MQTT 主題萬用字元取代為裝置的物件名稱。

```
{
  "aws.greengrass.ipc.mqttproxy": {
    "aws.greengrass.SecureTunneling:mqttproxy:1": {
      "policyDescription": "Access to tunnel notification pubsub topic",
      "operations": [
        "aws.greengrass#SubscribeToIoTCore"
      ],
      "resources": [
        "$aws/things/+/tunnels/notify"
      ]
    }
  }
}
```

**Example 範例：組態合併更新**  
下列範例組態會指定並行通道和逾時設定上限。  

```
{
  "maxConcurrentTunnels": 20,
  "tunnelTimeoutSeconds": 43200,
  "accessControl": {
    "aws.greengrass.ipc.mqttproxy": {
      "aws.greengrass.SecureTunneling:mqttproxy:1": {
        "policyDescription": "Access to tunnel notification pubsub topic",
        "operations": [
          "aws.greengrass#SubscribeToIoTCore"
        ],
        "resources": [
          "$aws/things/MyGreengrassCore/tunnels/notify"
        ]
      }
    }
  }
}
```

------
#### [ 1.0.x - 1.1.x ]

`OS_DIST_INFO`  
（選用） 核心裝置的作業系統。根據預設，元件會嘗試自動識別核心裝置上執行的作業系統。如果元件無法以預設值開頭，請使用此值來指定作業系統。如需此元件支援的作業系統清單，請參閱 [裝置要求](greengrass-nucleus-component.md#greengrass-v2-requirements)。  
此值可以是下列其中一項：`auto`、`ubuntu`、`amzn2`、`raspberrypi`。  
預設：`auto`

`accessControl`  
（選用） 包含[授權政策](interprocess-communication.md#ipc-authorization-policies)的物件，允許元件訂閱安全通道通知主題。  
如果您的部署以物件群組為目標，請勿修改此組態參數。如果您的部署以個別核心裝置為目標，而且您想要限制其訂閱裝置的主題，請指定核心裝置的物件名稱。在裝置的授權政策中的 `resources`值中，將 MQTT 主題萬用字元取代為裝置的物件名稱。

```
{
  "aws.greengrass.ipc.mqttproxy": {
    "aws.iot.SecureTunneling:mqttproxy:1": {
      "policyDescription": "Access to tunnel notification pubsub topic",
      "operations": [
        "aws.greengrass#SubscribeToIoTCore"
      ],
      "resources": [
        "$aws/things/+/tunnels/notify"
      ]
    }
  }
}
```

**Example 範例：組態合併更新**  
下列範例組態指定 允許此元件在**MyGreengrassCore**執行 Ubuntu 的核心裝置上開啟安全通道。  

```
{
  "OS_DIST_INFO": "ubuntu",
  "accessControl": {
    "aws.greengrass.ipc.mqttproxy": {
      "aws.iot.SecureTunneling:mqttproxy:1": {
        "policyDescription": "Access to tunnel notification pubsub topic",
        "operations": [
          "aws.greengrass#SubscribeToIoTCore"
        ],
        "resources": [
          "$aws/things/MyGreengrassCore/tunnels/notify"
        ]
      }
    }
  }
}
```

------

## 本機日誌檔案
<a name="secure-tunneling-component-log-file"></a>

------
#### [ Greengrass nucleus ]

此元件使用以下日誌檔案。

```
/greengrass/v2/logs/aws.greengrass.SecureTunneling.log
```

**檢視此元件的日誌**
+ 在核心裝置上執行下列命令，以即時檢視此元件的日誌檔案。`/greengrass/v2` 將 取代為 AWS IoT Greengrass 根資料夾的路徑。

  ```
  sudo tail -f /greengrass/v2/logs/aws.greengrass.SecureTunneling.log
  ```

------
#### [ Greengrass nucleus lite ]

在核心裝置上執行下列命令，以檢視此元件的日誌。

```
journalctl -xeau ggl.aws.greengrass.SecureTunneling.service
```

在核心裝置上執行下列命令，以即時檢視此元件的日誌。

```
journalctl -fau ggl.aws.greengrass.SecureTunneling.service
```

------

## 授權
<a name="secure-tunneling-component-licenses"></a>

此元件包含下列第三方軟體/授權：

------
#### [ 2.0.x ]
+ [AWS IoT 安全通道本機 Proxy](https://github.com/aws-samples/aws-iot-securetunneling-localproxy)/Apache 授權 2.0
+ [AWS Greengrass 元件 SDK](https://github.com/aws-greengrass/aws-greengrass-component-sdk)/Apache License 2.0
+ [Boost C\$1\$1 程式庫](https://www.boost.org/)/Boost 軟體授權 1.0
+ [通訊協定緩衝區](https://github.com/protocolbuffers/protobuf)/BSD 3-Clause授權

------
#### [ 1.0.x - 1.1.x ]
+ [AWS IoT 裝置用戶端](https://github.com/awslabs/aws-iot-device-client)/Apache License 2.0
+ [適用於 JAVA 的 AWS IoT Device SDK](https://github.com/aws/aws-greengrass-core-sdk-java/)/Apache License 2.0
+ [gson](https://github.com/google/gson)/Apache 授權 2.0
+ [log4j](https://logging.apache.org/log4j/2.x/)/Apache 授權 2.0
+ [slf4j](http://www.slf4j.org/)/Apache 授權 2.0

------

## Usage
<a name="secure-tunneling-component-usage"></a>

若要在裝置上使用安全通道元件，請執行下列動作：

1. 將安全通道元件部署至您的裝置。

1. 開啟 [AWS IoT 主控台](https://console.aws.amazon.com/iot)。從左側功能表中，選擇**遠端動作**，然後選擇**安全通道**。

1. 為您的 Greengrass 裝置建立通道。

1. 下載來源存取字符。

1. 使用本機代理搭配來源存取字符來連線至目的地。如需詳細資訊，請參閱《 *AWS IoT 開發人員指南*》中的[如何使用本機代理](https://docs.aws.amazon.com/iot/latest/developerguide/how-use-local-proxy.html)。

## 另請參閱
<a name="secure-tunneling-component-see-also"></a>
+ 《 *AWS IoT 開發人員指南*》中的[AWS IoT 安全通道](https://docs.aws.amazon.com/iot/latest/developerguide/secure-tunneling.html) 
+ 《 *AWS IoT 開發人員指南*》中的[如何使用本機代理](https://docs.aws.amazon.com/iot/latest/developerguide/how-use-local-proxy.html) 

## 變更記錄
<a name="secure-tunneling-component-changelog"></a>

下表說明每個版本元件的變更。


|  **版本**  |  **變更**  | 
| --- | --- | 
|  2.0.0  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/secure-tunneling-component.html)  | 
|  1.1.3  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/secure-tunneling-component.html)  | 
|  1.1.2  |   此版本不再可用。此版本的改進功能可在此元件的較新版本中使用。  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/secure-tunneling-component.html)  | 
|  1.1.1  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/secure-tunneling-component.html)  | 
|  1.1.0  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/secure-tunneling-component.html)  | 
|  1.0.19  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/secure-tunneling-component.html)  如果您使用安全通道本機代理做為通道來源用戶端，請勿將元件更新至此版本，除非您也已將本機代理升級至 3.1.1 版或更新版本。   | 
|  1.0.18  | 針對 Greengrass nucleus 2.12.0 版更新版本。 | 
|  1.0.17  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/secure-tunneling-component.html)  | 
|  1.0.16  | 針對 Greengrass nucleus 2.11.0 版更新版本。 | 
|  1.0.15  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/secure-tunneling-component.html)  | 
|  1.0.14  | 針對 Greengrass nucleus 2.10.0 版更新版本。 | 
|  1.0.13  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/secure-tunneling-component.html)  | 
|  1.0.12  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/secure-tunneling-component.html)  | 
|  1.0.11  | 針對 Greengrass nucleus 2.9.0 版更新版本。 | 
|  1.0.10  | 針對 Greengrass nucleus 2.8.0 版更新版本。 | 
|  1.0.9  |  針對 Greengrass nucleus 2.7.0 版更新版本。  | 
|  1.0.8  |  針對 Greengrass nucleus 2.6.0 版更新版本。  | 
|  1.0.7  |  [\[See the AWS documentation website for more details\]](http://docs.aws.amazon.com/zh_tw/greengrass/v2/developerguide/secure-tunneling-component.html)  | 
|  1.0.6  |  此版本包含錯誤修正。  | 
|  1.0.5  |  針對 Greengrass nucleus 2.5.0 版更新版本。  | 
|  1.0.4  |  針對 Greengrass nucleus 2.4.0 版更新版本。  | 
|  1.0.3  |  針對 Greengrass nucleus 2.3.0 版更新版本。  | 
|  1.0.2  |  針對 Greengrass nucleus 2.2.0 版更新版本。  | 
|  1.0.1  |  針對 Greengrass nucleus 2.1.0 版更新版本。  | 
|  1.0.0  |  初始版本。  | 