Created
January 28, 2019 20:53
-
-
Save ebirn/62d7c2cdc4104cae6d7932d145b83327 to your computer and use it in GitHub Desktop.
Error in fluentd-plugin-amqp when connecting to TLS rabbitmq
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bunny' | |
@rabbitmq_host = 'localhost' | |
# here the default for :tls value is false | |
def get_connection_options() | |
opts = { | |
hosts: [ @rabbitmq_host ], port: 5671, vhost: '/', | |
pass: 'guest', user: 'guest', ssl: true, | |
verify_ssl: true, heartbeat: 2, | |
tls: false, | |
tls_cert: nil, | |
tls_key: nil, | |
verify_peer: false | |
} | |
return opts | |
end | |
def works() | |
opts = { | |
hosts: [ @rabbitmq_host ], port: 5671, vhost: '/', | |
pass: 'guest', user: 'guest', ssl: true, | |
verify_ssl: true, heartbeat: 2, | |
tls: true, | |
tls_verify_peer: true | |
} | |
return opts | |
end | |
def without_tls() | |
opts = { | |
hosts: [ @rabbitmq_host ], port: 5671, vhost: '/', | |
pass: 'guest', user: 'guest', ssl: true, | |
verify_ssl: true, heartbeat: 2, | |
tls: nil | |
} | |
return opts | |
end | |
def test_connection(opts, descr) | |
begin | |
puts descr | |
bb = Bunny.new opts | |
bb.start | |
bb.heartbeat | |
puts 'connection success!' | |
rescue => exception | |
puts exception.backtrace | |
end | |
puts '===============================' | |
puts | |
end | |
test_connection get_connection_options, 'plugin connection attempt: fails' | |
test_connection works, 'working connection attempt' | |
test_connection without_tls, 'ssl without tls (or set to nil) works' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment