Conversations about life & privacy in the digital age

Securing Your Mail From Site to Site

Many of you know how to secure your email between your mail client and your computer. But if you run your own mail server, did you know you can secure email between servers? Many servers support TLS encryption for outgoing connections, which will protect your mail between your server and the next one. For my favorite mail server, Postfix, add this to your main.cf:

smtp_tls_security_level = may

This will enable “opportunistic” TLS for outbound connections, meaning it will use encryption if the remote server supports it, otherwise it will transmit it unencrypted. If you’re really paranoid and don’t want to talk to servers that don’t support encryption, you can change may to verify or secure to ensure that the remote end uses encryption.

To ensure that your server listens for TLS requests, add this:

smtpd_tls_security_level = may
smtpd_tls_cert_file = ...
smtpd_tls_key_file = ...

Note the small difference between smtp_... and smtpd_. The cert and key parameters configure your SSL certificate. You can also use encrypt here instead of may to force encryption for clients, but this isn’t recommended for a public Internet server.

By default, if Exim is compiled with TLS support, it will attempt TLS for outbound connections. If you want it to accept TLS, though, you’ll have to set:

tls_advertise_hosts = *
tls_certificate = ...
tls_privatekey = ...

It’s important to note that even with these configurations, you can’t guarantee that your mail is completely encrypted in transit, since your mail could be transmitted between several servers. It also doesn’t prevent eavesdropping on the servers themselves. If you want to ensure that only the recipient can read your mail, you should use something like PGP.

I’ll leave other mail servers as an exercise to the reader. Feel free to post further configuration or notes in the comments!

Comments

  1. Matt says:

    How many people run their own mail server? I hope they all have TLS enabled. However PGP (or GPG) seems like the real win here.

    I have been using TrueCrypt to encrypt my private data. It seems to work fine for files. Should I move to PGP (or GPG)?

    I don’t encrypt my email because no one I email would be willing to deal with it.

  2. brom says:

    I am currently searching for an email service provider to provide encrypted storage for received email. I feel that when sending mail, whether it is sent unencrypted or using PGP is not the real problem; however what about the records everyone maintains in their email box. I agree with the Spider Oak team that running one’s own mail server is a viable option, however, I feel there would be great difficulty maintaining 100% uptime. A VPS may be a decent solution, however at great cost. If SpiderOak would like to take on this issue, I feel they could provide an excellent product. Offer a zero knowledge email solution, where the mail is stored encrypted and expedites PGP key management for one’s contacts. Also, Matt GPG is the GNU version of PGP, both are essentially the same. GPG is open source free software and is used by default on GNU/Linux operating systems.

  3. Mark Moore says:

    Mail is the only service in my “cloud” arsenal that is hosted elsewhere. I have my own servers on a block of 5. The more and more I read about the government intrusions, the more motivated I become. Is SpiderOak feeling people out for the potential for email hosting? I’m game if so :-)

  4. TomL says:

    Matt, TrueCrypt and PGP are both excellent. They’re for different purposes, and work in different ways. TrueCrypt is focused on providing secure storage. PGP is focused on letting people communicate securely.
    While you could use GPG to encrypt files to yourself, it’s not really what it’s normally used for. Stick with trueCrypt for that.

    Regarding mail partners’ reluctance to use PGP, that is something we all struggle with. The only way forward is to keep chipping at the block.

    If SpiderOak offered a zero-knowledge webmail system, that would be very welcome. However, look at what happened to Hushmail, who tried something along the same lines. As I recall, they were forced by Canadian authorities, at the pressure of US authorities, to deliver “spiked” client-app downloads to persons of interest. Those would reveal the secret data requested, unknown to the customer. (Is this sort of thing happening at SpiderOak?)

    Since then, Hushmail seems to have moved away from the zero-knowledge approach altogether. While they still offer webmail with PGP encryption, the keys are stored on their servers. I don’t really have any good ideas regarding how you could do a zero-knowledge webmail service that has all the modern conveniences we expect nowadays, without special (and corruptible) plugins.