Skip to content

Instantly share code, notes, and snippets.

@julian-klode
Last active June 8, 2019 18:58
Show Gist options
  • Save julian-klode/434da3ed84bad76d91a162f6acb21352 to your computer and use it in GitHub Desktop.
Save julian-klode/434da3ed84bad76d91a162f6acb21352 to your computer and use it in GitHub Desktop.
Setting up a server-side encrypted maildir

This describes the idea behind an encrypted maildir on the server, with multiple clients that have access to it, and store unencrypted copies.

Initial setup:

  1. Generate a gpg key like [email protected]
  2. Import the public key into the keyring on the server
  3. Import private and public keys into keyring on the clients

On the server:

  1. Create an empty Maildir
  2. Create a .gitattributes file:
* filter=gpg
  1. Run git add .gitattributes and commit.
  2. Configure your mail delivery agent to pass the mail through gpg --encrypt --recipient [email protected] before storing it, or well, write your own MDA?

On the client:

  1. Pull the repository
  2. Configure the gpg filter, that is add to your .git/config (or maybe glboal config?)
[filter "gpg"]
        clean = "gpg --encrypt --recipient [email protected]"
        smudge = "gpg --decrypt"

Now you can use git pull and git push to synchronize your email on the client, and on your client, get a standard unencrypted maildir :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment