Module: Groat::SMTPD::Extensions::StartTLS
- Defined in:
- lib/groat/smtpd/extensions/starttls.rb
Class Method Summary collapse
Instance Method Summary collapse
- #reset_connection ⇒ Object
- #secure? ⇒ Boolean
- #set_ssl_context(ctx) ⇒ Object
- #show_starttls_keyword? ⇒ Boolean
- #smtp_verb_starttls(args) ⇒ Object
Class Method Details
.included(mod) ⇒ Object
27 28 29 30 31 |
# File 'lib/groat/smtpd/extensions/starttls.rb', line 27 def self.included mod puts "Included RFC 3207: STARTTLS" mod.ehlo_keyword :starttls, nil, :show_starttls_keyword? mod.verb :starttls, :smtp_verb_starttls end |
Instance Method Details
#reset_connection ⇒ Object
33 34 35 36 |
# File 'lib/groat/smtpd/extensions/starttls.rb', line 33 def reset_connection @secure = false super end |
#secure? ⇒ Boolean
46 47 48 |
# File 'lib/groat/smtpd/extensions/starttls.rb', line 46 def secure? @secure end |
#set_ssl_context(ctx) ⇒ Object
38 39 40 |
# File 'lib/groat/smtpd/extensions/starttls.rb', line 38 def set_ssl_context(ctx) @sslctx = ctx end |
#show_starttls_keyword? ⇒ Boolean
42 43 44 |
# File 'lib/groat/smtpd/extensions/starttls.rb', line 42 def show_starttls_keyword? not secure? end |
#smtp_verb_starttls(args) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/groat/smtpd/extensions/starttls.rb', line 50 def smtp_verb_starttls(args) check_command_group response_syntax_error unless args.empty? response_bad_sequence unless esmtp? # § 4.2 "A client MUST NOT attempt to start a TLS session if a TLS # session is already active" response_bad_sequence if secure? toclient "220 Ready to start TLS\r\n" ssl = OpenSSL::SSL::SSLSocket.new(@s, @sslctx) ssl.accept @s = ssl # http://www.imc.org/ietf-smtp/mail-archive/msg05452.html reset_connection @secure = true true end |