1
0
mirror of https://github.com/mail-in-a-box/mailinabox.git synced 2024-11-26 02:57:04 +00:00
mailinabox/README.md
Joshua Tauberer 97b2105a1f spamassassin
2013-08-23 11:59:28 -04:00

2.3 KiB

Mail in a Box

One-click deployment of your own mail server and personal cloud (so to speak).

This draws heavily on Sovereign by Alex Payne (https://github.com/al3x/sovereign) and the "NSA-proof your email in 2 hours" blog post by Drew Crawford (http://sealedabstract.com/code/nsa-proof-your-e-mail-in-2-hours/).

Deploying to EC2 from the command line

Amazon's EC2 isn't a great place to host a mail server. Do you still need to request permission to send email first? And you don't know if you'll get an IP address with a bad reputation from its previous owner. But it makes deployment easy, so it may at least be useful for testing.

Sign up for Amazon Web Services.

Create an Access Key at https://console.aws.amazon.com/iam/home?#security_credential. Download the key and save the information somewhere secure.

Set up your environment and paste in the two parts of your access key that you just downloaded:

sudo apt-get install ec2-api-tools

export AWS_ACCESS_KEY=your_access_key_id
export AWS_SECRET_KEY=your_secret_key
export EC2_URL=ec2.us-east-1.amazonaws.com
export AWS_AZ=us-east-1a

The first time around, create a new volume (disk drive) to store your stuff.

source ec2/new_volume.sh

If you want to reuse an existing volume:

export VOLUME_ID=...your existing volume id...

Here we're using the Ubuntu 13.04 amd64 instance-store-backed AMI in the us-east region. You can select another at http://cloud-images.ubuntu.com/locator/ec2/.

Generate a new "keypair" (if you don't have one) that will let you SSH into your machine after you start it:

ec2addkey mykey > mykey.pem
chmod go-rw mykey.pem

Then launch a new instance. We're creating a m1.small instance --- it's the smallest instance that can use an instance-store-backed AMI. So charges will start to apply.

source ec2/start_instance.sh

It will wait until the instance is available.

You'll probably want to associate it with an Elastic IP. If you do, you'll need to update the INSTANCE_IP variable.

Configure the server:

ssh -i mykey.pem ubuntu@$INSTANCE_IP

Somehow download these files.

sh scripts/index.sh
...
logout

You'll also want to set reverse DNS (PTR), which is something your hosting provider will probably have a control panel for.

Terminate your instance with:

ec2-terminate-instances $INSTANCE