为了不断提高AEM的安全性,Adobe默认引入了SSL功能。 其目的是鼓励使用HTTPS连接到AEM实例。
您可以从AEM主屏幕单击相关的收件箱消息以开始默认配置SSL/TLS。 要访问收件箱,请按屏幕右上角的铃铛图标。 然后,单击 查看全部. 这将显示一个列表,其中包含以列表视图排序的所有警报。
在列表中,选择并打开 配置HTTPS 警报:
如果 配置HTTPS 警报在收件箱中不存在,您可以通过转到,直接导航到HTTPS向导 http://serveraddress:serverport/libs/granite/security/content/sslConfig.html?item=configuration%2Fconfiguressl&_charset_=utf-8
名为的服务用户 ssl-service 已为此功能创建。 打开警报后,将引导您完成以下配置向导:
首先,设置存储凭据。 这些是 ssl-service 系统用户的密钥存储,将包含HTTPS侦听器的私钥和信任存储。
输入身份证明后,单击 下一个 页面右上角的。 然后,为SSL/TLS连接上传关联的私钥和证书。
有关如何生成要用于向导的私钥和证书的信息,请参阅 此过程 下面的。
最后,指定HTTPS侦听器的HTTPS主机名和TCP端口。
默认情况下,有三种方法可自动化SSL/TLS。
第一种方法是发布到配置向导正在使用的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 OK”或错误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.
Please take note of the key store password you provided. You will 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>
或者,您也可以通过上传已包含以下必需项目的包来自动化SSL/TLS设置:
GraniteSslConnectorFactory
配置下面您将找到一个示例,用于创建SSL/TLS向导可以使用的采用DER格式的自签名证书。 基于操作系统安装OpenSSL,打开OpenSSL命令提示符,然后将目录更改为要生成私钥/证书的文件夹。
自签名证书的使用仅用于示例目的,不应在生产中使用。
首先,创建私钥:
openssl genrsa -aes256 -out localhostprivate.key 4096
openssl rsa -in localhostprivate.key -out localhostprivate.key
然后,使用私钥生成证书签名请求(CSR):
openssl req -sha256 -new -key localhostprivate.key -out localhost.csr -subj "/CN=localhost"
生成SSL/TLS证书并使用私钥对其进行签名。 在此示例中,将从现在起一年后过期:
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证书所示。
参见 在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"
— 确认truststore密码;
-F "privatekeyFile=@localhostprivate.der"
— 指定私钥;
-F "certificateFile=@localhost.crt"
— 指定证书;
-F "httpsHostname=host.example.com"
— 指定主机名;
-F "httpsPort=8443"
- HTTPS侦听器将使用的端口。
运行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
您可以通过重复certificateFile参数,向servlet发送证书链,如下所示:
-F "certificateFile=@root.crt" -F "certificateFile=@localhost.crt"..
执行命令后,请验证所有证书是否都进入密钥库。 从以下位置检查密钥库:
http://localhost:4502/libs/granite/security/content/userEditor.html/home/users/system/security/ssl-service
转到Web控制台
然后,导航到 osgi - 配置 - AdobeGranite SSL连接器工厂
转到 包含密码套件 字段并添加以下条目。 您可以通过按“+”按钮,在中添加每个按钮后:
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