預設為SSL/TLS ssl-tls-by-default

為了持續改善AEM的安全性,Adobe已推出一項預設稱為SSL的功能。 其目的是鼓勵使用HTTPS來連線至AEM執行個體。

預設啟用SSL/TLS enabling-ssl-tls-by-default

您可以按一下AEM首頁畫面中的相關「收件匣」訊息,開始依預設設定SSL/TLS。 若要存取「收件匣」,請按一下畫面右上角的鈴鐺圖示。 然後,按一下 檢視全部. 這會顯示清單檢視中排序的所有警報清單。

在清單中,選取並開啟 設定HTTPS 警報:

chlimage_1-103

NOTE
如果 設定HTTPS 警報不存在於收件匣中,您可以直接導覽至HTTPS精靈,方法是前往 http://serveraddress:serverport/libs/granite/security/content/sslConfig.html?item=configuration%2Fconfiguressl&_charset_=utf-8

服務使用者呼叫 ssl-service 已為此功能建立。 開啟警報後,系統就會引導您完成下列設定精靈:

  1. 首先,設定存放區認證。 這些是 ssl-service 將包含HTTPS接聽程式之私密金鑰和信任存放區的系統使用者金鑰存放區。

    chlimage_1-104

  2. 輸入認證後,按一下 下一個 在頁面的右上角。 然後,上傳用於SSL/TLS連線的相關私密金鑰和憑證。

    chlimage_1-105

    note note
    NOTE
    如需有關如何產生私密金鑰和憑證以與精靈一起使用的資訊,請參閱 此程式 底下。
  3. 最後,指定HTTPS監聽器的HTTPS主機名稱和TCP連線埠。

    screen_shot_2018-07-25at31658pm

依預設自動化SSL/TLS automating-ssl-tls-by-default

根據預設,有三種方法可自動化SSL/TLS。

透過HTTPPOST via-http-post

第一個方法涉及張貼至設定精靈正在使用的SSLSetup伺服器:

POST /libs/granite/security/post/sslSetup.html

您可以在POST中使用以下裝載來自動進行設定:

------WebKitFormBoundaryyBO4ArmGlcfdGDbs
Content-Disposition: form-data; name="keystorePassword"

test
------WebKitFormBoundaryyBO4ArmGlcfdGDbs
Content-Disposition: form-data; name="keystorePasswordConfirm"
test
------WebKitFormBoundaryyBO4ArmGlcfdGDbs
Content-Disposition: form-data; name="truststorePassword"
test
------WebKitFormBoundaryyBO4ArmGlcfdGDbs
Content-Disposition: form-data; name="truststorePasswordConfirm"
test
------WebKitFormBoundaryyBO4ArmGlcfdGDbs
Content-Disposition: form-data; name="privatekeyFile"; filename="server.der"
Content-Type: application/x-x509-ca-cert

------WebKitFormBoundaryyBO4ArmGlcfdGDbs
Content-Disposition: form-data; name="certificateFile"; filename="server.crt"
Content-Type: application/x-x509-ca-cert

------WebKitFormBoundaryyBO4ArmGlcfdGDbs
Content-Disposition: form-data; name="httpsPort"
8443

此servlet和任何slingPOSTservlet一樣,將以「200確定」或錯誤HTTP狀態碼回應。 您可以在回應的HTML內文中找到有關狀態的詳細資料。

以下是成功回應和錯誤的範例。

成功範例 (狀態= 200):

<!DOCTYPE html>
<html lang='en'>
<head>
<title>OK</title>
</head>
<body>
<h1>OK</h1>
<dl>
<dt class='foundation-form-response-status-code'>Status</dt>
<dd>200</dd>
<dt class='foundation-form-response-status-message'>Message</dt>
<dd>SSL successfully configured</dd>
<dt class='foundation-form-response-title'>Title</dt>
<dd>OK</dd>
<dt class='foundation-form-response-description'>Description</dt>
<dd>HTTPS has been configured on port 8443. The private key and
certificate were stored in the key store of the user ssl-service.
Take note of the key store password you provided. You need
it for any subsequent updating of the private key or certificate.</dd>
</dl>
<h2>Links</h2>
<ul class='foundation-form-response-links'>
<li><a class='foundation-form-response-redirect' href='/'>Done</a></li>
</ul>
</body>
</html>

錯誤範例 (狀態= 500):

<!DOCTYPE html>
<html lang='en'>
<head>
<title>Error</title>
</head>
<body>
<h1>Error</h1>
<dl>
<dt class='foundation-form-response-status-code'>Status</dt>
<dd>500</dd>
<dt class='foundation-form-response-status-message'>Message</dt>
<dd>The provided file is not a valid key, DER format expected</dd>
<dt class='foundation-form-response-title'>Title</dt>
<dd>Error</dd>
</dl>
</body>
</html>

透過封裝 via-package

或者,您可以上傳已包含這些必要專案的套件,以自動化SSL/TLS設定:

  • ssl服務使用者的金鑰存放區。 此檔案位於 /home/users/system/security/ssl-service/keystore 存放庫中的。
  • GraniteSslConnectorFactory 設定

產生要與精靈一起使用的私密金鑰/憑證配對 generating-a-private-key-certificate-pair-to-use-with-the-wizard

以下範例說明如何建立DER格式的自簽憑證,供SSL/TLS精靈使用。 根據作業系統安裝OpenSSL,開啟OpenSSL命令提示字元,並將目錄切換到您要產生私密金鑰/憑證的資料夾。

NOTE
自我簽署憑證僅供範例使用。 請勿在生產環境中使用。
  1. 首先,建立私密金鑰:

    code language-shell
    openssl genrsa -aes256 -out localhostprivate.key 4096
    openssl rsa -in localhostprivate.key -out localhostprivate.key
    
  2. 接著,使用私密金鑰產生憑證申請檔(CSR):

    code language-shell
    openssl req -sha256 -new -key localhostprivate.key -out localhost.csr -subj "/CN=localhost"
    
  3. 產生SSL/TLS憑證並使用私密金鑰簽署。 在此範例中,將於一年後到期:

    code language-shell
    openssl x509 -req -days 365 -in localhost.csr -signkey localhostprivate.key -out localhost.crt
    

將私密金鑰轉換為DER格式。 這是因為SSL精靈要求金鑰必須是DER格式:

openssl pkcs8 -topk8 -inform PEM -outform DER -in localhostprivate.key -out localhostprivate.der -nocrypt

最後,上傳 localhostprivate.der 作為私密金鑰和 localhost.crt 此頁面開頭說明的圖形SSL/TLS精靈步驟2中的SSL/TLS憑證。

透過cURL更新SSL/TLS設定 updating-the-ssl-tls-configuration-via-curl

NOTE
另請參閱 搭配AEM使用cURL 以取得AEM中有用的cURL命令的集中式清單。

您也可以使用cURL工具自動化SSL/TLS設定。 您可以將設定引數張貼至此URL來執行此操作:

https://<serveraddress>:<serverport>/libs/granite/security/post/sslSetup.html

以下是您可以在設定精靈中用來變更各種設定的引數:

  • -F "keystorePassword=password" — 金鑰庫密碼;

  • -F "keystorePasswordConfirm=password" — 確認金鑰庫密碼;

  • -F "truststorePassword=password" — 信任庫密碼;

  • -F "truststorePasswordConfirm=password" — 確認信任庫密碼;

  • -F "privatekeyFile=@localhostprivate.der" — 指定私密金鑰;

  • -F "certificateFile=@localhost.crt" — 指定憑證;

  • -F "httpsHostname=host.example.com" — 指定主機名稱;

  • -F "httpsPort=8443" - HTTPS接聽程式將使用的連線埠。

NOTE
執行cURL以自動化SSL/TLS設定的最快方式是來自DER和CRT檔案所在的資料夾。 或者,您可以在 privatekeyFile 和certificateFile引數。
您也需要驗證才能執行更新,因此請務必附加cURL命令和 -u user:passeword 引數。
正確的cURL post命令應如下所示:
curl -u user:password -F "keystorePassword=password" -F "keystorePasswordConfirm=password" -F "truststorePassword=password" -F "truststorePasswordConfirm=password" -F "privatekeyFile=@localhostprivate.der" -F "certificateFile=@localhost.crt" -F "httpsHostname=host.example.com" -F "httpsPort=8443" https://host:port/libs/granite/security/post/sslSetup.html

使用cURL的多個憑證 multiple-certificates-using-curl

您可以重複certificateFile引數,向servlet傳送憑證鏈,如下所示:

-F "certificateFile=@root.crt" -F "certificateFile=@localhost.crt"..

執行命令後,請確認所有憑證都進入金鑰存放區。 檢查 金鑰存放區 專案來源:
http://localhost:4502/libs/granite/security/content/v2/usereditor.html/home/users/system/security/ssl-service

啟用TLS 1.3連線 enabling-tls-connection

  1. 前往Web主控台

  2. 然後,導覽至 osgi - 設定 - AdobeGranite SSL聯結器工廠

  3. 前往 隨附的密碼套件 欄位並新增以下專案。 您可以按下「+ ​在欄位左側新增「 」按鈕後:

    • TLS_AES_256_GCM_SHA384
    • TLS_AES_128_GCM_SHA256
    • TLS_CHACHA20_POLY1305_SHA256
    • TLS_AES_128_CCM_SHA256
    • TLS_AES_128_CCM_8_SHA256
recommendation-more-help
19ffd973-7af2-44d0-84b5-d547b0dffee2