rfc2595.Using TLS with IMAP, POP3 and ACAP
POP3协议详解

POP3协议详解一、介绍POP3(Post Office Protocol Version 3)是一种用于电子邮件收取的协议。
它允许用户从邮件服务器上下载邮件到本地计算机,并在下载后将邮件从服务器上删除。
本文将详细介绍POP3协议的工作原理、命令和响应格式、安全性以及常见应用场景。
二、工作原理1. 连接建立客户端与邮件服务器建立TCP连接,默认使用110端口。
2. 身份验证客户端发送用户名和密码进行身份验证,以便访问邮件服务器。
3. 邮件检索客户端发送RETR命令,请求下载指定邮件。
服务器返回邮件的内容。
4. 邮件删除客户端发送DELE命令,告知服务器删除指定邮件。
5. 退出连接客户端发送QUIT命令,结束会话并关闭连接。
三、命令和响应格式1. 命令格式客户端向服务器发送命令时,命令以大写字母表示,后跟一个或多个参数,参数之间以空格分隔。
2. 响应格式服务器对命令的响应以三位数字开头,后跟一个描述性的信息。
常见的响应码有:- +OK:成功响应- -ERR:错误响应四、安全性POP3协议在传输过程中不提供加密,因此容易受到中间人攻击。
为了提高安全性,可以使用以下方法:1. 使用SSL/TLS协议POP3协议可以通过启用SSL/TLS来实现加密通信,使用995端口。
2. 使用SASL身份验证引入SASL(Simple Authentication and Security Layer)机制,提供更安全的身份验证方式。
五、常见应用场景1. 个人电子邮件收取用户可以使用POP3协议将邮件从邮件服务器下载到本地计算机,以便离线查看和管理。
2. 邮件备份用户可以将邮件从服务器下载到本地计算机,以便进行备份和存档。
3. 移动设备同步用户可以使用POP3协议将邮件下载到移动设备,以便在无网络连接的情况下查看邮件。
4. 邮件过滤和分类用户可以使用POP3协议将邮件下载到本地计算机,然后使用邮件客户端进行过滤和分类。
imap 协议

imap 协议IMAP协议(Internet Message Access Protocol,互联网消息访问协议)是一种用于从邮件服务器接收电子邮件的通信协议。
IMAP协议允许用户在多台设备上同步和管理电子邮件,与POP3协议相比,IMAP协议具有更强大的功能和更灵活的操作方式。
IMAP协议最早于1986年由马克·克里斯坦森(Mark Crispin)开发,并在IMAP2发行的同一年提交到IETF(Internet Engineering Task Force)进行标准化。
随着互联网的发展,IMAP协议也经历了多个版本的更新,目前最常用的版本是IMAP4。
IMAP协议的基本工作原理是客户端应用程序通过网络连接到邮件服务器,然后在服务器上进行电子邮件的浏览、搜索、标记、删除等操作。
IMAP协议支持多种电子邮件客户端,例如Microsoft Outlook、Mozilla Thunderbird和Apple Mail等。
IMAP协议的核心特性之一是在服务端保留邮件的原始副本。
这意味着即使在客户端上删除了邮件,服务器上仍然可以保留一份副本。
这为用户提供了更高的灵活性,可以在不同设备上方便地访问和管理电子邮件。
IMAP协议还支持在邮件服务器上创建文件夹,用户可以将邮件归档到不同的文件夹中,以更好地组织和管理邮件。
IMAP协议还支持邮件服务器上的搜索功能。
用户可以根据发件人、主题、日期等条件进行搜索,并精确找到需要的邮件。
这对于管理大量邮件的用户来说非常有用。
IMAP协议提供了一些标记邮件的机制。
用户可以给邮件打上不同的标记,例如已读、已回复、已删除等。
这些标记信息存储在邮件服务器上,客户端应用程序可以根据标记信息来展示邮件列表和邮件状态。
IMAP协议还支持邮件的附件。
用户可以下载邮件附件到客户端,并进行查看和编辑。
IMAP协议还支持邮件的全文搜索功能,用户可以快速搜索和定位包含特定关键字的邮件。
POP3协议

介绍POP3协议的定义和作用POP3(Post Office Protocol version3)是一种用于电子邮件传输的协议。
它是互联网上最常用的电子邮件接收协议之一。
POP3协议允许用户从邮件服务器上下载电子邮件到本地计算机,以便离线阅读和管理邮件。
作用POP3协议的主要作用是提供一种标准化的方式,让用户通过邮件客户端应用程序(如Outlook、Thunderbird等)从邮件服务器上接收电子邮件。
以下是POP3协议的主要作用:1.接收邮件:用户可以使用POP3协议从邮件服务器上下载未读邮件到本地计算机,以便在没有网络连接的情况下阅读和处理邮件。
2.存储邮件:POP3允许用户选择在服务器上保留或删除已下载的邮件副本。
这样,用户可以自由地管理邮件,删除不需要的邮件,或者将重要的邮件保留在服务器上以备后续查看。
3.离线访问:由于POP3协议允许将邮件下载到本地计算机,用户可以在没有网络连接或者在移动设备上离线状态时,仍然能够阅读和处理邮件。
4.节省带宽:一旦邮件下载到本地计算机,用户可以在本地进行阅读和管理,而不需要频繁地与邮件服务器通信。
这样可以节省网络带宽的使用,尤其是对于使用低速或昂贵的网络连接的用户来说。
总的来说,POP3协议提供了一种方便、灵活和可靠的方式,让用户能够高效地接收和管理电子邮件。
无论是个人用户还是企业用户,都可以通过POP3协议来处理他们的邮件通信需求。
解释POP3协议的工作原理和基本流程POP3(Post Office Protocol version3)协议是一种客户端‑服务器协议,用于从邮件服务器上接收电子邮件。
下面是POP3协议的工作原理和基本流程:1.建立连接:邮件客户端应用程序与邮件服务器之间建立TCP连接。
通常,邮件服务器的标准端口是110。
一旦连接建立,客户端可以向服务器发送命令来获取邮件。
2.身份验证:客户端发送用户名和密码给服务器进行身份验证。
这些凭据用于确认用户的身份和权限,以便访问邮件。
imap rfc标准

Internet Message Access Protocol (IMAP) is an email retrieval protocol. It stores email messages on a mail server and enables the recipient to view and manipulate them as though they were stored locally on their device. IMAP was developed in the late 1980s and has since become one of the most widely used email retrieval protocols.The IMAP standard is defined in RFC 3501, which was published in 2003. This document provides a detailed description of the protocol's functionality, including its data formats, commands, and responses. The standard specifies how IMAP clients and servers should communicate with each other to enable the retrieval and manipulation of email messages.One of the key features of IMAP is its support for multiple clients accessing the same mailbox simultaneously. This is achieved through the use of a "shared" storage model, where all clients see the same set of messages and folders stored on the server. This allows users to access their email from different devices without having to worry about synchronizing their messages manually.Another important aspect of IMAP is its support for message organization and management. Clients can create, delete, and rename folders, as well as move messages between folders. They can also search for specific messages based on various criteria, such as sender, subject, or date.IMAP also provides a range of features for managing individual messages. Clients can mark messages as read or unread, flag them for follow-up, and even move them to a specific folder. They can also reply to messages, forward them to others, and generate replies or forwards with attachments.Overall, the IMAP standard provides a powerful and flexible framework for managing email messages. Its support for shared storage, message organization, and advanced message management features make it a popular choice for both personal and business email users.。
IMAP协议解析邮件服务器与客户端的高级通信协议详解

IMAP协议解析邮件服务器与客户端的高级通信协议详解IMAP(Internet Mail Access Protocol)是一种邮件服务器与客户端之间进行通信的高级协议。
它的主要功能是允许邮件客户端在服务器上直接管理和操作邮件,而无需将所有邮件下载到本地设备。
本文将详细解析IMAP协议的工作原理和功能。
一、IMAP协议的基本原理IMAP协议采用客户端-服务器的通信模型。
客户端连接到邮件服务器,通过IMAP协议与服务器进行通信和交互,完成对邮件的管理和操作。
客户端首先与邮件服务器建立连接,并进行身份验证。
验证通过后,客户端可以查看邮件服务器上的邮件列表,选择性地将邮件下载到本地设备,或者直接在服务器上进行邮件操作,如删除、移动、标记等。
客户端可以通过IMAP协议将邮件保留在服务器上,从而实现在不同设备上同步邮件的功能。
二、IMAP协议的功能1. 邮件的查看和搜索:通过IMAP协议,客户端可以获取邮件服务器上的邮件列表,并根据条件进行邮件的搜索。
客户端可以按发件人、主题、日期等条件对邮件进行过滤和查找,提高邮件检索的效率。
2. 邮件的管理和操作:IMAP协议允许客户端在邮件服务器上对邮件进行管理和操作。
客户端可以标记邮件为已读或未读状态,将邮件移到指定文件夹,删除不需要的邮件等。
这些操作都会反映在服务器上,保证邮件在不同设备上的一致性。
3. 文件夹的管理:IMAP协议支持客户端对邮件服务器上的文件夹进行管理。
客户端可以创建、重命名、删除文件夹,从而更好地组织和管理邮件。
4. 邮件状态的同步:IMAP协议可以保持客户端与服务器上邮件状态的同步。
当在一个设备上读取或删除邮件时,其他设备上的客户端也会同步更新邮件的状态,确保用户在不同设备上的邮件体验一致。
5. 多设备的消息同步:IMAP协议支持多设备之间的消息同步。
当用户在一个设备上发送邮件或进行其他操作时,其他设备上的客户端也会同步更新,确保用户在不同设备上的邮件操作保持一致。
邮件协议分析(POP3IMAPSTMP

邮件协议分析(POP3IMAPSTMP邮件协议是用于在网络上传输和接收电子邮件的一系列规范和技术。
在互联网上,最常用的邮件协议是POP3、IMAP和SMTP。
本文将对这三种协议进行详细分析。
2. IMAP(Internet Message Access Protocol)也是一种邮件接收协议,但与POP3不同的是,IMAP在用户设备和邮件服务器之间建立了一个持久连接,可以保留邮件服务器上的副本。
这意味着用户可以在多个设备上访问和管理同一封电子邮件。
IMAP协议允许用户在不同设备间同步邮件的状态和文件夹结构,例如标记已读、删除或移动邮件。
由于IMAP保留了邮件服务器上的邮件副本,它适用于那些需要在多个设备上访问邮件的用户,例如在办公室和家中使用不同设备的用户。
3. SMTP(Simple Mail Transfer Protocol)是一种邮件传输协议,用于将邮件从发件人的邮件服务器发送到收件人的邮件服务器。
SMTP协议定义了邮件的传输规范,包括邮件的标头和正文格式,以及如何与接收邮件服务器进行通信。
SMTP协议是一种客户端-服务器协议,发件人的邮件客户端通过与发件人的邮件服务器建立连接来发送邮件,邮件服务器之间通过互联网进行邮件的传输。
SMTP协议通常与POP3或IMAP结合使用,以完成邮件的发送和接收。
总结起来,POP3、IMAP和SMTP是互联网上常用的三种邮件协议。
POP3适用于在单个设备上接收邮件的用户,IMAP适用于在多个设备上接收和管理邮件的用户,而SMTP用于发送邮件。
这三种协议各有优势和适用场景,用户可以根据自己的需求选择适合的协议来管理和传输邮件。
imap协议的原理

imap协议的原理IMAP(Internet Message Access Protocol)是一种用于电子邮件客户端与邮件服务器之间进行通信的协议。
它的原理主要包括连接建立、身份验证、邮件查询和管理等几个关键步骤。
首先,连接建立是IMAP协议的第一步。
客户端通过向邮件服务器的标准IMAP端口(通常是143)发送连接请求来建立与服务器的连接。
服务器接收到连接请求后,返回一个欢迎消息以及协议版本号,客户端则发送对应的协议版本号进行确认。
接下来是身份验证。
在成功建立连接后,客户端需要提供用户名和密码来验证自己的身份。
这一步骤的目的是防止未经授权的访问邮件服务器。
常用的身份验证方式包括基本验证(使用明文传输的用户名和密码)、登录验证(使用加密的用户名和密码)以及其他安全性更高的验证方式(如使用密钥对进行身份验证)。
身份验证通过后,客户端可以开始发送邮件查询请求。
用户可以通过不同的邮件查询命令来获取邮件的相关信息,如获取邮件列表、查看特定邮件的内容、搜索邮件等。
IMAP协议支持灵活的邮件查询语法,使用户可以根据各种条件进行邮件查询。
另外,IMAP协议还支持邮件管理功能。
用户可以通过IMAP协议对邮件进行标记、删除、移动等操作。
这些操作会在邮件服务器上进行,从而保留与邮件相关的元数据。
这意味着,用户可以在不同的设备上使用IMAP客户端,同时保持邮件的状态一致。
IMAP协议的原理是基于客户端-服务器模型的。
客户端向服务器发送请求,服务器相应地提供相应的响应。
客户端和服务器之间的通信是基于IMAP命令和响应的。
IMAP命令包括连接命令、认证命令、邮件查询命令、邮件管理命令等;而响应则包括状态响应、邮件列表响应、邮件内容响应等。
IMAP协议的特点之一是它的灵活性。
IMAP协议允许邮件在服务器上保留多个副本,这意味着用户可以从不同的设备上访问邮件,而不会影响其他设备上的邮件。
此外,IMAP协议还支持在邮件服务器上创建文件夹以组织邮件,并可以通过邮件管理命令对邮件进行快速搜索、筛选和归档操作。
imap协议

imap协议IMAP(Internet Mail Access Protocol)是Internet上的一种获取邮件的标准协议,用于从邮件服务器上获取邮件。
IMAP协议是目前应用最广泛的电子邮件客户端和邮件服务器之间的通讯协议之一。
IMAP协议是基于标准的TCP/IP协议,使用TCP端口143进行通信。
IMAP协议的核心功能是支持用户在任何地方用电子邮件客户端访问邮箱,只要有网络就可以进行访问。
IMAP协议支持在服务器端维护邮件,因此在客户端读取邮件时,只需要下载所需的邮件,而不是下载所有的邮件。
IMAP协议在传输邮件方面有很多优势,其中包括:1. 多平台支持:IMAP协议是基于网络的,支持Windows、Mac、Linux等所有平台。
2. 多终端统一管理:IMAP协议允许用户在多个设备上同步管理邮件,不会出现邮件被删除或丢失的情况。
3. 自由组织邮件:IMAP协议允许用户在服务器上创建文件夹,自由组织邮件,方便管理和查找邮件。
4. 离线查看:IMAP协议支持离线查看邮件,即使没有网络也可以查看已下载的邮件。
5. 邮件备份:IMAP协议支持把邮件存储在服务器上,可以进行邮件备份和恢复。
IMAP协议也有一些缺点,其中包括:1. 速度慢:IMAP协议需要与服务器进行交互,因此对于大量邮件的用户来说,获取邮件的速度会比较慢。
2. 邮件服务器存储限制:IMAP协议需要将邮件存储在服务器上,因此需要考虑邮件服务器存储容量的限制。
3. 邮件服务器性能问题:IMAP协议需要处理大量的邮件请求,因此需要考虑邮件服务器的性能。
总体来说,IMAP协议在网络环境下的优势非常明显,能够极大地提高邮件的管理效率以及工作效率。
如今,IMAP协议已经成为互联网上最流行的邮箱协议之一,被广泛应用于多种邮件客户端,包括Outlook、Thunderbird等。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Network Working Group C. Newman Request for Comments: 2595 Innosoft Category: Standards Track June 1999Using TLS with IMAP, POP3 and ACAPStatus of this MemoThis document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions forimprovements. Please refer to the current edition of the "InternetOfficial Protocol Standards" (STD 1) for the standardization stateand status of this protocol. Distribution of this memo is unlimited. Copyright NoticeCopyright (C) The Internet Society (1999). All Rights Reserved.1. MotivationThe TLS protocol (formerly known as SSL) provides a way to secure an application protocol from tampering and eavesdropping. The option of using such security is desirable for IMAP, POP and ACAP due to common connection eavesdropping and hijacking attacks [AUTH]. Althoughadvanced SASL authentication mechanisms can provide a lightweightversion of this service, TLS is complimentary to simpleauthentication-only SASL mechanisms or deployed clear-text passwordlogin commands.Many sites have a high investment in authentication infrastructure(e.g., a large database of a one-way-function applied to userpasswords), so a privacy layer which is not tightly bound to userauthentication can protect against network eavesdropping attackswithout requiring a new authentication infrastructure and/or forcing all users to change their password. Recognizing that such sites will desire simple password authentication in combination with TLSencryption, this specification defines the PLAIN SASL mechanism foruse with protocols which lack a simple password authenticationcommand such as ACAP and SMTP. (Note there is a separate RFC for the STARTTLS command in SMTP [SMTPTLS].)There is a strong desire in the IETF to eliminate the transmission of clear-text passwords over unencrypted channels. While SASL can beused for this purpose, TLS provides an additional tool with different deployability characteristics. A server supporting both TLS with Newman Standards Track [Page 1]simple passwords and a challenge/response SASL mechanism is likely to interoperate with a wide variety of clients without resorting tounencrypted clear-text passwords.The STARTTLS command rectifies a number of the problems with using a separate port for a "secure" protocol variant. Some of these arementioned in section 7.1.1. Conventions Used in this DocumentThe key words "REQUIRED", "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", "MAY", and "OPTIONAL" in this document are to be interpreted asdescribed in "Key words for use in RFCs to Indicate RequirementLevels" [KEYWORDS].Terms related to authentication are defined in "On InternetAuthentication" [AUTH].Formal syntax is defined using ABNF [ABNF].In examples, "C:" and "S:" indicate lines sent by the client andserver respectively.2. Basic Interoperability and Security RequirementsThe following requirements apply to all implementations of theSTARTTLS extension for IMAP, POP3 and ACAP.2.1. Cipher Suite RequirementsImplementation of the TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA [TLS] cipher suite is REQUIRED. This is important as it assures that any twocompliant implementations can be configured to interoperate.All other cipher suites are OPTIONAL.2.2. Privacy Operational Mode Security RequirementsBoth clients and servers SHOULD have a privacy operational mode which refuses authentication unless successful activation of an encryption layer (such as that provided by TLS) occurs prior to or at the timeof authentication and which will terminate the connection if thatencryption layer is deactivated. Implementations are encouraged tohave flexability with respect to the minimal encryption strength orcipher suites permitted. A minimalist approach to thisrecommendation would be an operational mode where theTLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA cipher suite is mandatory prior to permitting authentication.Newman Standards Track [Page 2]Clients MAY have an operational mode which uses encryption only when it is advertised by the server, but authentication continuesregardless. For backwards compatibility, servers SHOULD have anoperational mode where only the authentication mechanisms required by the relevant base protocol specification are needed to successfullyauthenticate.2.3. Clear-Text Password RequirementsClients and servers which implement STARTTLS MUST be configurable to refuse all clear-text login commands or mechanisms (including bothstandards-track and nonstandard mechanisms) unless an encryptionlayer of adequate strength is active. Servers which allowunencrypted clear-text logins SHOULD be configurable to refuseclear-text logins both for the entire server, and on a per-userbasis.2.4. Server Identity CheckDuring the TLS negotiation, the client MUST check its understandingof the server hostname against the server’s identity as presented in the server Certificate message, in order to prevent man-in-the-middle attacks. Matching is performed according to these rules:- The client MUST use the server hostname it used to open theconnection as the value to compare against the server name asexpressed in the server certificate. The client MUST NOT use anyform of the server hostname derived from an insecure remote source (e.g., insecure DNS lookup). CNAME canonicalization is not done.- If a subjectAltName extension of type dNSName is present in thecertificate, it SHOULD be used as the source of the server’sidentity.- Matching is case-insensitive.- A "*" wildcard character MAY be used as the left-most namecomponent in the certificate. For example, * wouldmatch , , etc. but would not match.- If the certificate contains multiple names (e.g. more than onedNSName field), then a match with any one of the fields isconsidered acceptable.If the match fails, the client SHOULD either ask for explicit userconfirmation, or terminate the connection and indicate the server’sidentity is suspect.Newman Standards Track [Page 3]2.5. TLS Security Policy CheckBoth the client and server MUST check the result of the STARTTLScommand and subsequent TLS negotiation to see whether acceptableauthentication or privacy was achieved. Ignoring this stepcompletely invalidates using TLS for security. The decision aboutwhether acceptable authentication or privacy was achieved is madelocally, is implementation-dependent, and is beyond the scope of this document.3. IMAP STARTTLS extensionWhen the TLS extension is present in IMAP, "STARTTLS" is listed as a capability in response to the CAPABILITY command. This extensionadds a single command, "STARTTLS" to the IMAP protocol which is used to begin a TLS negotiation.3.1. STARTTLS CommandArguments: noneResponses: no specific responses for this commandResult: OK - begin TLS negotiationBAD - command unknown or arguments invalidA TLS negotiation begins immediately after the CRLF at the end of the tagged OK response from the server. Once a client issues aSTARTTLS command, it MUST NOT issue further commands until aserver response is seen and the TLS negotiation is complete.The STARTTLS command is only valid in non-authenticated state.The server remains in non-authenticated state, even if clientcredentials are supplied during the TLS negotiation. The SASL[SASL] EXTERNAL mechanism MAY be used to authenticate once TLSclient credentials are successfully exchanged, but serverssupporting the STARTTLS command are not required to support theEXTERNAL mechanism.Once TLS has been started, the client MUST discard cachedinformation about server capabilities and SHOULD re-issue theCAPABILITY command. This is necessary to protect againstman-in-the-middle attacks which alter the capabilities list prior to STARTTLS. The server MAY advertise different capabilitiesafter STARTTLS.The formal syntax for IMAP is amended as follows:Newman Standards Track [Page 4]command_any =/ "STARTTLS"Example: C: a001 CAPABILITYS: * CAPABILITY IMAP4rev1 STARTTLS LOGINDISABLEDS: a001 OK CAPABILITY completedC: a002 STARTTLSS: a002 OK Begin TLS negotiation now<TLS negotiation, further commands are under TLS layer>C: a003 CAPABILITYS: * CAPABILITY IMAP4rev1 AUTH=EXTERNALS: a003 OK CAPABILITY completedC: a004 LOGIN joe passwordS: a004 OK LOGIN completed3.2. IMAP LOGINDISABLED capabilityThe current IMAP protocol specification (RFC 2060) requires theimplementation of the LOGIN command which uses clear-text passwords. Many sites may choose to disable this command unless encryption isactive for security reasons. An IMAP server MAY advertise that theLOGIN command is disabled by including the LOGINDISABLED capabilityin the capability response. Such a server will respond with a tagged "NO" response to any attempt to use the LOGIN command.An IMAP server which implements STARTTLS MUST implement support forthe LOGINDISABLED capability on unencrypted connections.An IMAP client which complies with this specification MUST NOT issue the LOGIN command if this capability is present.This capability is useful to prevent clients compliant with thisspecification from sending an unencrypted password in an environment subject to passive attacks. It has no impact on an environmentsubject to active attacks as a man-in-the-middle attacker can remove this capability. Therefore this does not relieve clients of the need to follow the privacy mode recommendation in section 2.2.Servers advertising this capability will fail to interoperate withmany existing compliant IMAP clients and will be unable to preventthose clients from disclosing the user’s password.4. POP3 STARTTLS extensionThe POP3 STARTTLS extension adds the STLS command to POP3 servers.If this is implemented, the POP3 extension mechanism [POP3EXT] MUSTalso be implemented to avoid the need for client probing of multiple commands. The capability name "STLS" indicates this command ispresent and permitted in the current state.Newman Standards Track [Page 5]STLSArguments: noneRestrictions:Only permitted in AUTHORIZATION state.Discussion:A TLS negotiation begins immediately after the CRLF at the end of the +OK response from the server. A -ERR responseMAY result if a security layer is already active. Once aclient issues a STLS command, it MUST NOT issue furthercommands until a server response is seen and the TLSnegotiation is complete.The STLS command is only permitted in AUTHORIZATION stateand the server remains in AUTHORIZATION state, even ifclient credentials are supplied during the TLS negotiation. The AUTH command [POP-AUTH] with the EXTERNAL mechanism[SASL] MAY be used to authenticate once TLS clientcredentials are successfully exchanged, but serverssupporting the STLS command are not required to support the EXTERNAL mechanism.Once TLS has been started, the client MUST discard cachedinformation about server capabilities and SHOULD re-issuethe CAPA command. This is necessary to protect againstman-in-the-middle attacks which alter the capabilities list prior to STLS. The server MAY advertise differentcapabilities after STLS.Possible Responses:+OK -ERRExamples:C: STLSS: +OK Begin TLS negotiation<TLS negotiation, further commands are under TLS layer>...C: STLSS: -ERR Command not permitted when TLS activeNewman Standards Track [Page 6]5. ACAP STARTTLS extensionWhen the TLS extension is present in ACAP, "STARTTLS" is listed as a capability in the ACAP greeting. No arguments to this capability are defined at this time. This extension adds a single command,"STARTTLS" to the ACAP protocol which is used to begin a TLSnegotiation.5.1. STARTTLS CommandArguments: noneResponses: no specific responses for this commandResult: OK - begin TLS negotiationBAD - command unknown or arguments invalidA TLS negotiation begins immediately after the CRLF at the end of the tagged OK response from the server. Once a client issues aSTARTTLS command, it MUST NOT issue further commands until aserver response is seen and the TLS negotiation is complete.The STARTTLS command is only valid in non-authenticated state.The server remains in non-authenticated state, even if clientcredentials are supplied during the TLS negotiation. The SASL[SASL] EXTERNAL mechanism MAY be used to authenticate once TLSclient credentials are successfully exchanged, but serverssupporting the STARTTLS command are not required to support theEXTERNAL mechanism.After the TLS layer is established, the server MUST re-issue anuntagged ACAP greeting. This is necessary to protect againstman-in-the-middle attacks which alter the capabilities list prior to STARTTLS. The client MUST discard cached capabilityinformation and replace it with the information from the new ACAP greeting. The server MAY advertise different capabilities afterSTARTTLS.The formal syntax for ACAP is amended as follows:command_any =/ "STARTTLS"Example: S: * ACAP (SASL "CRAM-MD5") (STARTTLS)C: a002 STARTTLSS: a002 OK "Begin TLS negotiation now"<TLS negotiation, further commands are under TLS layer>S: * ACAP (SASL "CRAM-MD5" "PLAIN" "EXTERNAL")Newman Standards Track [Page 7]6. PLAIN SASL mechanismClear-text passwords are simple, interoperate with almost allexisting operating system authentication databases, and are usefulfor a smooth transition to a more secure password-basedauthentication mechanism. The drawback is that they are unacceptable for use over an unencrypted network connection.This defines the "PLAIN" SASL mechanism for use with ACAP and otherprotocols with no clear-text login command. The PLAIN SASL mechanism MUST NOT be advertised or used unless a strong encryption layer (such as the provided by TLS) is active or backwards compatibility dictates otherwise.The mechanism consists of a single message from the client to theserver. The client sends the authorization identity (identity tologin as), followed by a US-ASCII NUL character, followed by theauthentication identity (identity whose password will be used),followed by a US-ASCII NUL character, followed by the clear-textpassword. The client may leave the authorization identity empty toindicate that it is the same as the authentication identity.The server will verify the authentication identity and password with the system authentication database and verify that the authentication credentials permit the client to login as the authorization identity. If both steps succeed, the user is logged in.The server MAY also use the password to initialize any newauthentication database, such as one suitable for CRAM-MD5[CRAM-MD5].Non-US-ASCII characters are permitted as long as they are represented in UTF-8 [UTF-8]. Use of non-visible characters or characters which a user may be unable to enter on some keyboards is discouraged.The formal grammar for the client message using Augmented BNF [ABNF] follows.message = [authorize-id] NUL authenticate-id NUL passwordauthenticate-id = 1*UTF8-SAFE ; MUST accept up to 255 octetsauthorize-id = 1*UTF8-SAFE ; MUST accept up to 255 octetspassword = 1*UTF8-SAFE ; MUST accept up to 255 octetsNUL = %x00UTF8-SAFE = %x01-09 / %x0B-0C / %x0E-7F / UTF8-2 /UTF8-3 / UTF8-4 / UTF8-5 / UTF8-6UTF8-1 = %x80-BFUTF8-2 = %xC0-DF UTF8-1UTF8-3 = %xE0-EF 2UTF8-1Newman Standards Track [Page 8]UTF8-4 = %xF0-F7 3UTF8-1UTF8-5 = %xF8-FB 4UTF8-1UTF8-6 = %xFC-FD 5UTF8-1Here is an example of how this might be used to initialize a CRAM-MD5 authentication database for ACAP:Example: S: * ACAP (SASL "CRAM-MD5") (STARTTLS)C: a001 AUTHENTICATE "CRAM-MD5"S: + "<1896.697170952@>"C: "tim b913a602c7eda7a495b4e6e7334d3890"S: a001 NO (TRANSITION-NEEDED)"Please change your password, or use TLS to login"C: a002 STARTTLSS: a002 OK "Begin TLS negotiation now"<TLS negotiation, further commands are under TLS layer>S: * ACAP (SASL "CRAM-MD5" "PLAIN" "EXTERNAL")C: a003 AUTHENTICATE "PLAIN" {21+}C: <NUL>tim<NUL>tanstaaftanstaafS: a003 OK CRAM-MD5 password initializedNote: In this example, <NUL> represents a single ASCII NUL octet.7. imaps and pop3s portsSeparate "imaps" and "pop3s" ports were registered for use with SSL. Use of these ports is discouraged in favor of the STARTTLS or STLScommands.A number of problems have been observed with separate ports for"secure" variants of protocols. This is an attempt to enumerate some of those problems.- Separate ports lead to a separate URL scheme which intrudes intothe user interface in inappropriate ways. For example, many webpages use language like "click here if your browser supports SSL." This is a decision the browser is often more capable of making than the user.- Separate ports imply a model of either "secure" or "not secure."This can be misleading in a number of ways. First, the "secure"port may not in fact be acceptably secure as an export-crippledcipher suite might be in use. This can mislead users into a false sense of security. Second, the normal port might in fact besecured by using a SASL mechanism which includes a security layer. Thus the separate port distinction makes the complex topic ofsecurity policy even more confusing. One common result of thisconfusion is that firewall administrators are often misled into Newman Standards Track [Page 9]permitting the "secure" port and blocking the standard port. This could be a poor choice given the common use of SSL with a 40-bitkey encryption layer and plain-text password authentication is less secure than strong SASL mechanisms such as GSSAPI with Kerberos 5. - Use of separate ports for SSL has caused clients to implement only two security policies: use SSL or don’t use SSL. The desirablesecurity policy "use TLS when available" would be cumbersome withthe separate port model, but is simple with STARTTLS.- Port numbers are a limited resource. While they are not yet inshort supply, it is unwise to set a precedent that could double (or worse) the speed of their consumption.8. IANA ConsiderationsThis constitutes registration of the "STARTTLS" and "LOGINDISABLED"IMAP capabilities as required by section 7.2.1 of RFC 2060 [IMAP].The registration for the POP3 "STLS" capability follows:CAPA tag: STLSArguments: noneAdded commands: STLSStandard commands affected: May enable USER/PASS as a side-effect.CAPA command SHOULD be re-issued after successful completion.Announced states/Valid states: AUTHORIZATION state only.Specification reference: this memoThe registration for the ACAP "STARTTLS" capability follows:Capability name: STARTTLSCapability keyword: STARTTLSCapability arguments: nonePublished Specification(s): this memoPerson and email address for further information:see author’s address section belowThe registration for the PLAIN SASL mechanism follows:SASL mechanism name: PLAINSecurity Considerations: See section 9 of this memoPublished specification: this memoPerson & email address to contact for further information:see author’s address section belowIntended usage: COMMONAuthor/Change controller: see author’s address section below Newman Standards Track [Page 10]9. Security ConsiderationsTLS only provides protection for data sent over a network connection. Messages transferred over IMAP or POP3 are still available to server administrators and usually subject to eavesdropping, tampering andforgery when transmitted through SMTP or NNTP. TLS is no substitute for an end-to-end message security mechanism using MIME securitymultiparts [MIME-SEC].A man-in-the-middle attacker can remove STARTTLS from the capability list or generate a failure response to the STARTTLS command. Inorder to detect such an attack, clients SHOULD warn the user whensession privacy is not active and/or be configurable to refuse toproceed without an acceptable level of security.A man-in-the-middle attacker can always cause a down-negotiation tothe weakest authentication mechanism or cipher suite available. For this reason, implementations SHOULD be configurable to refuse weakmechanisms or cipher suites.Any protocol interactions prior to the TLS handshake are performed in the clear and can be modified by a man-in-the-middle attacker. Forthis reason, clients MUST discard cached information about servercapabilities advertised prior to the start of the TLS handshake.Clients are encouraged to clearly indicate when the level ofencryption active is known to be vulnerable to attack using modernhardware (such as encryption keys with 56 bits of entropy or less).The LOGINDISABLED IMAP capability (discussed in section 3.2) onlyreduces the potential for passive attacks, it provides no protection against active attacks. The responsibility remains with the clientto avoid sending a password over a vulnerable channel.The PLAIN mechanism relies on the TLS encryption layer for security. When used without TLS, it is vulnerable to a common networkeavesdropping attack. Therefore PLAIN MUST NOT be advertised or used unless a suitable TLS encryption layer is active or backwardscompatibility dictates otherwise.When the PLAIN mechanism is used, the server gains the ability toimpersonate the user to all services with the same passwordregardless of any encryption provided by TLS or other network privacy mechanisms. While many other authentication mechanisms have similar weaknesses, stronger SASL mechanisms such as Kerberos address thisissue. Clients are encouraged to have an operational mode where all mechanisms which are likely to reveal the user’s password to theserver are disabled.Newman Standards Track [Page 11]The security considerations for TLS apply to STARTTLS and thesecurity considerations for SASL apply to the PLAIN mechanism.Additional security requirements are discussed in section 2.10. References[ABNF] Crocker, D. and P. Overell, "Augmented BNF for SyntaxSpecifications: ABNF", RFC 2234, November 1997.[ACAP] Newman, C. and J. Myers, "ACAP -- ApplicationConfiguration Access Protocol", RFC 2244, November 1997.[AUTH] Haller, N. and R. Atkinson, "On Internet Authentication", RFC 1704, October 1994.[CRAM-MD5] Klensin, J., Catoe, R. and P. Krumviede, "IMAP/POPAUTHorize Extension for Simple Challenge/Response", RFC2195, September 1997.[IMAP] Crispin, M., "Internet Message Access Protocol - Version4rev1", RFC 2060, December 1996.[KEYWORDS] Bradner, S., "Key words for use in RFCs to IndicateRequirement Levels", BCP 14, RFC 2119, March 1997.[MIME-SEC] Galvin, J., Murphy, S., Crocker, S. and N. Freed,"Security Multiparts for MIME: Multipart/Signed andMultipart/Encrypted", RFC 1847, October 1995.[POP3] Myers, J. and M. Rose, "Post Office Protocol - Version 3", STD 53, RFC 1939, May 1996.[POP3EXT] Gellens, R., Newman, C. and L. Lundblade, "POP3 Extension Mechanism", RFC 2449, November 1998.[POP-AUTH] Myers, J., "POP3 AUTHentication command", RFC 1734,December 1994.[SASL] Myers, J., "Simple Authentication and Security Layer(SASL)", RFC 2222, October 1997.[SMTPTLS] Hoffman, P., "SMTP Service Extension for Secure SMTP over TLS", RFC 2487, January 1999.[TLS] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0",RFC 2246, January 1999.Newman Standards Track [Page 12][UTF-8] Yergeau, F., "UTF-8, a transformation format of ISO10646", RFC 2279, January 1998.11. Author’s AddressChris NewmanInnosoft International, Inc.1050 Lakes DriveWest Covina, CA 91790 USAEMail: chris.newman@A. Appendix -- Compliance ChecklistAn implementation is not compliant if it fails to satisfy one or more of the MUST requirements for the protocols it implements. Animplementation that satisfies all the MUST and all the SHOULDrequirements for its protocols is said to be "unconditionallycompliant"; one that satisfies all the MUST requirements but not all the SHOULD requirements for its protocols is said to be"conditionally compliant".Rules Section----- -------Mandatory-to-implement Cipher Suite 2.1SHOULD have mode where encryption required 2.2server SHOULD have mode where TLS not required 2.2MUST be configurable to refuse all clear-text logincommands or mechanisms 2.3server SHOULD be configurable to refuse clear-textlogin commands on entire server and on per-user basis 2.3client MUST check server identity 2.4client MUST use hostname used to open connection 2.4client MUST NOT use hostname from insecure remote lookup 2.4client SHOULD support subjectAltName of dNSName type 2.4client SHOULD ask for confirmation or terminate on fail 2.4MUST check result of STARTTLS for acceptable privacy 2.5client MUST NOT issue commands after STARTTLSuntil server response and negotiation done 3.1,4,5.1client MUST discard cached information 3.1,4,5.1,9client SHOULD re-issue CAPABILITY/CAPA command 3.1,4IMAP server with STARTTLS MUST implement LOGINDISABLED 3.2IMAP client MUST NOT issue LOGIN if LOGINDISABLED 3.2POP server MUST implement POP3 extensions 4ACAP server MUST re-issue ACAP greeting 5.1Newman Standards Track [Page 13]client SHOULD warn when session privacy not active and/orrefuse to proceed without acceptable security level 9SHOULD be configurable to refuse weak mechanisms orcipher suites 9The PLAIN mechanism is an optional part of this specification.However if it is implemented the following rules apply:Rules Section----- -------MUST NOT use PLAIN unless strong encryption activeor backwards compatibility dictates otherwise 6,9MUST use UTF-8 encoding for characters in PLAIN 6Newman Standards Track [Page 14]Full Copyright StatementCopyright (C) The Internet Society (1999). All Rights Reserved.This document and translations of it may be copied and furnished toothers, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, publishedand distributed, in whole or in part, without restriction of anykind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, thisdocument itself may not be modified in any way, such as by removingthe copyright notice or references to the Internet Society or otherInternet organizations, except as needed for the purpose ofdeveloping Internet standards in which case the procedures forcopyrights defined in the Internet Standards process must befollowed, or as required to translate it into languages other thanEnglish.The limited permissions granted above are perpetual and will not berevoked by the Internet Society or its successors or assigns.This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERINGTASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDINGBUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATIONHEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OFMERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.AcknowledgementFunding for the RFC Editor function is currently provided by theInternet Society.Newman Standards Track [Page 15]。