

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

# 更新授權的 EMQX 部署組態
<a name="update-emqx-broker-authorization"></a>

**更新授權的 EMQX 部署組態**

1. <a name="sitewise-open-console"></a>導覽至 [AWS IoT SiteWise 主控台](https://console.aws.amazon.com/iotsitewise/)。

1. 在左側導覽中，選擇 **Edge 區段中的 Edge 閘道**。 ****

1. 選擇要設定的閘道。

1. 在 **Edge 閘道組態**區段中，複製您的 **Greengrass 核心裝置**值。儲存它以供日後使用。

1. 開啟 [AWS IoT 主控台](https://console.aws.amazon.com/iot/)。

1. 在左側導覽的**管理**區段下，選擇 **Greengrass 裝置**，然後選擇**部署**。

1. 尋找您先前儲存的核心裝置值，然後選擇該連結以開啟部署。

1. 選擇**動作**下拉式選單按鈕，然後**修訂**。

1. 閱讀出現的訊息，然後選擇**修訂部署**。**指定目標**頁面隨即出現。

1. 選擇**下一步**，直到您到達**設定元件**步驟為止。

1. 選取`aws.greengrass.clientdevices.mqtt.EMQX`選項按鈕。

1. 選擇**設定元件**按鈕。隨即顯示元件的組態頁面。

1. 在**組態更新**下，選擇**重設為元件版本的預設組態：2.\*.\***。

1. 根據您的作業系統，在**要合併的組態**區段中貼上下列內容。

------
#### [ Linux ]

   ```
   {
       "emqxConfig": {
           "authorization": {
               "no_match": "deny",
               "sources": [
                   {
                       "type": "built_in_database"
                   },
                   {
                       "type": "file",
                       "path": "data/authz/acl.conf"
                   }
               ]
           },
           "listeners": {
               "tcp": {
                   "default": {
                       "enabled": true,
                       "enable_authn": false
                   }
               },
               "ssl": {
                   "default": {
                       "enabled": true,
                       "enable_authn": true,
                       "ssl_options": {
                           "verify": "verify_none",
                           "fail_if_no_peer_cert": false
                       }
                   }
               }
           },
           "authentication": {
               "enable": true,
               "backend": "built_in_database",
               "mechanism": "password_based",
               "password_hash_algorithm": {
                   "iterations": 210000,
                   "mac_fun": "sha512",
                   "name": "pbkdf2"
               },
               "user_id_type": "username"
           },
           "dashboard": {
               "listeners": {
                   "http": {
                       "bind": 18083
                   }
               }
           }
       },
       "authMode": "bypass",
       "dockerOptions": "-p 8883:8883 -p 127.0.0.1:1883:1883 -p 127.0.0.1:18083:18083 -v emqx-data:/opt/emqx/data -e EMQX_NODE__NAME=emqx@local",
       "requiresPrivilege": "true"
   }
   ```

------
#### [ Windows ]

   ```
   {
       "emqxConfig": {
           "authorization": {
               "no_match": "deny",
               "sources": [
                   {
                       "type": "built_in_database"
                   },
                   {
                       "type": "file",
                       "path": "C:\\greengrass\\v2\\work\\aws.greengrass.clientdevices.mqtt.EMQX\\v2\\data\\authz\\acl.conf"
                   }
               ]
           },
           "listeners": {
               "tcp": {
                   "default": {
                       "enabled": true,
                       "enable_authn": false
                   }
               },
               "ssl": {
                   "default": {
                       "enabled": true,
                       "enable_authn": true,
                       "ssl_options": {
                           "verify": "verify_none",
                           "fail_if_no_peer_cert": false
                       }
                   }
               }
           },
           "authentication": {
               "enable": true,
               "backend": "built_in_database",
               "mechanism": "password_based",
               "password_hash_algorithm": {
                   "iterations": 210000,
                   "mac_fun": "sha512",
                   "name": "pbkdf2"
               },
               "user_id_type": "username"
           },
           "dashboard": {
               "listeners": {
                   "http": {
                       "bind": 18083
                   }
               }
           }
       },
       "authMode": "bypass",
       "requiresPrivilege": "true"
   }
   ```

------

1. 選擇**確認**。

1. 選擇**下一步**，直到您到達**檢閱**步驟為止。

1. 選擇**部署**。

**注意**  
從此時開始，您無法編輯 ACL 檔案來更新授權規則。或者，您可以在成功部署[透過 EMQX 儀表板為使用者新增授權規則](add-rules-emqx-broker.md)後繼續執行 。