setup:mx
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| setup:mx [2013/05/25 14:18] – root | setup:mx [2013/07/31 13:16] (current) – [MySQL] root | ||
|---|---|---|---|
| Line 6: | Line 6: | ||
| ==== MySQL ==== | ==== MySQL ==== | ||
| + | Create a database with a user with appropriate rights | ||
| + | |||
| + | Then go into that database and execute this: | ||
| + | |||
| + | < | ||
| + | CREATE TABLE IF NOT EXISTS `domains` ( | ||
| + | `domain` varchar(50) NOT NULL, | ||
| + | PRIMARY KEY (`domain`) | ||
| + | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| + | |||
| + | CREATE TABLE IF NOT EXISTS `forwardings` ( | ||
| + | `source` varchar(80) NOT NULL, | ||
| + | `destination` text NOT NULL, | ||
| + | PRIMARY KEY (`source`) | ||
| + | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| + | |||
| + | CREATE TABLE IF NOT EXISTS `transport` ( | ||
| + | `domain` varchar(128) NOT NULL DEFAULT '', | ||
| + | `transport` varchar(128) NOT NULL DEFAULT '', | ||
| + | UNIQUE KEY `domain` (`domain`) | ||
| + | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| + | |||
| + | CREATE TABLE IF NOT EXISTS `users` ( | ||
| + | `email` varchar(80) NOT NULL, | ||
| + | `password` varchar(20) NOT NULL, | ||
| + | `quota` bigint(20) DEFAULT ' | ||
| + | PRIMARY KEY (`email`) | ||
| + | ) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
| + | </ | ||
| + | |||
| + | In the table **domains**, | ||
| + | |||
| + | In the table **forwardings**, | ||
| + | |||
| + | In the table **transport**, | ||
| + | |||
| + | In the table **users**, add an entry for each managed user you want to give a mailbox. Quota is expressed in bytes, and don't forget to use the **ENCRYPT** function to store the user password. | ||
| ==== Setup milters ==== | ==== Setup milters ==== | ||
| Line 34: | Line 71: | ||
| === DKIM (DomainKeys Identified Mail) === | === DKIM (DomainKeys Identified Mail) === | ||
| - | //This part has been inspired by the following tutorial: [[http:// | + | //This part has been inspired by the following tutorial: [[http:// |
| - | ns-with-postfix-and-debian.html | + | |
| Guide to Install OpenDKIM for multiple domains with Postfix and Debian]]// | Guide to Install OpenDKIM for multiple domains with Postfix and Debian]]// | ||
| Line 75: | Line 111: | ||
| == Install the filter socket in postfix == | == Install the filter socket in postfix == | ||
| - | Add the milter socket '' | + | Add the milter socket '' |
| < | < | ||
| non_smtpd_milters = unix:/ | non_smtpd_milters = unix:/ | ||
| You must put this filter before opendmarc (DMARC validation won't be done if you don't do it), and you should put it before spamass-milter socket (DKIM validation contributes to spam flagging). | You must put this filter before opendmarc (DMARC validation won't be done if you don't do it), and you should put it before spamass-milter socket (DKIM validation contributes to spam flagging). | ||
| - | |||
| === DMARC (Domain-based Message Authentication, | === DMARC (Domain-based Message Authentication, | ||
| - | [[http:// | + | [[http:// |
| - | * A security policy enforcement (quarantine or reject) when a DMARC-compliant server receives fraudulent email (detected using SPF policy violation or DKIM signature failure). | + | |
| + | * A security policy enforcement (quarantine or reject) when a DMARC-compliant server receives fraudulent email (detected using SPF policy violation or DKIM signature failure) | ||
| * Collecting feedback data. This is pretty useful to identify from where threats come from, and to set up a mitigation policy. | * Collecting feedback data. This is pretty useful to identify from where threats come from, and to set up a mitigation policy. | ||
| The stable version of this module is in debian unstable repository. Enable the unstable repository (and pin it to avoid an upgrade to unstable). | The stable version of this module is in debian unstable repository. Enable the unstable repository (and pin it to avoid an upgrade to unstable). | ||
| < | < | ||
| + | |||
| ==== Sorting your messages with maildrop ==== | ==== Sorting your messages with maildrop ==== | ||
| Installing maildrop | Installing maildrop | ||
| Line 103: | Line 140: | ||
| ''/ | ''/ | ||
| - | < | + | < |
| + | # Luthienstar Networks - 2013 | ||
| + | # | ||
| - | # Uncomment this line to make maildrop default to ~/Maildir for | + | |
| - | # delivery- this is where courier-imap (amongst others) will look. | + | #### |
| + | # | ||
| logfile "/ | logfile "/ | ||
| #log " Arguments: ' | #log " Arguments: ' | ||
| - | # | + | |
| - | # Set up some environment | + | #### Environment |
| # ${user} ${domain} ${extension} ${nexthop} ${sender} | # ${user} ${domain} ${extension} ${nexthop} ${sender} | ||
| # | # | ||
| + | |||
| SHELL="/ | SHELL="/ | ||
| import EXT | import EXT | ||
| Line 125: | Line 166: | ||
| SENDER=" | SENDER=" | ||
| - | # | + | #### |
| - | # Environment setup | + | |
| # | # | ||
| MAILROOT="/ | MAILROOT="/ | ||
| - | DEFAULT=" | + | DEFAULT=" |
| + | maildirmake=/ | ||
| + | mkdir=/ | ||
| + | rmdir=/ | ||
| + | #### Create the base directories if a user has none | ||
| # | # | ||
| - | # Filtering rules | + | `test -e $DEFAULT` |
| + | if ($RETURNCODE != 0) | ||
| + | { | ||
| + | `$mkdir -p $DEFAULT` | ||
| + | `$rmdir $DEFAULT` | ||
| + | `$maildirmake $DEFAULT` | ||
| + | `touch $DEFAULT/ | ||
| + | `$maildirmake " | ||
| + | `$maildirmake " | ||
| + | `$maildirmake " | ||
| + | `$maildirmake " | ||
| + | `echo INBOX.Drafts >> $DEFAULT/ | ||
| + | `echo INBOX.Junk >> $DEFAULT/ | ||
| + | `echo INBOX.Sent >> $DEFAULT/ | ||
| + | `echo INBOX.Trash >> $DEFAULT/ | ||
| + | } | ||
| + | |||
| + | |||
| + | #### | ||
| # | # | ||
| Line 146: | Line 208: | ||
| if( $EXTENSION =~ /\.\./) | if( $EXTENSION =~ /\.\./) | ||
| { | { | ||
| - | log "' | + | log "' |
| } | } | ||
| else | else | ||
setup/mx.1369484313.txt.gz · Last modified: 2013/05/25 14:18 by root