2017-03-15 31 views
0

我們有一個api的後端,在訪問api時需要顯示客戶端證書。 我們已將客戶端證書添加到資源庫/資源/安全/客戶端信任庫.jks以及所有根CA和中級證書。重新啓動服務器。wso2 API管理器|如何將客戶端證書關聯到後端/目標端點

我相信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管理器中做到這一點,請告知如何將客戶端證書與後端url相關聯,以便它將由wso2 api-manager發送,後端將會能夠處理請求。

謝謝。

回答

1

對於互惠ssl你可以參考以下博客文章。

http://ishara-cooray.blogspot.com/2016/07/how-to-secure-your-backend-services-and.html

下面是從博客文章的重要組成部分。

配置API Manager啓用動態SSL配置文件

,爲動態SSL配置文件用於HHTPS運輸發件人配置APIM, 你需要創建一個新的XML文件 /庫/部署/服務器/ multi_ssl_profiles .XML(這 路徑配置)和下面的配置複製到it.This 將客戶truststore.jks配置爲信任存儲所有 連接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> 

爲了使這種結構的動態加載,下面 配置添加到API管理器 ({AM_HOME} /repository/conf/axis2.xml)運輸發件人配置 (PassThroughHttpSSLSender)。將文件路徑設置爲 「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管理器。它將在控制檯 中顯示以下消息,確認已加載動態配置。

ClientConnFactoryBuilder customSSLProfiles配置是從路徑加載 :

+0

真棒!你又救了我。有效。除了博客。我不得不在「customSSLProfiles」中添加KeyStore。 <參數名稱=「customSSLProfiles」>服務器> 10.0.0。0:8080,xyx.com:9080庫/資源/安全/客戶truststore.jks JKS wso2carbon庫/資源/安全/ abc.pfx PKCS12 12345 Pravin

+0

想要添加我從這裏獲得的KeyStore - https://docs.wso2.com/display/ESB500/Multi-HTTPS+Transport – Pravin