我们有一个api的后端,需要在访问api时显示客户端证书。 我们已将客户端证书添加到repository / resources / security / client-truststore.jks以及所有Root CA和Intermediate Certs。重启服务器。
我相信Wso2现在能够发送对后端API的调用并返回状态代码403.它返回403,因为后端api没有收到带有请求的客户端证书...
{
"timestamp": "2017-03-14T21:33:36.523Z",
"status": 403,
"error": "Forbidden",
"message": "Access Denied",
"path": "/registrations"
}
当我们直接从带有证书的服务器执行后端时,它工作正常:
curl -k --cert /tmp/client.pem:changeit -X POST https://10.7.64.36:8443/registrations -H "Content-Type: application/json" -d "{\"primaryAccountNumber\": \"12122121212\"}"
我们得到了有效回复:
{"registration_id":null,"transaction_id":null,"authentication_code":null,"qr_code_image":null,"registered":null,"status":null,"score":null,"reason_codes":[]}
所以curl如何发送--cert请求如何在wso2 api manger中执行此操作,请告知如何将客户端证书关联到后端URL ...以便它将由wso2 api-manager和后端发送将是能够处理请求。
谢谢。答案 0 :(得分:1)
对于相互ssl,您可以参考以下博客文章。
http://ishara-cooray.blogspot.com/2016/07/how-to-secure-your-backend-services-and.html
以下是博文中的重要部分。
配置API Manager以启用动态ssl配置文件
为HHTPS传输发件人配置动态SSL配置文件的APIM, 您需要创建一个新的XML文件 /repository/deployment/server/multi_ssl_profiles.xml(这个 路径是可配置的)并将以下配置复制到其中。这个 将client-truststore.jks配置为所有人的Trust Store 连接到10.100.5.130:9443
<parameter name="customSSLProfiles"> <profile> <servers>10.100.5.130:9443</servers> <TrustStore> <Location>repository/resources/security/client-truststore.jks </Location> <Type>JKS</Type> <Password>wso2carbon</Password> </TrustStore> </profile> </parameter>
要启用动态加载此配置,请在下面添加 Transport Sender配置的配置 API Manager的(PassThroughHttpSSLSender) ({AM_HOME} /repository/conf/axis2.xml)。将上面的文件路径设置为 “filePath”参数。
<parameter name="dynamicSSLProfilesConfig"> <filePath>repository/deployment/server/multi_ssl_profiles.xml</filePath> <fileReadInterval>3600000</fileReadInterval> </parameter> <parameter name="HostnameVerifier">AllowAll</parameter>
现在,后端服务和ESB都配置为使用默认密钥 存储和API Manager配置为加载动态SSL配置文件。 重启API Manager。它将在控制台中显示以下消息 确认已加载动态配置。
加载ClientConnFactoryBuilder customSSLProfiles配置 来自路径: