File tree 5 files changed +36
-18
lines changed
5 files changed +36
-18
lines changed Original file line number Diff line number Diff line change 3
3
# Registry for SASL authenticators used by Net::IMAP.
4
4
module Net ::IMAP ::Authenticators
5
5
6
- # Adds an authenticator for Net::IMAP#authenticate. +auth_type+ is the
6
+ # Adds an authenticator for use with Net::IMAP#authenticate. +auth_type+ is the
7
7
# {SASL mechanism}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml]
8
- # supported by +authenticator+ (for instance, "+LOGIN +"). The +authenticator+
8
+ # supported by +authenticator+ (for instance, "+PLAIN +"). The +authenticator+
9
9
# is an object which defines a +#process+ method to handle authentication with
10
- # the server. See Net::IMAP::LoginAuthenticator,
10
+ # the server. See Net::IMAP::PlainAuthenticator, Net::IMAP:: LoginAuthenticator,
11
11
# Net::IMAP::CramMD5Authenticator, and Net::IMAP::DigestMD5Authenticator for
12
12
# examples.
13
13
#
Original file line number Diff line number Diff line change 2
2
3
3
require "digest/md5"
4
4
5
- # Authenticator for the "+CRAM-MD5+" SASL mechanism. See
6
- # Net::IMAP#authenticate.
5
+ # Authenticator for the "+CRAM-MD5+" SASL mechanism, specified in
6
+ # RFC2195[https://tools.ietf.org/html/rfc2195]. See Net::IMAP#authenticate.
7
7
#
8
8
# == Deprecated
9
9
#
10
- # +CRAM-MD5+ should be considered obsolete and insecure. It is included for
11
- # backward compatibility with historic servers.
10
+ # +CRAM-MD5+ is obsolete and insecure. It is included for compatibility with
11
+ # existing servers.
12
12
# {draft-ietf-sasl-crammd5-to-historic}[https://tools.ietf.org/html/draft-ietf-sasl-crammd5-to-historic-00.html]
13
- # recommends using +SCRAM-*+ or +PLAIN+ protected by TLS instead. Additionally,
14
- # RFC8314[https://tools.ietf.org/html/rfc8314] discourage the use of cleartext
15
- # and recommends TLS version 1.2 or greater be used for all traffic.
13
+ # recommends using +SCRAM-*+ or +PLAIN+ protected by TLS instead.
14
+ #
15
+ # Additionally, RFC8314[https://tools.ietf.org/html/rfc8314] discourage the use
16
+ # of cleartext and recommends TLS version 1.2 or greater be used for all
17
+ # traffic. With TLS +CRAM-MD5+ is okay, but so is +PLAIN+
16
18
class Net ::IMAP ::CramMD5Authenticator
17
19
def process ( challenge )
18
20
digest = hmac_md5 ( challenge , @password )
Original file line number Diff line number Diff line change 3
3
require "digest/md5"
4
4
require "strscan"
5
5
6
- # Net::IMAP authenticator for the "`DIGEST-MD5`" SASL mechanism type. See
7
- # Net::IMAP#authenticate.
6
+ # Net::IMAP authenticator for the "`DIGEST-MD5`" SASL mechanism type, specified
7
+ # in RFC2831(https://tools.ietf.org/html/rfc2831). See Net::IMAP#authenticate.
8
8
#
9
9
# == Deprecated
10
10
#
11
11
# "+DIGEST-MD5+" has been deprecated by
12
- # {RFC6331}[https://tools.ietf.org/html/rfc6331] and should not be used. It
13
- # is included for backward compatibility with historic servers.
12
+ # {RFC6331}[https://tools.ietf.org/html/rfc6331] and should not be relied on for
13
+ # security. It is included for compatibility with existing servers.
14
14
class Net ::IMAP ::DigestMD5Authenticator
15
15
def process ( challenge )
16
16
case @stage
Original file line number Diff line number Diff line change 2
2
3
3
# Authenticator for the "+LOGIN+" SASL mechanism. See Net::IMAP#authenticate.
4
4
#
5
+ # +LOGIN+ authentication sends the password in cleartext.
6
+ # RFC3501[https://tools.ietf.org/html/rfc3501] encourages servers to disable
7
+ # cleartext authentication until after TLS has been negotiated.
8
+ # RFC8314[https://tools.ietf.org/html/rfc8314] recommends TLS version 1.2 or
9
+ # greater be used for all traffic, and deprecate cleartext access ASAP. +LOGIN+
10
+ # can be secured by TLS encryption.
11
+ #
5
12
# == Deprecated
6
13
#
7
14
# The {SASL mechanisms
8
15
# registry}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml]
9
- # marks "LOGIN" as obsoleted in favor of "PLAIN". See also
10
- # {draft-murchison-sasl-login}[https://www.iana.org/go/draft-murchison-sasl-login].
16
+ # marks "LOGIN" as obsoleted in favor of "PLAIN". It is included here for
17
+ # compatibility with existing servers. See
18
+ # {draft-murchison-sasl-login}[https://www.iana.org/go/draft-murchison-sasl-login]
19
+ # for both specification and deprecation.
11
20
class Net ::IMAP ::LoginAuthenticator
12
21
def process ( data )
13
22
case @state
Original file line number Diff line number Diff line change 1
1
# frozen_string_literal: true
2
2
3
- # Authenticator for the "+PLAIN+" SASL mechanism. See Net::IMAP#authenticate.
3
+ # Authenticator for the "+PLAIN+" SASL mechanism, specified in
4
+ # RFC4616[https://tools.ietf.org/html/rfc4616]. See Net::IMAP#authenticate.
4
5
#
5
- # See RFC4616[https://tools.ietf.org/html/rfc4616] for the specification.
6
+ # +PLAIN+ authentication sends the password in cleartext.
7
+ # RFC3501[https://tools.ietf.org/html/rfc3501] encourages servers to disable
8
+ # cleartext authentication until after TLS has been negotiated.
9
+ # RFC8314[https://tools.ietf.org/html/rfc8314] recommends TLS version 1.2 or
10
+ # greater be used for all traffic, and deprecate cleartext access ASAP. +PLAIN+
11
+ # can be secured by TLS encryption.
6
12
class Net ::IMAP ::PlainAuthenticator
7
13
8
14
def process ( data )
9
15
return "#@authzid \0 #@username \0 #@password "
10
16
end
11
17
18
+ # :nodoc:
12
19
NULL = -"\0 " . b
13
20
14
21
private
You can’t perform that action at this time.
0 commit comments