為 Management API 設定傳輸層安全標準 (TLS)

根據預設,Management API 會停用 TLS,您可以使用管理伺服器節點的 IP 位址和通訊埠 8080,透過 HTTP 存取 Edge Management API。例如:

http://ms_IP:8080

或者,您也可以設定 Management API 的 TLS 存取權,以便透過下列格式存取:

https://ms_IP:8443

在本範例中,您會將 TLS 存取權設為使用通訊埠 8443。不過,Edge 不需要該通訊埠編號,您可以將管理伺服器設為使用其他通訊埠值。唯一的要求是防火牆必須允許流量通過指定通訊埠。

如要確保往返 Management API 的流量經過加密,請在 /opt/apigee/customer/application/management-server.properties 檔案中調整設定。

除了 TLS 設定外,您也可以修改 management-server.properties 檔案,控管密碼驗證 (密碼長度和強度)。

確認 TLS 通訊埠已開啟

本節中的程序會將 TLS 設為使用管理伺服器上的通訊埠 8443。無論使用哪個通訊埠,都必須確保管理伺服器上的通訊埠已開啟。例如,您可以使用下列指令開啟:

iptables -A INPUT -m state --state NEW -m tcp -p tcp --dport 8443 -j ACCEPT --verbose

設定 TLS

編輯 /opt/apigee/customer/application/management-server.properties 檔案,控制 Management API 往來流量的 TLS 使用情形。如果這個檔案不存在,請建立檔案。

如要設定 Management API 的 TLS 存取權:

  1. 產生 KeyStore JKS 檔案,其中包含 TLS 憑證和私密金鑰。詳情請參閱「為 Edge On-Premises 設定 TLS/SSL」。
  2. 將 KeyStore JKS 檔案複製到管理伺服器節點上的目錄,例如 /opt/apigee/customer/application。
  3. 將 JKS 檔案的擁有權變更為「apigee」使用者:
    chown apigee:apigee keystore.jks

    其中 keystore.jks 是 KeyStore 檔案的名稱。

  4. 編輯 /opt/apigee/customer/application/management-server.properties,設定下列屬性。如果該檔案不存在,請建立檔案:
    conf_webserver_ssl.enabled=true
    # Leave conf_webserver_http.turn.off set to false
    # because many Edge internal calls use HTTP.
    conf_webserver_http.turn.off=false
    conf_webserver_ssl.port=8443
    conf_webserver_keystore.path=/opt/apigee/customer/application/keystore.jks
    # Enter the obfuscated keystore password below.
    conf_webserver_keystore.password=OBF:obfuscatedPassword

    其中 keyStore.jks 是 KeyStore 檔案,obfuscatedPassword 則是經過模糊處理的 KeyStore 密碼。如要瞭解如何產生模糊處理的密碼,請參閱「為 Edge On-Premises 設定 TLS/SSL」。

  5. 使用下列指令重新啟動 Edge Management Server:
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server restart

Management API 現在支援透過 TLS 存取。

設定 Edge UI,使用 TLS 存取 Edge API

在上述程序中,Apigee 建議保留 conf_webserver_http.turn.off=false,以便 Edge UI 繼續透過 HTTP 呼叫 Edge API。

請按照下列程序設定 Edge UI,僅透過 HTTPS 進行這些呼叫:

  1. 按照上述方式,設定 Management API 的 TLS 存取權。
  2. 確認 TLS 適用於 Management API 後,請編輯 /opt/apigee/customer/application/management-server.properties,設定下列屬性:
    conf_webserver_http.turn.off=true
  3. 執行下列指令,重新啟動 Edge Management Server:
    /opt/apigee/apigee-service/bin/apigee-service edge-management-server restart 
  4. 編輯 /opt/apigee/customer/application/ui.properties,為 Edge UI 設定下列屬性:
    conf_apigee_apigee.mgmt.baseurl="https://FQ_domain_name:port/v1"

    其中 FQ_domain_name 是完整網域名稱 (根據管理伺服器的憑證位址),port 則是 conf_webserver_ssl.port 在上方指定的通訊埠。

    如果 ui.properties 不存在,請建立該檔案。

  5. 只有在設定上述 Management API 的 TLS 存取權時,使用自行簽署的憑證 (不建議在正式環境中使用),才需要將下列屬性新增至 ui.properties:
    conf/application.conf+play.ws.ssl.loose.acceptAnyCertificate=true

    否則 Edge UI 會拒絕自行簽署的憑證。

  6. 執行下列指令,重新啟動 Edge UI:
    /opt/apigee/apigee-service/bin/apigee-service edge-ui restart

管理伺服器的 TLS 屬性

下表列出您可以在 management-server.properties 中設定的所有 TLS/SSL 屬性:

屬性 說明

conf_webserver_http.port=8080

預設值為 8080。

conf_webserver_ssl.enabled=false

啟用/停用 TLS/SSL。啟用 TLS/SSL (設為 true) 時,您也必須設定 ssl.port 和 keystore.path 屬性。

conf_webserver_http.turn.off=true

啟用/停用 http 和 https。如果只想使用 HTTPS,請將預設值保留為 true。

conf_webserver_ssl.port=8443

TLS/SSL 通訊埠。

啟用 TLS/SSL (conf_webserver_ssl.enabled=true) 時,必須提供這項資訊。

conf_webserver_keystore.path=path

金鑰儲存庫檔案的路徑。

啟用 TLS/SSL (conf_webserver_ssl.enabled=true) 時,必須提供這項資訊。

conf_webserver_keystore.password=password

請使用經過模糊處理的密碼,格式如下:OBF:xxxxxxxxxx

conf_webserver_cert.alias=alias

選用的金鑰儲存庫憑證別名

conf_webserver_keymanager.password=password

如果金鑰管理工具設有密碼,請以下列格式輸入經過模糊處理的密碼:

OBF:xxxxxxxxxx

conf_webserver_trust.all=[false | true]

conf_webserver_trust.store.path=path

conf_webserver_trust.store.password=password

設定信任存放區。決定是否要接受所有 TLS/SSL 憑證 (例如接受非標準類型)。預設值為 false。請提供信任存放區的路徑,並以下列格式輸入經過模糊處理的信任存放區密碼:

OBF:xxxxxxxxxx

conf_webserver_exclude.cipher.suites=CIPHER_SUITE_1 CIPHER_SUITE_2

conf_webserver_include.cipher.suites=

指出要納入或排除的加密套件。舉例來說,如果您發現密碼有安全漏洞,可以在這裡排除。請以空格分隔多個加密。

如要瞭解加密套件和密碼編譯架構,請參閱 JDK 8 的 Java 密碼編譯架構 Oracle 供應商說明文件。

conf_webserver_ssl.session.cache.size=

conf_webserver_ssl.session.timeout=

決定下列項目的整數:

  • TLS/SSL 工作階段快取大小 (以位元組為單位),用於儲存多個用戶端的工作階段資訊。
  • TLS/SSL 工作階段逾時前的持續時間 (以毫秒為單位)。