- 论坛徽章:
- 0
|
Postfix Integrated Solution
集成电子邮件系统(MYSQL)
[url=http://www.huihoo.com/internet/postfix/pis/x842.html]Next >>>
Installing Courier Maildrop
Maildir format Web-mail email client
mailboxes
/-----------\ /----------\ *********** /---------\ /----------\
| | | | * Inbox * | | | |
| | ====> | Maildrop | ===> * * | Courier | | Postman |
| MTA | \----------/ | | | IMAP | Apache | | |
SMTP | | | |====> ************ | | | | | User's |
to & | (Message | filtering | * YYY * | | | | HTTP | web |
from | Transfer | rules in \=>************ * | | | | or | browser |
other | Agent) | .mailfilter * XXX * *** | | IMAP | SMTP | HTTPS | |
MTAs | | | | | |
\ | IMAP capable Email |
\ | client |
\ | |
\-----------
作者:love100 出处:chinunix.net Mail版
maildrop是一个替代邮件代理并且包含邮件过滤的语言,系统管理员用
这个maildrop即可以取代已经存在的邮件投递代理,或者用户可以用已
经存在的邮件投递代理的'forward to
program'机制来取代来运行maildrop.
maildrop首先从标准输入读取E-mail信息,其后面所带的回车符号将自动
被删除,一个E-mail信息包含header lines 后面跟着一个空行,然后跟
着信息的内容,信息的内容也可能在第一个header lines
之前包含mbox-style From_ line,如果信息内容没有包含From_line,那
么maildrop将自动创建一个.
如果文件/etc/maildroprc存在,邮件投递或邮件过滤将从/etc/maildro
prc中读出。maildrop的投递/过滤指令可能把信息保存在一个特殊的mai
lbox,或者丢弃它,或者返回给发送者,或者转发到不同的邮件地址。
如果文件/etc/maildroprc不存在,或者邮件投递或邮件过滤没有完全的
处理信息,这时maildrop将从$HOME/.mailfilter读取规则,如果.mailf
ilter不存在,或者邮件投递或邮件过滤没有完全的处理信息,maildrop
将保存E-mail信息到默认的mailbox里。
maildrop知道怎样投递到一个标准的mailbox文件,也知道怎样投递到一
个maildirs,maildir格式的目录在Courier和qmail中使用,还有一些邮
件服务器也知道如何去读maildirs。当投递mailbox文件时,maildrop将
锁定mailbox,直到投递结束。
maildrop读取信息的规则为:在From_header之前致少一空行,maildrop
在读取规则时将忽略此空行,因此maildrop要求规则中至少有一个空行。
通常邮件投递模式分为三种(maildrop依赖投递模式的不同也有小小的
差异):
1.手动模式.
一个文件包含过滤指令 例:maildrop -filename(保存过滤指信令的文
件),首先maildrop读取/etc/maildroprc文件里面的指令,然后从filena
me读取过滤指令.如果filename里面没有转发,回复,删除或到一个特殊
的maildox,那么它将投递到系统用户的mailbox中.
2投递模式.
maildrop如果没有指定 -filename时,maildrop将在投递模式运行,maildrop将改变当前目录到用户的的主目录,这时读取/etc/maildroprc,再读取 $HOME/.mailfilter
3 嵌入模式
主要用于Courier上,在此不做阐述.
安全
maildrop在setuid位下安装是安全的。Courier为了让maildrop在嵌入模式下使用因此它的setuid位是默认的。如果root运行maildrop 则-d这个选项会被用来指定这个信息的接受者,maildrop立马会重制用户的ID,读取$HOME/.mailfilter文件,并将信息投递到指定的用户。
系统管理员能通过配置来限制maildrop -d 这个选项是否给每个用户来使用(邮件系统用户本伸除外)
maildrop的(简单)用法:
-A "Header:value"
增加一个附加的头部信息。
-d user
在投递模式设置用户的ID
-f address
设置变量"FROM"为一个地址
-m
在嵌入模式下运行
-M filterfile
在一个特殊的嵌入模式运行
cc dotlock flock log logfile to xfilter
都不能运行在嵌入模式下
(待续)
安装
[root@linuxas3 maildrop-1.6.3]# ./configure --prefix=/usr/local/courier \
--enable-sendmail=/usr/sbin/sendmail \
--enable-maildropmysql --with-mysqlconfig=/etc/postfix/mysql_maildrop.conf \
--enable-maildirquota --with-trashquota --with-dirsync \
--enable-trusted-users='root maildrop' \
--enable-maildrop-uid=1000 \
--enable-maildrop-gid=1000
[root@linuxas3 maildrop-1.6.3]# make
[root@linuxas3 maildrop-1.6.3]# make install (as root)
配置 mysql_maildrop.conf
[root@linuxas3 maildrop-1.6.3]# cp maildropmysql.config /etc/postfix/mysql_maildrop.conf
[root@linuxas3 maildrop-1.6.3]# cd /etc/postfix/
[root@linuxas3 postfix]# vi mysql_maildrop.conf
hostname localhost
port 3306
socket /var/lib/mysql/mysql.sock
database postfix
dbuser postfix
dbpw xxxxx
dbtable postfix_users
default_uidnumber 1000
default_gidnumner 1000
uid_field user
uidnumber_field uid
gidnumber_field gid
maildir_field maildir
homedirectory_field home
quota_field quota
mailstatus_field status
where_clause ""
Example 1. mysql_maildrop.conf
[root@linuxas3 postfix]# cat mysql_maildrop.conf
# The attributes are:
#
# mail - The full email address of the user (ie user@yourdomain.com)
# This is the primary attribute searched upon by maildrop.
#
# maildir - The location (full path including name) of the users
# mail directory (Maildir)
#
# homedirectory - The location (full path including name) of the
# users home directory. This may be the same as the
# users maildir.
#
# uidnumber - The uid of the user that owns the mail files for
# this user. This may be a specific uid per user,
# or a single uid for every user (full 'virtual' user
# configuration), or a combination.
#
# gidnumber - The gid of the user that owns the mail files for
# this user. This may be a specific gid per user,
# or a single gid for every user (full 'virtual' user
# configuration), or a combination.
#
# quota - *OPTIONAL* The quota for this user. If blank, or
# non-existent defaults to no quota.
# mailstatus - account status
#
# A sample LDAP entry is given at the end of this file.
#
# --- Actual configuration begins here -----------------------------
# hostname - host name of your ldap server
hostname localhost
port 3306
socket /var/lib/mysql/mysql.sock
database postfix
dbuser postfix
dbpw 6AJx9Nqv9x8hg
dbtable postfix_users
#not used now
#timeout 5
# default_uid - default uid (number only) to use incase uidnumber attribute not
# found in users mysql entry
default_uidnumber 1000
# default_gid - default gid (number only) to use incase gidnumber attribute not
# found in users ldap entry
default_gidnumber 1000
# MySQL Field definitions
#
# This section allows you to specify the actual attributes you
# use in your Mysql record
#
# The example attribute mapping shown below is also the default
# mapping used by maildrop in the case that any are missing
# UID_FIELD - MySQL attribute which contains the users name (w or w/o domain)
uid_field user
# UIDNUMBER_FIELD - MySQL attribute which contains the system uid to deliver
# mail as
uidnumber_field uid
# GIDNUMBER_FIELD - MySQL attribute which contains the system gid to deliver
# mail as
gidnumber_field gid
# MAILDIR_FIELD - MySQL attribute which contains the path to the users
# custom maildir
maildir_field maildir
# HOMEDIRECTORY_FIELD - MySQL attribute which contains the path to the users
# home directory
homedirectory_field home
# QUOTA_FIELD - MySQL attribute which contains the users quota
quota_field quota
# MYSQL_DEFAULT_STATUS_FIELD - MySQL attribute which could be created in the
# MySQL entry to set whether or not the user is allowed to receive email on
# this box..
# -- looks unused for now; but must be valid column ! (2001-11-03)
mailstatus_field status
# MYSQL_DEFAULT_WHERE_CLAUSE - This is optional !
# It can be set to any fixed string starting with keyword 'AND'.
# It will then be appended to the WHERE clause of our query.
where_clause ""
[root@linuxas3 postfix]#
配置 master.cf
[root@linuxas3 postfix]# vi master.cf
maildrop unix - n n - - pipe
flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
改为
maildrop unix - n n - - pipe
flags=DRhu user=postfix argv=/usr/local/courier/bin/maildrop -d ${recipient}
[url=http://www.huihoo.com/internet/postfix/pis/book1.html]Home
Next >>>
Installing Courier POP and IMAP
Up
启动脚本
本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/19772/showart_134798.html |
|