Skip to content

Commit

Permalink
Merge pull request #214 from c960657/ssl-ciphers
Browse files Browse the repository at this point in the history
Implement HTTPI::Auth::SSL#ciphers configuration
  • Loading branch information
olleolleolle authored Nov 16, 2020
2 parents 8cb7189 + 03f1293 commit d3b9843
Show file tree
Hide file tree
Showing 21 changed files with 178 additions and 77 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
### Unreleased
* Feature: [#214](https://github.com/savonrb/httpi/pull/214) Add SSL ciphers configuration

### 2.4.5

* Improvement: [#209](https://github.com/savonrb/httpi/pull/209) Drop Travis CI support for Ruby < 2.3.0 and jruby.
Expand Down
2 changes: 1 addition & 1 deletion httpi.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Gem::Specification.new do |s|

s.add_development_dependency 'rubyntlm', '~> 0.3.2'
s.add_development_dependency 'rake', '~> 10.0'
s.add_development_dependency 'rspec', '~> 2.14'
s.add_development_dependency 'rspec', '~> 3.5'
s.add_development_dependency 'mocha', '~> 0.13'
s.add_development_dependency 'puma', '~> 2.3.2'
s.add_development_dependency 'webmock'
Expand Down
1 change: 1 addition & 0 deletions lib/httpi/adapter/curb.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ def setup_ssl_auth
@client.cert_key = ssl.cert_key_file
@client.cert = ssl.cert_file
@client.certpassword = ssl.cert_key_password
@client.set(:ssl_cipher_list, ssl.ciphers.join(':')) if ssl.ciphers

@client.ssl_verify_peer = ssl.verify_mode == :peer
end
Expand Down
1 change: 1 addition & 0 deletions lib/httpi/adapter/excon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def client_opts
opts[:ssl_verify_peer] = false
end

opts[:ciphers] = ssl.ciphers if ssl.ciphers
opts[:ssl_version] = ssl.ssl_version if ssl.ssl_version
opts[:ssl_min_version] = ssl.min_version if ssl.min_version
opts[:ssl_max_version] = ssl.max_version if ssl.max_version
Expand Down
1 change: 1 addition & 0 deletions lib/httpi/adapter/http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def create_client
context.min_version = @request.auth.ssl.min_version if @request.auth.ssl.min_version != nil
context.max_version = @request.auth.ssl.max_version if @request.auth.ssl.max_version != nil
context.verify_mode = @request.auth.ssl.openssl_verify_mode
context.ciphers = @request.auth.ssl.ciphers if @request.auth.ssl.ciphers

client = ::HTTP::Client.new(:ssl_context => context)
else
Expand Down
1 change: 1 addition & 0 deletions lib/httpi/adapter/httpclient.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def setup_ssl_auth
# Send client-side certificate regardless of state of SSL verify mode
@client.ssl_config.client_cert = ssl.cert
@client.ssl_config.client_key = ssl.cert_key
@client.ssl_config.ciphers = ssl.ciphers if ssl.ciphers

@client.ssl_config.verify_mode = ssl.openssl_verify_mode
end
Expand Down
1 change: 1 addition & 0 deletions lib/httpi/adapter/net_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ def setup_ssl_auth
# Send client-side certificate regardless of state of SSL verify mode
@client.key = ssl.cert_key
@client.cert = ssl.cert
@client.ciphers = ssl.ciphers if ssl.ciphers

@client.verify_mode = ssl.openssl_verify_mode
end
Expand Down
20 changes: 19 additions & 1 deletion lib/httpi/auth/ssl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class SSL

# Returns whether SSL configuration is present.
def present?
(verify_mode == :none) || (cert && cert_key) || ca_cert_file
(verify_mode == :none) || (cert && cert_key) || ca_cert_file || ciphers
rescue TypeError, Errno::ENOENT
false
end
Expand All @@ -48,6 +48,24 @@ def present?
# Certificate store holds trusted CA certificates used to verify peer certificates.
attr_accessor :cert_store

# Accessor for the SSL ciphers list.
attr_reader :ciphers

# Sets the available symmetric algorithms for encryption and decryption.
# @see OpenSSL::SSL::SSLContext#ciphers
# @example
# ssl.ciphers = "cipher1:cipher2:..."
# ssl.ciphers = [name, ...]
# ssl.ciphers = [[name, version, bits, alg_bits], ...]
def ciphers=(ciphers)
@ciphers =
if ciphers
context = OpenSSL::SSL::SSLContext.new
context.ciphers = ciphers
context.ciphers.map(&:first)
end
end

# Returns the cert type to validate SSL certificates PEM|DER.
def cert_type
@cert_type ||= :pem
Expand Down
7 changes: 7 additions & 0 deletions spec/httpi/adapter/curb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,13 @@
request
end

it 'sets ssl_cipher_list' do
request.auth.ssl.ciphers = ["AES128"]
curb.expects(:set).with(any_parameters).at_least(1)
curb.expects(:set).with(:ssl_cipher_list, anything)
adapter.request(:get)
end

context 'sets ssl_version' do
it 'defaults to nil when no ssl_version is specified' do
curb.expects(:ssl_version=).with(nil)
Expand Down
2 changes: 1 addition & 1 deletion spec/httpi/adapter/em_http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@

it "raises an error for HTTP digest auth" do
request.auth.digest "username", "password"
expect { adapter.request(:get) }.to raise_error
expect { adapter.request(:get) }.to raise_error HTTPI::NotSupportedError
end
end

Expand Down
7 changes: 7 additions & 0 deletions spec/httpi/adapter/httpclient_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@

adapter.request(:get)
end

it 'should set the ciphers if specified' do
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers
ssl_config.expects(:ciphers=).with(request.auth.ssl.ciphers)

adapter.request(:get)
end
end

context "(for SSL client auth)" do
Expand Down
17 changes: 17 additions & 0 deletions spec/httpi/auth/ssl_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,23 @@
end
end

describe '#ciphers' do
subject { ssl.ciphers }
let(:ssl) { HTTPI::Auth::SSL.new }

context 'without ciphers' do
before { ssl.ciphers = nil }

it { is_expected.to eq(nil) }
end

context 'with ciphers' do
before { ssl.ciphers = OpenSSL::Cipher.ciphers }

it { is_expected.to be_any.and(all(be_an_instance_of(String))) }
end
end

def ssl
ssl = HTTPI::Auth::SSL.new
ssl.cert_key_file = "spec/fixtures/client_key.pem"
Expand Down
9 changes: 9 additions & 0 deletions spec/integration/curb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@
response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
end

it "works with ciphers" do
request = HTTPI::Request.new(@server.url)
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers

response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
end
end

end
Expand Down
11 changes: 10 additions & 1 deletion spec/integration/excon_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require "spec_helper"
require "integration/support/server"

describe HTTPI::Adapter::HTTPClient do
describe HTTPI::Adapter::Excon do

subject(:adapter) { :excon }

Expand Down Expand Up @@ -159,6 +159,15 @@
response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
end

it "works with ciphers" do
request = HTTPI::Request.new(@server.url)
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers

response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
end
end
end

Expand Down
59 changes: 17 additions & 42 deletions spec/integration/fixtures/ca_all.pem
Original file line number Diff line number Diff line change
@@ -1,44 +1,19 @@
-----BEGIN CERTIFICATE-----
MIID0DCCArigAwIBAgIBADANBgkqhkiG9w0BAQUFADA8MQswCQYDVQQGDAJKUDES
MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxCzAJBgNVBAMMAkNBMB4X
DTA0MDEzMDAwNDIzMloXDTM2MDEyMjAwNDIzMlowPDELMAkGA1UEBgwCSlAxEjAQ
BgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMQswCQYDVQQDDAJDQTCCASIw
DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANbv0x42BTKFEQOE+KJ2XmiSdZpR
w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ThHjPTVhw5EAQSDKXCCvaxAbVw6
ZPLNnOdK6DvqEZ3GC5WlaHQdmLxmN4OfV6AEtpgqgGY9u8K1ylTr3ET7xLK7bhcA
oZsggEVZr1Ifx9BWIazRNwlw
-----END CERTIFICATE-----
34 changes: 17 additions & 17 deletions spec/integration/fixtures/server.cert
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIC/zCCAeegAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MQswCQYDVQQGDAJKUDES
MBAGA1UECgwJSklOLkdSLkpQMQwwCgYDVQQLDANSUlIxDjAMBgNVBAMMBVN1YkNB
MB4XDTA0MDEzMTAzMTMxNloXDTMzMDEyMzAzMTMxNlowQzELMAkGA1UEBgwCSlAx
EjAQBgNVBAoMCUpJTi5HUi5KUDEMMAoGA1UECwwDUlJSMRIwEAYDVQQDDAlsb2Nh
bGhvc3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBANFJTxWqup3nV9dsJAku
p+WaXnPNIzcpAA3qMGZDJTJsfa8Du7ZxTP0XJK5mETttBrn711cJxAuP3KjqnW9S
vtZ9lY2sXJ6Zj62sN5LwG3VVe25dI28yR1EsbHjJ5Zjf9tmggMC6am52dxuHbt5/
vHo4ngJuKE/U+eeGRivMn6gFAgMBAAGjgYUwgYIwDAYDVR0TAQH/BAIwADAxBglg
hkgBhvhCAQ0EJBYiUnVieS9PcGVuU1NMIEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAd
BgNVHQ4EFgQUpZIyygD9JxFYHHOTEuWOLbCKfckwCwYDVR0PBAQDAgWgMBMGA1Ud
JQQMMAoGCCsGAQUFBwMBMA0GCSqGSIb3DQEBBQUAA4IBAQBwAIj5SaBHaA5X31IP
CFCJiep96awfp7RANO0cuUj+ZpGoFn9d6FXY0g+Eg5wAkCNIzZU5NHN9xsdOpnUo
zIBbyTfQEPrge1CMWMvL6uGaoEXytq84VTitF/xBTky4KtTn6+es4/e7jr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VCzw8y9l7y7CEFjvUO3sq0pne9r7Z+XVgjGyBdBYkJS
0kcqPBXFCMHrWH5UlacYlM5cqgoVztOp2STGmR3XR7a34oueeA10QSP+jzeYvWA1
wTYA762uU2ReCdujfNbf8V1tZWAH36KldM3hhDNWeveAGxxj1h2R9T/k2kHl/a7D
I3VdS59vjJY=
-----END CERTIFICATE-----
38 changes: 25 additions & 13 deletions spec/integration/fixtures/server.key
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIICXQIBAAKBgQDRSU8Vqrqd51fXbCQJLqflml5zzSM3KQAN6jBmQyUybH2vA7u2
cUz9FySuZhE7bQa5+9dXCcQLj9yo6p1vUr7WfZWNrFyemY+trDeS8Bt1VXtuXSNv
MkdRLGx4yeWY3/bZoIDAumpudncbh27ef7x6OJ4CbihP1PnnhkYrzJ+oBQIDAQAB
AoGBAIf4CstW2ltQO7+XYGoex7Hh8s9lTSW/G2vu5Hbr1LTHy3fzAvdq8MvVR12O
rk9fa+lU9vhzPc0NMB0GIDZ9GcHuhW5hD1Wg9OSCbTOkZDoH3CAFqonjh4Qfwv5W
IPAFn9KHukdqGXkwEMdErsUaPTy9A1V/aROVEaAY+HJgq/eZAkEA/BP1QMV04WEZ
Oynzz7/lLizJGGxp2AOvEVtqMoycA/Qk+zdKP8ufE0wbmCE3Qd6GoynavsHb6aGK
gQobb8zDZwJBANSK6MrXlrZTtEaeZuyOB4mAmRzGzOUVkUyULUjEx2GDT93ujAma
qm/2d3E+wXAkNSeRpjUmlQXy/2oSqnGvYbMCQQDRM+cYyEcGPUVpWpnj0shrF/QU
9vSot/X1G775EMTyaw6+BtbyNxVgOIu2J+rqGbn3c+b85XqTXOPL0A2RLYkFAkAm
syhSDtE9X55aoWsCNZY/vi+i4rvaFoQ/WleogVQAeGVpdo7/DK9t9YWoFBIqth0L
mGSYFu9ZhvZkvQNV8eYrAkBJ+rOIaLDsmbrgkeDruH+B/9yrm4McDtQ/rgnOG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jzbcS8cf+1D55z
KuPazKAndyiuhIENk1gE+5RKdNyjYP2sI4+L5jexAoGBANxx2rw9GywHj9n/P006
pnO2Ol49nGsYiWp5E3bwZtIl+shf6GLgeRpWhj3TBnMhIlWnB/kpiiq8i0Tw7URo
9H+9IqRcNqTbX2ebeXjOCc+5DkLp4LQq83OmRsM1R+HTTtC4ipb9cucqpA1HOftp
z5isGq3ctdXaxP8YsLuPcw1RAoGAXZx0W70ryy2JAJidbd55Hiq17ktOHumOzO2x
Qw+Lt9Lz2NqlJnXxCruVC9miwUJ3hPl93/iN21hRk6GJ7qFxDcda7nz3C5LTCzZd
LR4fKfTTxBKGPb6QHpDpbmpRmZECHqZOjCzoVMyBCf2JST/VUbkWqKLso4uhIidb
yRCbSmECgYEAp+IuwpnMxVPxP52/xPFVcAxH2pDfmn5TJLJCNuKEUAS9ncZuz7rh
jJxtbC4AoGsS0+TdxnlMBvBpZE3QddQmjvey77yu/OvRUX2m/J/d+I2duTaHGR9Z
9VMxtlFY+DbDkJI2HVVxu5XfLKMJSEsMza8K64Ntx3XY3dJLCHrR1EY=
-----END RSA PRIVATE KEY-----
9 changes: 9 additions & 0 deletions spec/integration/http_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,15 @@
response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
end

it "works with ciphers" do
request = HTTPI::Request.new(@server.url)
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers

response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
end
end
end

Expand Down
9 changes: 9 additions & 0 deletions spec/integration/httpclient_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,15 @@
response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
end

it "works with ciphers" do
request = HTTPI::Request.new(@server.url)
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers

response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
end
end
end

Expand Down
14 changes: 13 additions & 1 deletion spec/integration/net_http_persistent_spec.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
require "spec_helper"
require "integration/support/server"
require "net/http/persistent"

describe HTTPI::Adapter::NetHTTP do
describe HTTPI::Adapter::NetHTTPPersistent do

subject(:adapter) { :net_http_persistent }

Expand Down Expand Up @@ -122,6 +123,17 @@
response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
end

it "works with ciphers" do
skip("Requires net-http-persistent 3.x") unless Net::HTTP::Persistent::VERSION.start_with? "3."

request = HTTPI::Request.new(@server.url)
request.auth.ssl.ca_cert_file = IntegrationServer.ssl_ca_file
request.auth.ssl.ciphers = OpenSSL::Cipher.ciphers

response = HTTPI.get(request, adapter)
expect(response.body).to eq("get")
end
end
end

Expand Down
Loading

0 comments on commit d3b9843

Please sign in to comment.