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

管理 API 的 TLS 預設會停用,而您可以使用管理伺服器節點和通訊埠 8080 的 IP 位址,透過 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 檔案,藉此控管傳入和傳出 API 流量的 TLS 使用情形。如果這個檔案不存在,請建立檔案。

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

  1. 產生含有傳輸層安全標準 (TLS) 憑證和私密金鑰的 KeyStore JKS 檔案。詳情請參閱為 Edge On Premise 設定 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 能正常運作後,請編輯 /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

KeyStore 檔案路徑。

啟用 TLS/SSL 時為必要 (conf_webserver_ssl.enabled=true)。

conf_webserver_keystore.password=password

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

conf_webserver_cert.alias=alias

選用的 KeyStore 憑證別名

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=

指定要納入或排除的任何加密套件。舉例來說,假如您發現加密套件中的安全漏洞,可以在這裡排除該加密安全漏洞。請使用空格分隔多組加密。

如需瞭解 cypher 套件和密碼編譯架構,請參閱 JDK 8 適用的 Java Cryptography Architecture Oracle Provider 說明文件

conf_webserver_ssl.session.cache.size=

conf_webserver_ssl.session.timeout=

用於判斷以下項目的整數:

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