停用 Edge 的基本驗證功能

私有雲 v4.18.01 的邊緣

啟用 Edge on Edge 之後,您可以停用基本驗證。不過,在停用基本驗證之前

  • 請確認您已將所有 Edge 使用者 (包括系統管理員) 新增至 SAML IDP。
  • 確認您已在 Edge UI 和 Edge Management API 上進行全面測試的 SAML 驗證。
  • 如果您也使用 API BaaS,請在 API BaaS 上設定及測試 SAML。請參閱為 API BaaS 啟用 SAML
  • 如果您使用 Developer Services 入口網站,請在入口網站上設定並測試 SAML,確保入口網站能連線至 Edge。請參閱設定 Developer Services 入口網站,使用 SAML 與 Edge 通訊

查看目前的安全性設定檔

您可以查看 Edge 安全性設定檔,確認目前的設定內容是否已啟用基本驗證和 SAML。請在 Edge Management Server 上使用下列 Edge Management API 呼叫,查看 Edge 目前使用的安全性設定檔:

> curl -H "accept:application/xml" http://localhost:8080/v1/securityprofile -u sysAdminEmail:pWord

如果尚未設定 SAML,回應如下所示,表示基本驗證已啟用:

<SecurityProfile enabled="true" name="securityprofile">
    <UserAccessControl enabled="true">
    </UserAccessControl>
</SecurityProfile>

如果您已經啟用 SAML,您會在輸出中看到 <ssoserver> 標記:

<SecurityProfile enabled="true" name="securityprofile">
    <UserAccessControl enabled="true">
        <SSOServer>
            <BasicAuthEnabled>true</BasicAuthEnabled>
            <PublicKeyEndPoint>/token_key</PublicKeyEndPoint>
            <ServerUrl>http://35.197.37.220:9099</ServerUrl>
        </SSOServer>
    </UserAccessControl>
</SecurityProfile>

請注意,已啟用 SAML 的版本也會顯示 <BasicAuthEnabled>true</BasicAuthEnabled>,代表基本驗證仍處於啟用狀態。

停用基本驗證

請在 Edge Management Server 上使用下列 Edge Management API 呼叫來停用基本驗證。請注意,您會將上一節傳回的 XML 物件做為酬載傳遞。唯一的差別在於您設定了 <BasicAuthEnabled>false</BasicAuthEnabled>

> curl -H "Content-Type: application/xml"
http://localhost:8080/v1/securityprofile  -u sysAdminEmail:pWord -d
 '<SecurityProfile enabled="true" name="securityprofile">
  <UserAccessControl enabled="true">
    <SSOServer>
      <BasicAuthEnabled>false</BasicAuthEnabled>
      <PublicKeyEndPoint>/token_key</PublicKeyEndPoint>
      <ServerUrl>http://35.197.37.220:9099</ServerUrl>
  </SSOServer>
 </UserAccessControl>
</SecurityProfile>'

停用基本驗證後,所有通過基本驗證憑證的 Edge Management API 呼叫都會傳回下列錯誤:

<Error>
    <Code>security.SecurityProfileBasicAuthDisabled</Code>
    <Message>Basic Authentication scheme not allowed</Message>
    <Contexts/>
</Error>

重新啟用基本驗證

如果您必須重新啟用基本驗證,則必須執行下列步驟:

注意:重新啟用基本驗證時,您必須暫時停用 Edge 上的「所有」驗證,包括 SAML。

  1. 登入任何 Edge ZooKeeper 節點。
  2. 執行下列 bash 指令碼,關閉所有安全性功能:
    注意:這個步驟會停用 Edge 的所有驗證功能,包括 SAML。

    #! /bin/bash
    /opt/apigee/apigee-zookeeper/bin/zkCli.sh -server localhost:2181 <<EOF
    set /system/securityprofile <SecurityProfile></SecurityProfile>
    quit
    EOF

    輸出內容應採用以下格式:
    Connect to localhost:2181
    歡迎使用 ZooKeeper!
    已啟用 JLine 支援:
    WATCHER:

    WatchedEvent state:SyncConnected type:None path:null
    [zk: localhost:2181(CONNECTED) 0] set /system/securityprofile <SecurityProfile></SecurityProfile>
    cZxid = 0x89
    ...
    [zk: localhost:2181(CONNECTED) 1] 結束
    結束...
  3. 重新啟用基本驗證和 SAML 驗證:

    > curl -H "Content-Type: application/xml"
    http://localhost:8080/v1/securityprofile -u sysAdminEmail:pWord -d
    '<SecurityProfile enabled="true" name="securityprofile0">

    <UserAccessProfile enabled="true" name="securityprofile0>
    <UserAccessControlEndKey2> <單一登入金鑰>20>





    您現在可以再次使用基本驗證。