Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a small website and would like to encrypt incoming email using gpg. Is there a way to force sendmail to check email and encrypt it if its not already encrypted?

I'm using GPG on a linux server.

Thanks

[added]Someone asked what I hope to accomplish. My intent is for the users of the email to become more familiar with seeing thier own email encrypted and losing that fear of the unknown. The side benefit is that the email can't be looked at later down the road. If the email isn't encrypted on its way in, I'm unable to do anything about it. I'm assuming most email would be nosed around with once its already on my hard drive, so GPG would protect against those issues.

share|improve this question
3  
Can you elaborate on what you hope to accomplish by this? By the time it reaches your server, it has already traveled in plaintext across a public network, so this doesn't provide much in the way of security. –  Paul Lathrop Aug 8 '09 at 18:56
2  
You can use disk encryption. Make a partition for the mails and mount it as the maildir. If you don't want new partitions you can use filesystem level solutions like encfs. –  stribika Aug 8 '09 at 19:20
    
I've seen too many news cases where email comes back to haunt someone. Most of what is in the emails is of no big interest, but its a start to get people to respecting their own privacy. I know its not perfect, but I look at it as a first step to people becoming familiar with the security –  user16067 Aug 9 '09 at 0:13
    
In cases where email comes back to "bite" people, encrypting the message your end is unlikely to help. If you send something to someone that doesn't like it, the chances are THEY will leak it! As for big companies, It is generally a legal requirement to keep all email, so if a company becomes under legal or reglatory review, it can be viewed. –  William Hilsum Aug 9 '09 at 1:18
add comment

5 Answers

up vote 1 down vote accepted

For a specific inbox, this is easy enough to do with procmail. Here's a link to get you started.

The problem is if you want to do this to all incoming emails. That, too, could be done, but it's a little more involved due to trying to determine the correct public key for each recipient. If you want to encrypt with the same key for all messages, then it gets easier.

However, as someone else said, if you want to do wholesale encryption, I'd resort to partition-level encryption, which is an entirely different (and much more involved) discussion .

More specific requirements and your desired goal would be helpful to provide you with an answer.

share|improve this answer
add comment

You can configure your SMTP server to allow SSL connections, installing an appropriate certificate (which you may need to pay for). Senders will then use SSL to send you your email.

You can reject unencrypted mail (so the recipient doesn't receive it, and a legitimate sender should get a bounce), but you cannot absolutely force them not to send it down the wire if they so wish, particularly if their MTA is buggy.

None of this has anything to do with GPG; it is entirely transparent to the end-user sender and recipient.

share|improve this answer
add comment

Are you ready to host those GPG keys? You need to really consider the administrative complexity you are going to incur for a little education.

When ever a key has expired you will either need to:

  1. Un-encrypt all the user's mail with the old key, then re-encrypt all the mail with the new key.
  2. Keep all the old keys, and make them available to the user.
share|improve this answer
add comment

Here is a real example of how this might be useful: to allow a server to store email, but to provide a limit level of privacy assurance from CASUAL snooping of the email by administrators of various kinds. In particular, in many organizations there can be too many people with access to the file system and my encrypting individual emails with user-specific keys the users have a measure of protection. Naturally, this would not provide protection from a concerted effort to log, sniff or store email at an organized institutional level, but that's not the point.

share|improve this answer
add comment

Disk-level encryption would be a lot easier to administer. It doesn't promote GPG usage amoung your users, but it certainly stops the messages be looked at later down to the line by someone who gets their paws on the hard drive. Check out ecryptfs.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.