Class: Synapse::Easy::Section::Http
- Defined in:
- lib/synapse/easy/section/http.rb
Instance Attribute Summary collapse
-
#ca_bases ⇒ Object
Returns the value of attribute ca_bases.
-
#certificates ⇒ Object
Returns the value of attribute certificates.
-
#ciphers ⇒ Object
Returns the value of attribute ciphers.
-
#crt_bases ⇒ Object
Returns the value of attribute crt_bases.
-
#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 36 37 38 39 |
# 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 ||= [] @crt_bases = params[:crt_bases] @crt_bases ||= [] @ca_bases = params[:ca_bases] @ca_bases ||= [] @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 = params[:secure_cookies] ||= true if .nil? and ssl @strict_security = params[:strict_security] @strict_security ||= true if @strict_security.nil? and ssl end |
Instance Attribute Details
#ca_bases ⇒ Object
Returns the value of attribute ca_bases.
7 8 9 |
# File 'lib/synapse/easy/section/http.rb', line 7 def ca_bases @ca_bases end |
#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 |
#crt_bases ⇒ Object
Returns the value of attribute crt_bases.
7 8 9 |
# File 'lib/synapse/easy/section/http.rb', line 7 def crt_bases @crt_bases 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 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
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/synapse/easy/section/http.rb', line 46 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 crt_bases.each do |crt_base| @complex_bind << "crt-base" @complex_bind << "#{crt_base}" end ca_bases.each do |ca_base| @complex_bind << "ca-base" @complex_bind << "#{ca_base}" end @complex_bind.compact.join(" ") end |
#section_options ⇒ Object
66 67 68 69 70 71 72 73 74 |
# File 'lib/synapse/easy/section/http.rb', line 66 def .reject{|o| o =~ /^bind/} + [ "bind #{complex_bind}", "mode #{mode}", "reqadd X-Forwarded-Proto:\\ #{protocol}", , strict_security ].compact end |