我正在使用Savon和HTTPi,Ruby soap客戶端和Ruby HTTP客戶端接口分別通過SSL編寫soap請求。這裏的代碼:SSL模式標誌 - 證書驗證:可以安全使用:無?
client = Savon::Client.new(original_class.constantize.wsdl_url)
client.http.auth.ssl.cert_key_file = "path_to_the_key"
client.http.auth.ssl.cert_key_password = 'secret'
client.http.auth.ssl.cert_file = "path_to_the_certification"
client.http.auth.ssl.verify_mode = :none
@response = client.request :ins0, action do
soap.body = encoded_body
end
這是我得到這個工作的唯一途徑。但是,我知道有三個人驗證模式,分別是:
- :同行(SSL_VERIFY_PEER)
- :fail_if_no_peer_cert(SSL_VERIFY_FAIL_IF_NO_PEER_CERT)
- :client_once(SSL_VERIFY_CLIENT_ONCE)
如果我將驗證模式更改爲以上任意一種,我收到此錯誤:
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
T母雞來我的問題(其中包括我):
- 我做錯了,如果我保持驗證模式:none?有沒有安全性?
- 錯誤的真正含義是什麼?我的代碼錯了,或者我的證書(這是自我分配---我在開發環境中)不好?
我讀了OpenSSL文檔有關驗證模式:
http://www.openssl.org/docs/ssl/SSL_CTX_set_verify.html
關於SSL_VERIFY_NONE,在客戶端模式,他說:
The result of the certificate verification process can be checked after the TLS/SSL handshake using the SSL_get_verify_result(3) function. The handshake will be continued regardless of the verification result.
我應該擔心嗎?我應該看到驗證模式:沒有任何危險的事情?
我在問,因爲我無法使其與其他驗證模式一起工作,所以我想通過SSL功能以現在的方式發佈soap請求。但如果這可能是危險的,我肯定不會這樣做。