Skip to content
README.md 6.32 KiB
Newer Older
Pierre Ozoux's avatar
Pierre Ozoux committed
# email
Email application for IndieHosters network
Pierre Ozoux's avatar
Pierre Ozoux committed

Pierre Ozoux's avatar
Pierre Ozoux committed
# Debug

Bounce that are likely spam, ordered by day:
```
cat /var/log/mail.log* | grep "status=bounced"  | grep -v "Host not found\|Disabled recipient address\|loops back to myself\|example\|Recipient address rejected\|The email account that you tried to reach does not exist\|does not accept mail\|Email rejected per DMARC policy.\|User doesn't exist\|SMTPUTF8 is required" | cut -d":" -f1 | rev | cut -d" " -f2-4 | rev | sort | uniq -c | sort -nr
```

Bounce per domain name:
```
cat /var/log/mail.log* | grep "status=bounced"  | grep -v "Host not found\|Disabled recipient address\|loops back to myself\|example\|Recipient address rejected\|The email account that you tried to reach does not exist\|does not accept mail\|Email rejected per DMARC policy.\|User doesn't exist\|SMTPUTF8 is required"  | cut -d">" -f1 | cut -d"@" -f2 | sort | uniq -c | sort -nr
```

Sent per provider:
```
cat /var/log/mail.log* | grep "status=sent" | grep "to=.*@orange.fr>" | wc -l
cat /var/log/mail.log* | grep "status=sent" | grep "to=.*@wanadoo.fr>" | wc -l
cat /var/log/mail.log* | grep "status=sent" | grep "to=.*@laposte.net>" | wc -l
cat /var/log/mail.log* | grep "status=sent" | grep "to=.*@free.fr>" | wc -l
cat /var/log/mail.log* | grep "status=sent" | grep "to=.*@outlook.com>" | wc -l
```

Identify sender emails that are bounced:

First, list all emails ID:
```
cat /var/log/mail.log* | grep "status=bounced"  | grep -v "Host not found\|Disabled recipient address\|loops back to myself\|example\|Recipient address rejected\|The email account that you tried to reach does not exist\|does not accept mail\|Email rejected per DMARC policy.\|User doesn't exist\|SMTPUTF8 is required" | cut -d":" -f4 | sed 's/^[[:space:]]*//g' > /tmp/bounced
```

Then for each email id, get the from field, and here order by send email address:
```
while read message; do
   cat /var/log/mail.log* | grep "postfix/cleanup" | grep from | grep to | grep $message | cut -d"<" -f2-3 | cut -d">" -f1
done < /tmp/bounced | sort | uniq -c | sort -nr
```

Pierre Ozoux's avatar
Pierre Ozoux committed
## Features

Pierre Ozoux's avatar
Pierre Ozoux committed
indiehosters/email | mail-in-a-box/mailinabox | status
------------------ | ------------- | -----------
[x] SMTP (postfix) | [x] SMTP (postfix) | :white_check_mark: 
[x] IMAP (dovecot) | [x] IMAP (dovecot) | :white_check_mark: 
Pierre Ozoux's avatar
Pierre Ozoux committed
[x] POP  (dovecot) | [x] POP  (dovecot) | :white_check_mark: 
Pierre Ozoux's avatar
Pierre Ozoux committed
[ ] search (dovecot-lucene) | [x] search (dovecot-lucene) | [planned](https://github.com/indiehosters/email/issues/5)
[ ] CardDAV/CalDAV (ownCloud) | [x] CardDAV/CalDAV (ownCloud) | part of [ownCloud](https://github.com/indiehosters/ownCloud) package
[ ] Exchange ActiveSync (z-push) | [x] Exchange ActiveSync (z-push) | [planned](https://github.com/indiehosters/email/issues/3)
[ ] Webmail (Roundcube) | [x] Webmail (Roundcube) | [planned](https://github.com/indiehosters/email/issues/4)
[ ] static website hosting (nginx) | [x] static website hosting (nginx) | part of other package
[x] Spam filtering (spamassassin) | [x] Spam filtering (spamassassin) | :white_check_mark:
Pierre Ozoux's avatar
Pierre Ozoux committed
[x] greylisting (postgrey) | [x] greylisting (postgrey) | :white_check_mark: 
[ ] Backups (duplicity) | [x] Backups (duplicity) | part of [backup](https://github.com/IndiePaaS/IndiePaaS/blob/master/unit-files/b-u%40.service) package
[ ] firewall (ufw) | [x] firewall (ufw) | planned, as part of [firewall](https://github.com/IndiePaaS/IndiePaaS/issues/108) package
[ ] intrusion protection (fail2ban) | [x] intrusion protection (fail2ban) | ? (difficult in docker)
[ ] system monitoring (munin) | [x] system monitoring (munin) | planned, as part of other package

DNS (nsd4):

indiehosters/email | mail-in-a-box/mailinabox | status
------------------ | ------------- | ----
[x] DKIM (OpenDKIM) | [x] DKIM (OpenDKIM) | :white_check_mark: 
[x] DMARC | [x] DMARC (postgrey) | :white_check_mark: 
[ ] SPF | [x] SPF | planned, as part of [DNS](https://github.com/IndiePaaS/IndiePaaS/issues/98)
[ ] DNSSEC | [x] DNSSEC | planned, as part of [DNS](https://github.com/IndiePaaS/IndiePaaS/issues/98)
[ ] DANE TLSA | [x] DANE TLSA | planned, as part of [DNS](https://github.com/IndiePaaS/IndiePaaS/issues/98)
[ ] SSHFP records | [x] SSHFP records | planned, as part of [DNS](https://github.com/IndiePaaS/IndiePaaS/issues/98)

control panel and API:

indiehosters/email | mail-in-a-box/mailinabox | status
------------------ | ------------- | ----------
[x] vimbadmin | [x] custom coded | :white_check_mark: 
[x] Add/Remove mail User | [x] Add/Remove mail User | :white_check_mark: 
[x] Add/Remove Aliases | [x] Add/Remove Aliases | :white_check_mark: 
[ ] custom DNS records | [x] custom DNS records | planned, as part of [DNS](https://github.com/IndiePaaS/IndiePaaS/issues/98)
[x] multiadmin | [ ] mutliadmin | :white_check_mark: 
Pierre Ozoux's avatar
Pierre Ozoux committed
## Prerequistes

 - docker
 - docker-compose

Modify the following files:
 - env.template (and rename to env)
Pierre Ozoux's avatar
Pierre Ozoux committed

Add the following files:
 - TLS/chain.pem
 - TLS/cert.pem
Pierre Ozoux's avatar
Pierre Ozoux committed
 - TLS/ssl_certificate.pem
 - TLS/ssl_private_key.pem

## Run

```
Pierre Ozoux's avatar
Pierre Ozoux committed
VIRTUAL_HOST=example.org docker-compose up
Pierre Ozoux's avatar
Pierre Ozoux committed
```

Pierre Ozoux's avatar
Pierre Ozoux committed
Check go to the web interface (http://conainer_ip:80), get the salts, and put them in the `salts` file.
Pierre Ozoux's avatar
Pierre Ozoux committed

Everything should be up and running.

Pierre Ozoux's avatar
Pierre Ozoux committed
## Backup

Pierre Ozoux's avatar
Pierre Ozoux committed
To backup, just run the `./scripts/pre-backup` in your folder and you should be good!
Pierre Ozoux's avatar
Pierre Ozoux committed

## OpenDKIM

Run the `add_domain.sh` script inside the postix container, and configure your DNS, you should be fine!

Pierre Ozoux's avatar
Pierre Ozoux committed
## Add a mailbox

You can find a script [here](https://github.com/IndiePaaS/IndiePaaS/blob/master/utils/add_mailbox.sh)

Pierre Ozoux's avatar
Pierre Ozoux committed
## Contributing

If you have any issue (something not working, mail marked as spam, missing doc), please do report an issue here! Thanks

This system is used in production at [IndieHosters](https://indiehosters.net/) so it is maintained. If you use it, please tell us, and we'll be really happy to update this README!

You can help us by:
 - starring this project
 - sending us a thanks email
 - reporting bugs
 - writing documentation/blog on how you got up and running in 5mins
 - writing more documentation
 - sending us cake :) We loove cake!

## TODO
Pierre Ozoux's avatar
Pierre Ozoux committed
 - documentation for TLS for the web (reverse proxy FTW!)
Pierre Ozoux's avatar
Pierre Ozoux committed
 - separate processes in postfix (one process/container! damn!)
 - postfix/dovecot - try to sync install instructions with mailinabox

Heavily inspired by [mail-in-a-box](https://mailinabox.email/)! Thanks to the amazing work they produced. It is the best up to date `how to` for email hosting out there :)