RFC 2487
SMTP Service Extension for Secure SMTP over TLS
SMTP Service Extension for Secure SMTP over TLS ๐
Okay bestie, this is RFC 2487 ๐, from the Network Working Group โจ. It was written by P. Hoffman of the Internet Mail Consortium ๐ and dated January 1999. It's a Standards Track document ๐, so it's a real protocol spec, not just a chat about ideas.
Status of This Memo ๐
This document specifies an Internet standards track protocol for the Internet community ๐, and it requests discussion and suggestions for improvements ๐ฌ. For the standardization state and status of this protocol, check the current edition of the "Internet Official Protocol Standards" (STD 1) ๐. Distribution of this memo is unlimited ๐ฆ.
Copyright Notice ๐
Copyright (C) The Internet Society (1999). All Rights Reserved. ๐
1. Abstract โจ
This doc describes an extension to the SMTP service ๐จ that lets an SMTP server and client use transport-layer security to get private, authenticated communication over the Internet ๐. So SMTP agents can protect some or all of their communications from eavesdroppers and attackers ๐ต๏ธโโ๏ธ. Iconic. ๐
2. Introduction ๐ธ
SMTP [RFC-821] servers and clients normally talk in the clear over the Internet ๐ซฃ. A lot of the time, that traffic goes through one or more routers that neither side controls or trusts ๐. An untrusted router like that could let a third party watch or change what the server and client are saying to each other ๐ฌ.
There's also often a real need for two SMTP agents to verify each other's identities ๐ชช. For example, a secure SMTP server might only accept communication from other SMTP agents it already knows ๐ค. Or it might handle messages from a known agent differently than messages from one it doesn't know ๐ง.
TLS [TLS], which you probably know better as SSL, is a popular way to give TCP communications privacy and authentication ๐. It's widely used with HTTP, and it's also being used to add security to lots of other common protocols that run over TCP ๐.
2.1 Terminology ๐
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in [RFC-2119] ๐ง .
3. STARTTLS Extension ๐
The STARTTLS extension to SMTP is set up like this ๐ง:
- the name of the SMTP service defined here is
STARTTLS; - the
EHLOkeyword value associated with the extension isSTARTTLS; - the
STARTTLSkeyword has no parameters; - a new SMTP verb,
STARTTLS, is defined; - no additional parameters are added to any SMTP command.
4. The STARTTLS Keyword ๐ฆ
The STARTTLS keyword is how the SMTP server tells the SMTP client that it allows TLS ๐. It takes no parameters ๐ซถ.
5. The STARTTLS Command ๐
The format for the STARTTLS command is:
STARTTLS
with no parameters ๐ท.
After the client sends the STARTTLS command, the server replies with one of these reply codes ๐ฌ:
220 Ready to start TLS
501 Syntax error (no parameters allowed)
454 TLS not available due to temporary reason
Okay, this next part is a big deal ๐จ. A publicly-referenced SMTP server MUST NOT require use of the STARTTLS extension in order to deliver mail locally ๐ โโ๏ธ. This rule stops the STARTTLS extension from wrecking the interoperability of the Internet's SMTP infrastructure ๐. A publicly-referenced SMTP server is an SMTP server that runs on port 25 of an Internet host listed in the MX record (or the A record if there's no MX record) for the domain name on the right-hand side of an Internet mail address ๐.
Any SMTP server may refuse to accept messages for relay based on authentication supplied during the TLS negotiation ๐ช. An SMTP server that is not publicly referenced may refuse to accept any messages for relay or local delivery based on authentication supplied during the TLS negotiation ๐.
An SMTP server that is not publicly referenced may choose to require that the client do a TLS negotiation before accepting any commands ๐. In that case, the server SHOULD return this reply code:
530 Must issue a STARTTLS command first
to every command other than NOOP, EHLO, STARTTLS, or QUIT ๐. If the client and server are using the ENHANCEDSTATUSCODES ESMTP extension [RFC-2034], the status code to be returned SHOULD be 5.7.0 ๐.
After receiving a 220 response to a STARTTLS command, the client SHOULD start the TLS negotiation before sending any other SMTP commands ๐โโ๏ธ.
If the SMTP client is using pipelining as defined in RFC 1854, the STARTTLS command must be the last command in a group ๐.
5.1 Processing After the STARTTLS Command ๐
After the TLS handshake is done, both parties MUST immediately decide whether or not to keep going, based on the authentication and privacy they got ๐ง. The SMTP client and server may decide to move ahead even if the TLS negotiation ended with no authentication and/or no privacy ๐คทโโ๏ธ. That's because most SMTP services run with no authentication and no privacy ๐ญ. But some SMTP clients or servers might only want to continue if a certain level of authentication and/or privacy was achieved ๐ก๏ธ.
If the SMTP client decides the level of authentication or privacy isn't high enough to continue, it SHOULD issue an SMTP QUIT command right after the TLS negotiation is complete ๐. If the SMTP server decides the level of authentication or privacy isn't high enough, it SHOULD reply to every SMTP command from the client (other than a QUIT command) with the 554 reply code ๐ซ. It can include a text string like "Command refused due to lack of security" ๐ฅ.
Whether to believe the other party's authenticity in a TLS negotiation is a local decision ๐ . Still, here are some general rules for making that call ๐ก:
- An SMTP client would probably only want to authenticate an SMTP server whose server certificate has a domain name matching the domain name the client thought it was connecting to ๐ฏ.
- A publicly-referenced SMTP server would probably want to accept any certificate from an SMTP client ๐ช, and it might want to put distinguishing information about the certificate in the Received header of messages that were relayed or submitted from the client ๐.
5.2 Result of the STARTTLS Command ๐
When the TLS handshake finishes, the SMTP protocol resets to its initial state (the state SMTP is in after a server sends a 220 service ready greeting) ๐. The server MUST discard any knowledge it got from the client that didn't come from the TLS negotiation itself, like the argument to the EHLO command ๐๏ธ. The client MUST discard any knowledge it got from the server that didn't come from the TLS negotiation itself, like the list of SMTP service extensions ๐งน. The client SHOULD send an EHLO command as its first command after a successful TLS negotiation ๐.
The list of SMTP service extensions returned in response to an EHLO command received after the TLS handshake MAY be different from the list returned before it ๐ญ. For example, an SMTP server might not want to advertise support for a particular SASL mechanism [SASL] unless the client sent an appropriate client certificate during the TLS handshake ๐ชช.
Both the client and the server MUST know whether a TLS session is active ๐. A client MUST NOT try to start a TLS session if one is already active ๐ โโ๏ธ. A server MUST NOT return the TLS extension in response to an EHLO command received after a TLS handshake has completed ๐ซ.
To be continued in part 2! ๐โจ
A. References ๐
okay so this is the bibliography bit, and it's giving "receipts for everything" ๐ every doc this one leans on is listed here so you can go read them yourself ๐ค
- [RFC-821] Postel, J., "Simple Mail Transfer Protocol", RFC 821, August 1982. ๐ฎ
- [RFC-1869] Klensin, J., Freed, N, Rose, M, Stefferud, E. and D. Crocker, "SMTP Service Extensions", STD 10, RFC 1869, November 1995. โจ
- [RFC-2034] Freed, N., "SMTP Service Extension for Returning Enhanced Error Codes", RFC 2034, October 1996. ๐
- [RFC-2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997. ๐ฅ
- [SASL] Myers, J., "Simple Authentication and Security Layer (SASL)", RFC 2222, October 1997. ๐ฆ
- [SMTP-AUTH] "SMTP Service Extension for Authentication", Work in Progress. ๐ง
- [TLS] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0", RFC 2246, January 1999. ๐
B. Author's Address ๐ก
this is where you can find the author, Paul Hoffman, at the Internet Mail Consortium ๐
Paul Hoffman
Internet Mail Consortium
127 Segre Place
Santa Cruz, CA 95060
Phone: (831) 426-9827
EMail: phoffman@imc.org
C. Full Copyright Statement ๐
okay, legal bit, but make it cute ๐ the Internet Society owns the copyright (C) for 1999, and all rights are reserved, but it's honestly super generous lowkey ๐ซถ
so basically you're allowed to copy this doc and hand it out to people ๐ you can also make derivative works that comment on it, explain it, or help people actually implement it, and you can prepare, copy, publish, and distribute those too, in whole or in part, with no restriction at all โจ the one catch is that the copyright notice and this paragraph have to stay on every copy and every derivative work ๐
the doc itself cannot be modified in any way, though ๐ that means no removing the copyright notice and no removing references to the Internet Society or other Internet organizations. the exceptions are when you need it for developing Internet standards, in which case you have to follow the copyright procedures in the Internet Standards process, or when you need to translate it into a language that isn't English ๐ธ
these permissions are perpetual, which is the forever kind of vibe ๐ they will not be revoked by the Internet Society or its successors or assigns โจ
last but not least, the doc and everything in it is provided on an "AS IS" basis ๐ THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. so yeah, no guarantees, just vibes ๐
๐ฆ where this page comes from
- ietf: rfc2487 1999-01
- ๐ girlified by claude-haiku-5-5 on : a language model's rewrite of the original, under its terms