Edge で Basic 認証を無効にする

Edge で SAML または LDAP を有効にすると、基本認証を無効にできます。ただし、Basic 認証を無効にする前に、次の点に注意してください。

  • システム管理者を含むすべての Edge ユーザーを IDP に追加していることを確認します。
  • 新しい Edge UI と Edge Management API で IDP 認証を十分にテストしてください。

現在のセキュリティ プロファイルを表示する

Edge セキュリティ プロファイルを表示して、現在の構成を確認し、基本認証と外部 IDP が現在有効になっているかどうかを判断できます。Edge で使用されている現在のセキュリティ プロファイルを表示するには、Edge Management Server で次の Edge Management API 呼び出しを使用します。

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

外部 IDP をまだ構成していない場合、レスポンスは次のようになります。これは、基本認証が有効になっていることを意味します。

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

外部 IDP をすでに有効にしている場合は、レスポンスに <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>

外部 IDP が有効になっているバージョンでは、<BasicAuthEnabled>true</BasicAuthEnabled> も表示されます。これは、基本認証が引き続き有効であることを意味します。

Basic 認証を無効にする

Basic 認証を無効にするには、Edge Management Server で次の Edge Management API 呼び出しを使用します。

Basic 認証を無効にするには、前のセクションで返された XML オブジェクトをペイロードとして渡します。唯一の違いは <BasicAuthEnabled> を false に設定していることです。次の例をご覧ください。

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>'

Basic 認証を無効にした後、Basic 認証の認証情報を渡す Edge Management API 呼び出しは、次のエラーを返します。

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

Basic 認証を再び有効にする

なんらかの理由で Basic 認証を再度有効にする必要がある場合は、次の手順を行う必要があります。

  1. 任意の Edge ZooKeeper ノードにログインします。
  2. 次の bash スクリプトを実行して、すべてのセキュリティをオフにします。
    #! /bin/bash
    /opt/apigee/apigee-zookeeper/bin/zkCli.sh -server localhost:2181 <<EOF
    set /system/securityprofile <SecurityProfile></SecurityProfile>
    quit
    EOF

    次のような形式で出力が表示されます。

    Connecting to localhost:2181
    Welcome to ZooKeeper!
    JLine support is enabled
    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] quit
    Quitting...
  3. Basic 認証と外部 IDP 認証を再度有効にします。
    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>true</BasicAuthEnabled>
      <PublicKeyEndPoint>/token_key</PublicKeyEndPoint>
      <ServerUrl>http://35.197.37.220:9099</ServerUrl>
      </SSOServer>
      </UserAccessControl>
      </SecurityProfile>'

これで、Basic 認証を再び使用できるようになります。新しい Edge UI を SSO から基本認証に戻すには、新しい Edge UI 構成ファイルで AUTH_MODE=basic と MANAGEMENT_UI_SSO_ENABLED=n を設定し、/opt/apigee/apigee-service/bin/apigee-service edge-management-ui configure-sso -f configFile の後に /opt/apigee/apigee-service/bin/apigee-service edge-management-ui restart を実行します(または /opt/apigee/apigee-setup/bin/setup.sh -p ue -f configFile を実行します)。