Class: Synapse::Easy::Section::Http
- Defined in:
- lib/synapse/easy/section/http.rb
Instance Attribute Summary collapse
-
#certificates ⇒ Object
Returns the value of attribute certificates.
-
#ciphers ⇒ Object
Returns the value of attribute ciphers.
-
#default_certificate ⇒ Object
Returns the value of attribute default_certificate.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#secure_cookies ⇒ Object
Returns the value of attribute secure_cookies.
-
#ssl ⇒ Object
Returns the value of attribute ssl.
-
#strict_security ⇒ Object
Returns the value of attribute strict_security.
Attributes inherited from Tcp
Attributes inherited from Base
#address, #mode, #name, #options, #port, #type
Instance Method Summary collapse
- #complex_bind ⇒ Object
-
#initialize(params = {}) ⇒ Http
constructor
A new instance of Http.
- #section_options ⇒ Object
Methods inherited from Base
#bind, #each, #label, #to_synapse
Constructor Details
#initialize(params = {}) ⇒ Http
Returns a new instance of Http.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/synapse/easy/section/http.rb', line 9 def initialize params={} super @mode = :http @protocol = params[:protocol] @protocol ||= :http @protocol = :http unless [:http, :https].include? @protocol.to_sym @ssl = not(params[:default_certificate].nil?) @ssl ||= false if ssl.nil? @default_certificate = params[:default_certificate] @default_certificate ||= "/etc/ssl/private/ssl-cert-snakeoil.key crt /etc/ssl/certs/ssl-cert-snakeoil.pem" if ssl @certificates = params[:certificates] @certificates ||= [] @ciphers = params[:ciphers] @ciphers ||= %W{ECDHE-ECDSA-AES256-GCM-SHA384 ECDHE-ECDSA-AES128-GCM-SHA256 ECDHE-ECDSA-AES256-SHA384 ECDHE-ECDSA-AES256-SHA ECDHE-RSA-AES256-SHA384 ECDHE-RSA-AES256-SHA DHE-RSA-AES256-SHA DHE-RSA-AES128-SHA DES-CBC3-SHA !NULL !aNULL !RC4 !RC2 !MEDIUM !LOW !EXPORT !DES !MD5 !PSK !3DES} if ssl @secure_cookies = params[:secure_cookies] @secure_cookies ||= true if @secure_cookies.nil? and ssl @strict_security = params[:strict_security] @strict_security ||= true if @strict_security.nil? and ssl end |
Instance Attribute Details
#certificates ⇒ Object
Returns the value of attribute certificates.
7 8 9 |
# File 'lib/synapse/easy/section/http.rb', line 7 def certificates @certificates end |
#ciphers ⇒ Object
Returns the value of attribute ciphers.
7 8 9 |
# File 'lib/synapse/easy/section/http.rb', line 7 def ciphers @ciphers end |
#default_certificate ⇒ Object
Returns the value of attribute default_certificate.
7 8 9 |
# File 'lib/synapse/easy/section/http.rb', line 7 def default_certificate @default_certificate end |
#protocol ⇒ Object
Returns the value of attribute protocol.
7 8 9 |
# File 'lib/synapse/easy/section/http.rb', line 7 def protocol @protocol end |
#secure_cookies ⇒ Object
Returns the value of attribute secure_cookies.
7 8 9 |
# File 'lib/synapse/easy/section/http.rb', line 7 def @secure_cookies end |
#ssl ⇒ Object
Returns the value of attribute ssl.
7 8 9 |
# File 'lib/synapse/easy/section/http.rb', line 7 def ssl @ssl end |
#strict_security ⇒ Object
Returns the value of attribute strict_security.
7 8 9 |
# File 'lib/synapse/easy/section/http.rb', line 7 def strict_security @strict_security end |
Instance Method Details
#complex_bind ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/synapse/easy/section/http.rb', line 42 def complex_bind @complex_bind = [] @complex_bind << bind @complex_bind << "ssl" if ssl @complex_bind << "crt" if ssl @complex_bind << "#{default_certificate}" certificates.each do |certificate| @complex_bind << "crt" @complex_bind << "#{certificate}" end @complex_bind.compact.join(" ") end |
#section_options ⇒ Object
54 55 56 57 58 59 60 61 62 |
# File 'lib/synapse/easy/section/http.rb', line 54 def @options.reject{|o| o =~ /^bind/} + [ "bind #{complex_bind}", "mode #{mode}", "reqadd X-Forwarded-Proto:\\ #{protocol}", , strict_security ].compact end |