bunny 0.10.3 → 0.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog.md +10 -0
- data/lib/bunny/transport.rb +8 -4
- data/lib/bunny/version.rb +1 -1
- data/spec/higher_level_api/integration/tls_connection_spec.rb +42 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9c9bf09dd970ef5209cce72c05a7d73f82f4750
|
4
|
+
data.tar.gz: d658fe0aea0c6f3461b2f4d1c54db3b7d8c0f9a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 220ac2fd8093683bfdb6b6c614b8198a47a996295804bd677d3aebfa6001eb1e5dfd7ad63b359e98050fb285f680c0ba5867b9a7f88d2437487db81cc25e84c1
|
7
|
+
data.tar.gz: a59a8fce37f7807548223b15041d349f5ec8522342427277cebb2de729a0927fde4fb660e5b4ea869b3abd395610e5bc9d3844e126f4d8d7476ce260f0cbae1a
|
data/ChangeLog.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## Changes between Bunny 0.10.3 and 0.10.4
|
2
|
+
|
3
|
+
### Default Paths for TLS/SSL CA's on All OS'es
|
4
|
+
|
5
|
+
Bunny now uses OpenSSL to detect default TLS/SSL CA's paths, extending
|
6
|
+
this feature to OS'es other than Linux.
|
7
|
+
|
8
|
+
Contributed by Jingwen Owen Ou.
|
9
|
+
|
10
|
+
|
1
11
|
## Changes between Bunny 0.10.2 and 0.10.3
|
2
12
|
|
3
13
|
### Default Paths for TLS/SSL CA's on Linux
|
data/lib/bunny/transport.rb
CHANGED
@@ -41,11 +41,14 @@ module Bunny
|
|
41
41
|
@tls_certificate = opts[:tls_certificate] || opts[:ssl_cert_string]
|
42
42
|
@tls_key = opts[:tls_key] || opts[:ssl_key_string]
|
43
43
|
@tls_certificate_store = opts[:tls_certificate_store]
|
44
|
+
|
45
|
+
default_ca_file = ENV[OpenSSL::X509::DEFAULT_CERT_FILE_ENV] || OpenSSL::X509::DEFAULT_CERT_FILE
|
46
|
+
default_ca_path = ENV[OpenSSL::X509::DEFAULT_CERT_DIR_ENV] || OpenSSL::X509::DEFAULT_CERT_DIR
|
44
47
|
@tls_ca_certificates = opts.fetch(:tls_ca_certificates, [
|
45
|
-
|
46
|
-
'
|
47
|
-
'
|
48
|
-
'
|
48
|
+
default_ca_file,
|
49
|
+
File.join(default_ca_path, 'ca-certificates.crt'), # Ubuntu/Debian
|
50
|
+
File.join(default_ca_path, 'ca-bundle.crt'), # Amazon Linux & Fedora/RHEL
|
51
|
+
File.join(default_ca_path, 'ca-bundle.pem') # OpenSUSE
|
49
52
|
])
|
50
53
|
@verify_peer = opts[:verify_ssl] || opts[:verify_peer]
|
51
54
|
|
@@ -345,6 +348,7 @@ module Bunny
|
|
345
348
|
|
346
349
|
def initialize_tls_certificate_store(certs)
|
347
350
|
certs = certs.select { |path| File.readable? path }
|
351
|
+
@logger.debug "Using CA certificates at #{certs.join(', ')}"
|
348
352
|
if certs.empty?
|
349
353
|
@logger.error "No CA certificates found, add one with :tls_ca_certificates"
|
350
354
|
end
|
data/lib/bunny/version.rb
CHANGED
@@ -86,4 +86,46 @@ unless ENV["CI"]
|
|
86
86
|
ch.close
|
87
87
|
end
|
88
88
|
end
|
89
|
+
|
90
|
+
|
91
|
+
describe "TLS connection to RabbitMQ with a connection string" do
|
92
|
+
let(:connection) do
|
93
|
+
c = Bunny.new("amqps://bunny_gem:bunny_password@127.0.0.1/bunny_testbed",
|
94
|
+
:tls_cert => "spec/tls/client_cert.pem",
|
95
|
+
:tls_key => "spec/tls/client_key.pem",
|
96
|
+
:tls_ca_certificates => ["./spec/tls/cacert.pem"])
|
97
|
+
c.start
|
98
|
+
c
|
99
|
+
end
|
100
|
+
|
101
|
+
after :each do
|
102
|
+
connection.close
|
103
|
+
end
|
104
|
+
|
105
|
+
it "provides the same API as a regular connection" do
|
106
|
+
connection.should be_tls
|
107
|
+
ch = connection.create_channel
|
108
|
+
|
109
|
+
q = ch.queue("", :exclusive => true)
|
110
|
+
x = ch.default_exchange
|
111
|
+
|
112
|
+
x.publish("xyzzy", :routing_key => q.name).
|
113
|
+
publish("xyzzy", :routing_key => q.name).
|
114
|
+
publish("xyzzy", :routing_key => q.name).
|
115
|
+
publish("xyzzy", :routing_key => q.name)
|
116
|
+
|
117
|
+
sleep 0.5
|
118
|
+
q.message_count.should == 4
|
119
|
+
|
120
|
+
i = 0
|
121
|
+
q.subscribe do |delivery_info, _, payload|
|
122
|
+
i += 1
|
123
|
+
end
|
124
|
+
sleep 1.0
|
125
|
+
i.should == 4
|
126
|
+
q.message_count.should == 0
|
127
|
+
|
128
|
+
ch.close
|
129
|
+
end
|
130
|
+
end
|
89
131
|
end
|