User Tools

Site Tools


setup:mx

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
setup:mx [2013/05/25 14:24] rootsetup: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:
 +
 +<code>
 +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 '10485760',
 +  PRIMARY KEY (`email`)
 +) ENGINE=MyISAM DEFAULT CHARSET=latin1;
 +</code>
 +
 +In the table **domains**, add each domain you want to manage on your server.
 +
 +In the table **forwardings**, add each email value pair that you want to redirect, no account is needed on the server.
 +
 +In the table **transport**, add transport directives for each domain you want to configure. For locally hosted domains, add **:** in the transport column.
 +
 +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 103: Line 140:
  
 ''/etc/maildroprc'' ''/etc/maildroprc''
-<code># Global maildrop filter file+<code># /etc/maildroprc - Global maildrop filtering rules 
 +# Luthienstar Networks - 2013 
 +#
  
-Uncomment this line to make maildrop default to ~/Maildir for + 
-delivery- this is where courier-imap (amongst others) will look.+### Logging controls 
 +#
 logfile "/var/log/maildrop.log" logfile "/var/log/maildrop.log"
 #log " Arguments: '$1' '$2' '$3' '$4' '$5' '$6' '$7'" #log " Arguments: '$1' '$2' '$3' '$4' '$5' '$6' '$7'"
  
-# + 
-Set up some environment variables+####  Environment variables definition
 # ${user} ${domain} ${extension} ${nexthop} ${sender} # ${user} ${domain} ${extension} ${nexthop} ${sender}
 # #
 +
 SHELL="/bin/sh" SHELL="/bin/sh"
 import EXT import EXT
Line 125: Line 166:
 SENDER="$5" SENDER="$5"
  
-# +####  Environment setup
-# Environment setup+
 # #
 MAILROOT="/home/vmail" MAILROOT="/home/vmail"
-DEFAULT="/home/vmail/$DOMAIN/$USERNAME"+DEFAULT="$MAILROOT/$DOMAIN/$USERNAME" 
 +maildirmake=/usr/bin/maildirmake 
 +mkdir=/bin/mkdir 
 +rmdir=/bin/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/courierimapsubscribed` 
 + `$maildirmake "$DEFAULT/.Drafts"
 + `$maildirmake "$DEFAULT/.Junk"
 + `$maildirmake "$DEFAULT/.Sent"
 + `$maildirmake "$DEFAULT/.Trash"
 + `echo INBOX.Drafts >> $DEFAULT/courierimapsubscribed` 
 + `echo INBOX.Junk >> $DEFAULT/courierimapsubscribed` 
 + `echo INBOX.Sent >> $DEFAULT/courierimapsubscribed` 
 + `echo INBOX.Trash >> $DEFAULT/courierimapsubscribed` 
 +
 + 
 + 
 +####  Filtering rules
 # #
  
Line 146: Line 208:
     if( $EXTENSION =~ /\.\./)     if( $EXTENSION =~ /\.\./)
     {     {
-        log "'..' pattern forbidden for security reasons."+        log "'..' pattern is forbidden for obvious reasons."
     }     }
     else     else
setup/mx.1369484661.txt.gz · Last modified: 2013/05/25 14:24 by root

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki