Skip to content

Commit

Permalink
Traut is now v1.0.0, now with SSL capability.
Browse files Browse the repository at this point in the history
Traut is now able to perform SSL connections to an AMQP daemon, passing client
certificates back as needed. There's a slight UI change to accommodate this, but
otherwise little user-facing has changed. Example traut.conf is updated to
document SSL capability.

Signed-off-by: Brian L. Troutwine <brian@troutwine.us>
  • Loading branch information
blt committed Feb 11, 2012
1 parent 58ebf5b commit c93b332
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
6 changes: 4 additions & 2 deletions etc/traut.conf
@@ -1,11 +1,13 @@
amqp:
host: localhost
port: 5672
port: 5671
vhost: '/'
username: 'guest'
password: 'guest'
exchange: 'traut'
queue: ''
ssl:
private_key: /etc/rabbitmq/ca/client/key.pem
cert_chain: /etc/rabbitmq/ca/client/cert.pem

debug: true
logdir: './logs/'
Expand Down
3 changes: 2 additions & 1 deletion lib/traut.rb
Expand Up @@ -14,7 +14,8 @@ def self.defaults
{
'config' => './traut.conf',
'logdir' => './logs/',
'debug' => true
'debug' => true,
'ssl' => {}
}
end
end
Expand Down
15 changes: 13 additions & 2 deletions lib/traut/application.rb
Expand Up @@ -15,11 +15,22 @@ def run
@logger = Logger.new File.join( File.expand_path(@options['logdir']), 'traut.log')
@logger.level = boolean(@options['debug']) ? Logger::DEBUG : Logger::INFO

## NOTE: Have to start AMQP connection out here.
## We start the AMQP connection out here, rather than in Server, to
## isolate that code from its specific duties and so that we do not have
## to pass extranious configuration details into it.
amqp = @options['amqp']

AMQP.connect(:host => amqp['host'], :port => amqp['port'], :vhost => amqp['vhost'],
:username => amqp['username'], :password => amqp['password']) do |connection|
:username => amqp['username'], :password => amqp['password'], :ssl => {
:cert_chain_file => amqp['ssl']['cert_chain'],
:private_key_file => amqp['ssl']['private_key']
},
:on_tcp_connection_failure => Proc.new { |settings|
puts "TCP Connection failure; details:\n\n#{settings.inspect}\n\n"; exit 1
},
:on_possible_authentication_failure => Proc.new { |settings|
puts "Authentication failure, I'm afraid:\n\n#{settings.inspect}\n\n"; exit 1
}) do |connection|
@logger.info "Traut #{Traut::VERSION} started"
channel = AMQP::Channel.new(connection)
exchange = channel.topic(amqp['exchange'] || 'traut')
Expand Down
2 changes: 1 addition & 1 deletion lib/traut/version.rb
@@ -1,3 +1,3 @@
module Traut
VERSION = "0.2.4"
VERSION = "1.0.0"
end

0 comments on commit c93b332

Please sign in to comment.