為 HTTPS 存取權設定 Apigee 單一登入 (SSO) 服務

安裝及設定 Apigee SSO 說明如何安裝並設定 Apigee SSO 模組,以便在通訊埠 9099 上使用 HTTP,如 Edge 設定檔中下列屬性所指定:

SSO_TOMCAT_PROFILE=DEFAULT

或者,您也可以將 SSO_TOMCAT_PROFILE 設為下列其中一個值,啟用 HTTPS 存取功能:

  • SSL_PROXY:在 Proxy 模式下設定 apigee-sso (Apigee SSO 模組),代表您在 apigee-sso 前安裝負載平衡器,並在負載平衡器上終止 TLS。然後針對來自負載平衡器的要求,指定 apigee-sso 上使用的通訊埠。
  • 「SSL_TERMINATION」SSL_TERMINATION::在您選擇的通訊埠上啟用 apigee-sso 的 TLS 存取權。您必須為這個模式指定 KeyStore,此模式包含由 CA 簽署的憑證。無法使用自行簽署的憑證。

您可以在初次安裝及設定 apigee-sso 時選擇啟用 HTTPS,也可以之後再啟用。

如果在任一模式下啟用 HTTPS 存取 apigee-sso,HTTP 存取權就會停用。也就是說,您無法同時使用 HTTP 和 HTTPS 存取 apigee-sso

啟用 SSL_PROXY 模式

SSL_PROXY 模式下,您的系統會在 Apigee SSO 模組前方使用負載平衡器,並在負載平衡器上終止 TLS。在下圖中,負載平衡器會在通訊埠 443 上終止 TLS,然後將要求轉送至通訊埠 9099 上的 Apigee SSO 模組:

在這項設定中,您信任從負載平衡器到 Apigee 單一登入 (SSO) 模組的連線,因此不必針對該連線使用 TLS。不過,IDP 等外部實體現在必須透過通訊埠 443 存取 Apigee 單一登入 (SSO) 模組,而不是透過未受保護的通訊埠 9099 存取。

SSL_PROXY 模式下設定 Apigee 單一登入 (SSO) 模組的原因,是 Apigee 單一登入 (SSO) 模組會自動產生由 IDP 外部使用的重新導向網址,以執行驗證程序。因此,這些重新導向網址必須包含負載平衡器的外部通訊埠編號,在本例中為 443,而非 Apigee SSO 模組 9099 的內部通訊埠。

如何為 SSL_PROXY 模式設定 Apigee SSO 模組:

  1. 在設定檔中新增以下設定:
    # Enable SSL_PROXY mode.
    SSO_TOMCAT_PROFILE=SSL_PROXY
    
    # Specify the apigee-sso port, typically between 1025 and 65535.
    # Typically ports 1024 and below require root access by apigee-sso.
    # The default is 9099.
    SSO_TOMCAT_PORT=9099
    
    # Specify the port number on the load balancer for terminating TLS.
    # This port number is necessary for apigee-sso to auto-generate redirect URLs.
    SSO_TOMCAT_PROXY_PORT=443
    SSO_PUBLIC_URL_PORT=443
    
    # Set public access scheme of apigee-sso to https.
    SSO_PUBLIC_URL_SCHEME=https
  2. 設定 Apigee SSO 模組:
    /opt/apigee/apigee-service/bin/apigee-service apigee-sso setup -f configFile
  3. 請更新您的 IDP 設定,透過負載平衡器的通訊埠 443 提出 HTTPS 要求,以便存取 Apigee SSO。如需詳細資訊,請參閱下方文章:
  4. 在設定檔中設定下列屬性,即可更新 HTTPS 的 Edge UI 設定:
    SSO_PUBLIC_URL_PORT=443
    SSO_PUBLIC_URL_SCHEME=https

    然後更新 Edge UI:

    /opt/apigee/apigee-service/bin/apigee-service edge-management-ui configure-sso -f configFile

    請為傳統版 UI 使用 edge-ui 元件。

  5. 如果您已安裝 Apigee Developer Services 入口網站 (或只是入口網站),請更新以使用 HTTPS 來存取 Apigee SSO。詳情請參閱「將入口網站設為使用外部 IdP

詳情請參閱「在 Edge UI 中啟用外部 IdP」。

啟用 SSL_TERMINATION 模式

使用 SSL_TERMINATION 模式時,你必須:

  • 產生 TLS 憑證和金鑰,並儲存在 KeyStore 檔案中。無法使用自行簽署的憑證。您必須從 CA 產生憑證。
  • 更新「apigee-sso.」的配置設定

如何透過憑證和金鑰建立 KeyStore 檔案:

  1. 為 JKS 檔案建立目錄:
    sudo mkdir -p /opt/apigee/customer/application/apigee-sso/tomcat-ssl/
  2. 變更為新的目錄:
    cd /opt/apigee/customer/application/apigee-sso/tomcat-ssl/
  3. 建立包含憑證和金鑰的 JKS 檔案。您必須為這個模式指定 KeyStore,當中包含由 CA 簽署的憑證。無法使用自行簽署的憑證。如需建立 JKS 檔案的範例,請參閱「為 Edge On Premise 設定 TLS/SSL」。
  4. 將「apigee」使用者擁有的 JKS 檔案設為:
    sudo chown -R apigee:apigee /opt/apigee/customer/application/apigee-sso/tomcat-ssl

如何設定 Apigee SSO 模組:

  1. 在設定檔中新增以下設定:
    # Enable SSL_TERMINATION mode.
    SSO_TOMCAT_PROFILE=SSL_TERMINATION
    
    # Specify the path to the keystore file.
    SSO_TOMCAT_KEYSTORE_FILEPATH=/opt/apigee/customer/application/apigee-sso/tomcat-ssl/keystore.jks
    
    SSO_TOMCAT_KEYSTORE_ALIAS=sso
    
    # The password specified when you created the keystore.
    SSO_TOMCAT_KEYSTORE_PASSWORD=keystorePassword
    
    # Specify the HTTPS port number between 1025 and 65535.
    # Typically ports 1024 and below require root access by apigee-sso.
    # The default is 9099.
    SSO_TOMCAT_PORT=9443
    SSO_PUBLIC_URL_PORT=9443
    
    # Set public access scheme of apigee-sso to https.
    SSO_PUBLIC_URL_SCHEME=https
  2. 設定 Apigee SSO 模組:
    /opt/apigee/apigee-service/bin/apigee-service apigee-sso setup -f configFile
  3. 請更新您的 IDP 設定,透過負載平衡器的通訊埠 9443 提出 HTTPS 要求,以便存取 Apigee SSO。請確認目前沒有其他服務正在使用此通訊埠。

    如需更多資訊,請參考下列資源:

  4. 設定下列屬性,更新 HTTPS 的 Edge UI 設定:
    SSO_PUBLIC_URL_PORT=9443
    SSO_PUBLIC_URL_SCHEME=https
  5. 如果您已安裝 Developer Services 入口網站,請將其更新為使用 HTTPS 存取 Apigee SSO。詳情請參閱「將入口網站設為使用外部 IdP」。

使用 SSL_TERMINATION 模式時,設定 SSO_TOMCAT_PROXY_PORT

您可能在 Apigee SSO 模組之前有一個負載平衡器,該模組會終止負載平衡器的 TLS,但也會啟用負載平衡器和 Apigee SSO 之間的 TLS。在上圖的 SSL_PROXY 模式中,這代表從負載平衡器連至 Apigee SSO 的連線使用的是 TLS。

在本情境中,您會像上述 SSL_TERMINATION 模式一樣,在 Apigee SSO 上設定 TLS。不過,如果負載平衡器使用的傳輸層安全標準 (TLS) 通訊埠號碼與 Apigee SSO 使用的傳輸層安全標準 (TLS) 不同,您也必須在設定檔中指定 SSO_TOMCAT_PROXY_PORT 屬性。例如:

  • 負載平衡器會終止通訊埠 443 的 TLS
  • Apigee SSO 會在通訊埠 9443 上終止傳輸層安全標準 (TLS)

請務必在設定檔中加入以下設定:

# Specify the port number on the load balancer for terminating TLS.
# This port number is necessary for apigee-sso to generate redirect URLs.
SSO_TOMCAT_PROXY_PORT=443
SSO_PUBLIC_URL_PORT=443

設定 IdP 和 Edge UI,透過通訊埠 443 發出 HTTPS 要求。