配置AEM,以便创作实例上的复制代理使用互相SSL(MSSL)与发布实例连接。 使用MSSL,发布实例上的复制代理和HTTP服务使用证书来相互进行身份验证。
为复制配置MSSL涉及执行以下步骤:
创建或获取创作实例和发布实例的私钥和证书。
在创作实例和发布实例上安装密钥和证书:
在发布实例上配置基于Jetty的HTTP服务。
配置复制代理的传输和SSL属性。
您必须确定执行复制的用户帐户。 在发布实例上安装受信任的作者证书时,该证书与此用户帐户相关联。
对于创作实例和发布实例,您需要私钥和公共证书:
以JKS格式生成私钥和证书。 私钥存储在KeyStore文件中,证书存储在TrustStore文件中。 使用Java keytool
创建两者。
使用Java keytool
创建私钥和凭据,请执行以下步骤:
在KeyStore中生成私钥对。
创建或获取证书:
将证书导入TrustStore。
请按照以下步骤为创作实例和发布实例创建私钥和自签名证书。 相应地,对命令选项使用不同的值。
打开命令行窗口或终端。 要创建私钥对 — 公钥对,请使用下表中的选项值输入以下命令:
keytool -genkeypair -keyalg RSA -validity 3650 -alias alias -keystore keystorename.keystore -keypass key_password -storepass store_password -dname "CN=Host Name, OU=Group Name, O=Company Name,L=City Name, S=State, C=Country_ Code"
选项 | 作者 | 发布 |
---|---|---|
-alias | 作者 | 发布 |
-keystore | author.keystore | publish.keystore |
要导出证书,请使用下表中的选项值输入以下命令:
keytool -exportcert -alias alias -file cert_file -storetype jks -keystore keystore -storepass store_password
选项 | 作者 | 发布 |
---|---|---|
-alias | 作者 | 发布 |
-file | author.cer | publish.cer |
-keystore | author.keystore | publish.keystore |
以pkcs#12格式生成私钥和证书。 使用openSSL生成它们。 请按照以下过程生成私钥和证书请求。 要获取证书,请使用您的私钥对请求进行签名(自签名证书),或将请求发送到CA。 然后,生成包含私钥和证书的pkcs#12存档。
打开命令行窗口或终端。 要创建私钥,请使用下表中的选项值输入以下命令:
openssl genrsa -out keyname.key 2048
选项 | 作者 | 发布 |
---|---|---|
-out | author.key | publish.key |
要生成证书请求,请使用下表中的选项值输入以下命令:
openssl req -new -key keyname.key -out key_request.csr
选项 | 作者 | 发布 |
---|---|---|
-key | author.key | publish.key |
-out | author_request.csr | publish_request.csr |
签署证书请求或将请求发送到CA。
要对证书请求进行签名,请使用下表中的选项值输入以下命令:
openssl x509 -req -days 3650 -in key_request.csr -signkey keyname.key -out certificate.cer
选项 | 作者 | 发布 |
---|---|---|
-signkey | author.key | publish.key |
-in | author_request.csr | publish_request.csr |
-out | author.cer | publish.cer |
要将私钥和签名证书添加到pkcs#12文件,请使用下表中的选项值输入以下命令:
openssl pkcs12 -keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-3DES -export -in certificate.cer -inkey keyname.key -out pkcs12_archive.pfx -name "alias"
选项 | 作者 | 发布 |
---|---|---|
-inkey | author.key | publish.key |
-out | author.pfx | publish.pfx |
-in | author.cer | publish.cer |
-name | 作者 | 发布 |
在创作实例上安装以下项目:
要执行以下过程,您必须以创作实例的管理员身份登录。
打开创作实例的“用户管理”页面。 (http://localhost:4502/libs/granite/security/content/useradmin.html)
要打开您的用户帐户的属性,请单击或点按您的用户名。
如果“Create KeyStore”(创建密钥存储)链接出现在“Account Settings”(帐户设置)区域,请单击该链接。 配置密码,然后单击“确定”。
在“帐户设置”区域,单击“管理密钥库”。
单击密钥存储文件中的添加私钥。
单击“选择密钥存储文件”,然后浏览并选择author.keystore文件或author.pfx文件(如果使用pkcs#12),然后单击“打开”。
输入密钥存储的别名和密码。 输入私钥的别名和密码,然后单击“提交”。
关闭KeyStore管理对话框。
打开创作实例的“用户管理”页面。 (http://localhost:4502/libs/granite/security/content/useradmin.html)
要打开您的用户帐户的属性,请单击或点按您的用户名。
如果“Create TrustStore”(创建信任存储)链接出现在“Account Settings”(帐户设置)区域,请单击该链接,为TrustStore创建密码,然后单击“OK”(确定)。
在“帐户设置”区域,单击“管理信任存储”。
单击“从CER文件添加证书”。
清除将证书映射到用户选项。 单击选择证书文件,选择publish.cer,然后单击打开。
关闭TrustStore管理对话框。
在发布实例上安装以下项目:
要执行以下过程,您必须以发布实例的管理员身份登录。
在发布实例上配置基于Apache Felix Jetty的HTTP服务的属性,以便它在访问Granite Keystore时使用HTTPS。 服务的PID为org.apache.felix.http
。
下表列出了在使用Web控制台时需要配置的OSGi属性。
Web控制台上的属性名称 | OSGi属性名称 | 值 |
---|---|---|
启用HTTPS | org.apache.felix.https.enable | true |
启用HTTPS以使用Granite KeyStore | org.apache.felix.https.use.granite.keystore | true |
HTTPS 端口 | org.osgi.service.http.port.secure | 8443(或其他所需端口) |
客户端证书 | org.apache.felix.https.clientcertificate | "需要客户端证书" |
在创作实例上配置复制代理,以在连接到发布实例时使用HTTPS协议。 有关配置复制代理的完整信息,请参阅配置复制代理。
要启用MSSL,请根据下表在“传输”选项卡上配置属性:
属性 | 值 |
---|---|
URI | https://server_name:SSL_port/bin/receive?sling:authRequestLogin=1 例如: http://localhost:8443/bin/receive?sling:authRequestLogin=1 |
用户 | 无值 |
密码 | 无值 |
SSL | 客户端身份验证 |
配置复制代理后,请测试连接以确定MSSL配置是否正确。
29.08.2014 14:02:46 - Create new HttpClient for Default Agent
29.08.2014 14:02:46 - * HTTP Version: 1.1
29.08.2014 14:02:46 - * Using Client Auth SSL configuration *
29.08.2014 14:02:46 - adding header: Action:Test
29.08.2014 14:02:46 - adding header: Path:/content
29.08.2014 14:02:46 - adding header: Handle:/content
29.08.2014 14:02:46 - deserialize content for delivery
29.08.2014 14:02:46 - No message body: Content ReplicationContent.VOID is empty
29.08.2014 14:02:46 - Sending POST request to http://localhost:8443/bin/receive?sling:authRequestLogin=1
29.08.2014 14:02:46 - sent. Response: 200 OK
29.08.2014 14:02:46 - ------------------------------------------------
29.08.2014 14:02:46 - Sending message to localhost:8443
29.08.2014 14:02:46 - >> POST /bin/receive HTTP/1.0
29.08.2014 14:02:46 - >> Action: Test
29.08.2014 14:02:46 - >> Path: /content
29.08.2014 14:02:46 - >> Handle: /content
29.08.2014 14:02:46 - >> Referer: about:blank
29.08.2014 14:02:46 - >> Content-Length: 0
29.08.2014 14:02:46 - >> Content-Type: application/octet-stream
29.08.2014 14:02:46 - --
29.08.2014 14:02:46 - << HTTP/1.1 200 OK
29.08.2014 14:02:46 - << Connection: Keep-Alive
29.08.2014 14:02:46 - << Server: Day-Servlet-Engine/4.1.64
29.08.2014 14:02:46 - << Content-Type: text/plain;charset=utf-8
29.08.2014 14:02:46 - << Content-Length: 26
29.08.2014 14:02:46 - << Date: Fri, 29 Aug 2014 18:02:46 GMT
29.08.2014 14:02:46 - << Set-Cookie: login-token=3529326c-1500-4888-a4a3-93d299726f28%3ac8be86c6-04bb-4d18-80d6-91278e08d720_98797d969258a669%3acrx.default; Path=/; HttpOnly; Secure
29.08.2014 14:02:46 - << Set-Cookie: cq-authoring-mode=CLASSIC; Path=/; Secure
29.08.2014 14:02:46 - <<
29.08.2014 14:02:46 - << R
29.08.2014 14:02:46 - << eplicationAction TEST ok.
29.08.2014 14:02:46 - Message sent.
29.08.2014 14:02:46 - ------------------------------------------------
29.08.2014 14:02:46 - Replication (TEST) of /content successful.
Replication test succeeded