Press "T" to toggle the outline view which contains additional information.
-why most folks have little clue on spam
MIME goodies are touched on in a bonus section authored by paulv.
Common acronyms used when talking email--the RFCs are rife with these.
A server that handles mail.
Your email client application. Examples: mutt, elm, pine, Thunderbird, kmail, Evolution and to a limited extent Outlook.
A mail relay. A server that shuffles mail from location to location.
A mail server that is speciffically tasked with receiving new mail messages.
An application that places mail into the user's mail box.
Result codes used by mail servers.
These are just the starting points
RFC: Request for Comment. These are the standards drafts that form the consensus specifications of the internet. The RFCs for mail start with the basic roots above and build into an exquisitely detailed branched tree. A full collection of RFCs can be found at Ohio State.
We will follow a mail message from sender to server to server...
| paulv @ | pea @ | ||||||||||
| ^ | |||||||||||
| v | |||||||||||
| canonical.org | inet | > | dma.org | ||||||||
First, I fire up telnet or netcat (cat for sockets) to connect to the SMTP relay. This is the same exchange as your mail client or local mail relay would use.
Open a connection to the server and start the exchange
Purple is what paulv types. This is the client side. Yellow is the server's response.
This is slightly simplified. The domain and port (canonical.org smtp) are not exactly as they would be entered at the command line. In practice, we would need to determine and specify the server that handles mail for canonical.org. This is often at a different address than canonical.org proper. "smtp" is normally port 25--that is, normally.
canonical acknowleges our connection and then we continue with the exchange.
My intention was to create the examples for this set of slides by pretending to be paulv, pushing a message into canoncal and catching copies as they moved through DMA's servers. Well, that didn't work, I'm not allowed to relay from canonical. Canonical is not an open relay (a mail server that takes all comers).
So, paulv will have to start the example mail himself. He has privledges on panacea.canonical.org. For those thinking ahead: no AUTH is shown here just to keep this example very simple.
A simple submission:
Additional recepients are entered one by one....
…and so on (within reason)
There are no extra recepients; this just illistrates where they would be entered.
Notice that the data section contains whatever
you feel like entering. To: ___; From: ___; Subject: ___;
Date: ____; are just courtesies extended to those downline.
Many relays will move the mail on without any of these lines being
present. Lesson: don't blindly trust the To and From lines.
Let's take another look at the data section. This is important-- the whole data section is entered by the client. They can put anything they desire here.
This information is a courtesy
Date: Wed, 14 Feb 2007 21:01:26 -0500 From: Paul Visscher <paulv@canonical.org> To: Paul Ahlquist <pea@ahlquist.org>Subject: LinuxSig-SMTP talk Message-ID: <20070215020126.GA30178@canonical.org> User-Agent: Mutt/1.5.9iNotice the To: Paul Ahlquist <pea@ahlquist.org>. The message is actually being sent to pea@dma.org. This shows the insignificance of the data section To:/From: information.
even the message body is optional
We should totally have candy at the meeting. It'll be great. --paulv
Are you beginning to see how a spammer or phisher can fake all sorts of things in the email?
Mail servers will queue the message and automatically retry the send in a short period. Typically the message will be retried for five days. If it still fails at the end of five days it is returned to the sender.
This type error will cause an immediate bounce. There is no reason to queue the message because whatever went wrong is not expected to get better in a typical queuing period.
see RFC-1893 for the details
Server admins may display some creativity in the human readable response
messages, but the response codes--the ^[245]\d\d--will be
consistant.
On the the next hop, accross the internet…
| paulv @ | pea @ | ||||||||||
| ^ | |||||||||||
| v | |||||||||||
| panacea.canonical.org | inet | > | kathalla.dma.org | ||||||||
This exchange is much like the initial injection of the mail above: HELO, MAIL FROM, RCPT TO
To move the mail to the destination, the MX of dma.org needs to be determined. This is kathalla.dma.org. This is the server the mail will be move to next.
If you connect to kathalla you will discover that this pause is on the order of 20-30 seconds.
The "MAIL FROM" and the "RCPT TO" are the envelope sender/receiver. "RCPT TO" is who will actually get the message; "MAIL FROM" is who will get the bounce. Notice that is "who will get the bounce" not "who sent";this, too, could be forged information.
If there were any, what happened to the additional recepients?
They were relayed on to "example.com". in a separate exchange just like this one with "dma.org".
The data section has grown a bit, it collects an extra line. The extra line shows information about the last server passed.
Above is the extra line describing the message's passge through panacea.canonical.org
This pause blocks a significant fraction of the zombie spammers. The simple mailer on pwned machines often does not have the "smarts" to do mail correctly, to wait for the server's response codes. They just connect and start spewing mail.
The magic of this greet pause is: any chattering during the pause period, before the server acknowleges the connection, causes the connection to be dropped. Whatever blue-pill or pump-n-dump or trojan was bound for our mailbox is blocked.
DNS for mail is a bit different than for web sites. For mail there are normally two lookups: one to find the name of the MX server, a second to obtain the IP address of that MX.
each hop adds the last hop's headers (if servers are well behaved)
We find that there is another step to go....
dma.org uses an outside MX that communicates with the internet and an internal server, dmapub, that handles the user's mail box.
| paulv @ | pea @ | ||||||||||||||||||||||||||||||||||
| ^ | |||||||||||||||||||||||||||||||||||
| dma.org | |||||||||||||||||||||||||||||||||||
| v | |||||||||||||||||||||||||||||||||||
| panacea.canonical.org | inet | > | kathalla | > | dmapub | ||||||||||||||||||||||||||||||
The mail will now work its way to LDA, the Local Delivery Agent, procmail.
…aaaand yet another line is added to the data section. This line shows the mail's passage through kathalla
This allows the MUA, your mail client, to display how much mail is available and, perhaps, generate a progress meter.
Colors on graph corrispond to highlights on the message.
Open the message linked above (it will open in a new window/tab). Compare the highlights on the message with this graph. The colors corrispond to which server added that part of the message.
| paulv @ | pea @ | ||||||||||||||||||||||||||||||||||
| ^ | |||||||||||||||||||||||||||||||||||
| dma.org | |||||||||||||||||||||||||||||||||||
| v | |||||||||||||||||||||||||||||||||||
| panacea.canonical.org | inet | > | kathalla | > | dmapub | ||||||||||||||||||||||||||||||
The only past you can really trust are the blue sections. The rest is in the data section of the mail--it can be forged. The added header lines are a courtesy provided by the servers along the way.
Standards compliant mail servers adhere to the courtesy of providing valid tracking headers …and a normal user mail client will properly provide rational To: From: Date: and Subject:information.
Return-Path:Received: from kathalla.dma.org (kathalla.dma.org [64.56.115.34]) by dmapub.dma.org (8.12.11.20060308/8.12.11) with ESMTP id l1F21laL027154 for ; Wed, 14 Feb 2007 21:01:48 -0500 Received: from panacea.canonical.org (66-193-87-113.static.twtelecom.net [66.193.87.113]) by kathalla.dma.org (8.13.4/8.13.4/Debian-3sarge3) with ESMTP id l1F21II2031491 for ; Wed, 14 Feb 2007 21:01:39 -0500 Received: by panacea.canonical.org (Postfix, from userid 1001) id 61571E340B8; Wed, 14 Feb 2007 21:01:26 -0500 (EST) Date: Wed, 14 Feb 2007 21:01:26 -0500 From: Paul Visscher To: Paul Ahlquist Subject: LinuxSig-SMTP talk
...continues...
Message-ID: <20070215020126.GA30178@canonical.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.9i X-UID: 120197 We should totally have candy at the meeting. It'll be great. --paulv
Questions can be posted to the DMA LinuxSig mailing list. Of course, you will need to be subscribed
If you have a mail account on a smaller mailserver you can try sending yourself a message. Just repeat the early SMTP exchange from this presentation (where paulv first posts the message) making appropriate changes in the addresses. A dmapub, account, which is available to all DMA members, is perfect for this.
paulv put together some extra material not presented at the LinuxSig meeting. It includes info on sending attachments, SMTP relay authorization and and secure auth.
Questions can be posted to the DMA LinuxSig mailing list. Of course, you will need to be subscribed