1

Looking for general mail server security best practices here.

I did some research and it's really hard to find the information out there.

  1. How do you safeguard a smtp server log? Are there any encryption tools out there? Our reason is if the server is compromised, at least the logs are not in plaint text format for attackers to see without obtaining our tool/keys.

  2. It seems like most SMTP servers out there store recipient information in the log files. How can we ensure these informations are not stored or at a minimum are scrambled. Is that possible?

Thank you and I'm still researching on the subject.

==== Edit

The context here is we are a gov agency trying to use a third party mail server for sending out mass emails. We are concerned with "client" email addresses being revealed or be read by third parties. How do we safe guard the recipient info as well as the mail content?

2
  • This question kind of assumes that there are some tools out there and specific hardening rules which can be applied to arbitrary mail servers. This is not true - there are lots of different mail servers out there. Apart from that there are lots of smaller questions about the kind of setup you want to achieve and what kind of threats you want to protect what information from: for example a mail server can be used just as a hop in the chain but can also store the received files locally. Maybe some IMAP/POP3 server is involved there too? Please be way more specific the currently. Commented Feb 6, 2020 at 18:17
  • Hey guys: thanks for giving me the advice. The context here is we are a gov agency trying to use a third party mail server for sending out mass emails. We are concerned with "client" email addresses being revealed or be read by third parties. How do we safe guard the recipient info as well as mail content?
    – Leon X
    Commented Feb 14, 2020 at 18:42

3 Answers 3

0

The context here is we are a gov agency trying to use a third party mail server for sending out mass emails. We are concerned with "client" email addresses being revealed or be read by third parties. How do we safe guard the recipient info as well as the mail content?

You can't. Since you are using a third party server to send the email the third party server must of course know the target email. And every other server on the way to the recipient must know it too since otherwise the mail cannot be delivered. This is like with snail mail - you need to put the recipient email on the envelope and whoever delivers the mail can see it.

As for protecting the content: unless you have already established a way with the client to exchange encrypted mail you cannot encrypt the mail and everyone involved in delivery of the mail can read it. It is like a postcard in snail mail. And it is very unlikely that you have some encryption setup with the client since this would involve exchanging keys or certificates associated with the person and most senders and recipients don't have these in the first place.

1
  • Thanks Steffen. In this case, since technology wise, it can't be done, then we'll have to go with the policy route and ensure the third party signs an agreement with proper authorization, risk management & audit trails are in place among other requirements to ensure the safety of the mail contents. Greatly appreciate it.
    – Leon X
    Commented Feb 15, 2020 at 19:38
0

If you want to verify that the information on the SMTP logs is correctly and has not been tampered probably you will need to implement extra functionality on your M TA. On the past, I worked on a project and we got the same problem, basically we implement some functions with PKI and Hashing (SHA1) to prevent any one could modify a log file (malicious admin). Not sure if opensource MTAs have that functionality.

0

I think one simple solution to this would be to use some tool like logrotate and add a script in the postrotate section that uses a public key to encrypt the data. Note that this does not prevent tampering and it leaves the data since the last logrotate run unprotected. However, I think it is a good step in the right direction.

If you want to protect the files from tampering logrotate also has options for mailing the logs or you can have a similar script that will copy them to a remote server to some kind of write-once storage.

If you are using syslog you could also generally use a remote syslog facility. This is supported by exim, for example. I have no experience with it so there might be hidden caveats but in general it sounds like an interesting solution to the problem.

And this is only vaguely related to your question but I always like to advertise https://bettercrypto.org/ which has information for good setup defaults for a wide variety of software.

Not the answer you're looking for? Browse other questions tagged .