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

私有雲的邊緣 4.17.05 版

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

http://ms_IP:8080

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

https://ms_IP:8443

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

如要確保傳入及傳出管理 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 檔案,控管傳入及傳出流量的傳輸層安全標準 (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
    # 將 conf_webserver_http.turn.off 設為 false
    #,因為許多 Edge 內部呼叫都使用 HTTP。
    conf_webserver_http.turn.off=false
    conf_webserver_ssl.port=8443
    conf_webserver_keystore.path=/opt/apigee/customer/application/keystore.jks
    # 在下方輸入經過模糊處理的 KeyStore 密碼。
    conf_webserver_keystore.password=OBF:obfuscatedPassword
    conf_webserver_cert.alias=apigee-devtest


    其中 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) 進行存取。

確認 TLS 正常運作 (包括確保 TLS 能正常運作) 後,您可以按照下一節的說明,停用 Management API 的 HTTP 存取權。

將 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://FQDN:8443/v1"

    其中「FQDN是管理伺服器的憑證位址,而通訊埠編號則是 conf_webserver_ssl. 上方指定的通訊埠編號。
  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=

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

conf_webserver_cert.alias=

選用的 KeyStore 憑證別名

conf_webserver_keymanager.password=

如果您的金鑰管理工具設有密碼,請使用下列格式輸入經過模糊處理的密碼版本:OBF:xxxxxxxxxx

conf_webserver_trust.all= <false | true>

conf_webserver_trust.store.path=<path>

conf_webserver_trust.store.password=

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

conf_webserver_Exclude.cipher.suites=<CIPHER_SUITE_1 CIPHER_SUITE_2>

conf_webserver_include.cipher.suites=

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

如要瞭解 cypher 套件和密碼編譯架構,請參閱:

http://docs.oracle.com/javase/8/docs/technotes/
guide/security/SunProviders.html#SunJSSE

conf_webserver_ssl.session.cache.size=

conf_webserver_ssl.session.timeout=

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

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