Permalink
Browse files

Support setting paths to SSL certificate and private key

* Fixes #33.
  • Loading branch information...
1 parent e7d407e commit 733d0d7b58b2c08e1bc72757b4d66690611bd5e8 @raws raws committed Mar 28, 2013
Showing with 11 additions and 2 deletions.
  1. +2 −0 README.md
  2. +7 −1 lib/hector/connection.rb
  3. +2 −1 lib/hector/server.rb
View
@@ -60,6 +60,8 @@ By default, the server will listen at 0.0.0.0 (any IP address) on port 6767 for
Hector.server_address = "111.222.333.444"
Hector.port = 9000
Hector.ssl_port = 9001
+ Hector.ssl_certificate_path = Hector.root.join("config/hector.crt")
+ Hector.ssl_certificate_key_path = Hector.root.join("config/hector.key")
You can connect Hector to an existing authentication scheme by again modifying `init.rb` in your server's directory:
View
@@ -79,7 +79,13 @@ def log_tag
class SSLConnection < Connection
def post_init
log(:info, "opened SSL connection")
- start_tls
+ start_tls(ssl_options)
end
+
+ private
+ def ssl_options
+ { :cert_chain_file => Hector.ssl_certificate_path.to_s,
+ :private_key_file => Hector.ssl_certificate_key_path.to_s }
+ end
end
end
View
@@ -1,6 +1,7 @@
module Hector
class << self
- attr_accessor :server_name, :address, :port, :ssl_port
+ attr_accessor :server_name, :address, :port, :ssl_port, :ssl_certificate_path,
+ :ssl_certificate_key_path
def start_server
EventMachine.start_server(@address, @port, Connection)

0 comments on commit 733d0d7

Please sign in to comment.