CentOS 5.1 下用源码编译安装 ExtMail (第三部分)





(一)安装 ExtMail 1.0.3 和 ExtMan 0.2.3

启动数据库 MySQL

# /etc/rc.d/init.d/mysql start                 [  OK  ]

然后使用 ps 命令来检查 mysqld 是否正常启动:

# ps ax|grep mysqld

正常情况下应出现如下的结果:

1702 ?        S      0:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/var --pid-file=/usr/local/mysql/var/mail.extmail.org.pid
1735 ?        Sl     0:00 /usr/local/mysql/libexec/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/var --user=mysql --pid-file=/usr/local/mysql/var/mail.extmail.org.pid --skip-external-locking --port=3306 --socket=/var/lib/mysql/mysql.sock
1959 pts/0    S+     0:00 grep mysqld

导入 ExtMail 和 ExtMan 所需要的数据库:(以下假设 ExtMail 1.0.3 和 ExtMan 0.2.3 的安装文件放置于 /tmp 目录下)

# mkdir /var/www/extsuite
# cd /var/www/extsuite
# tar zxvf /tmp/extman-0.2.3.tar.gz
# tar zxvf /tmp/extmail-1.0.3.tar.gz

# mv extman-0.2.3 extman
# mv extmail-1.0.3 extmail

# mysql -u root -p < /var/www/extsuite/extman/docs/extmail.sql
# mysql -u root -p < /var/www/extsuite/extman/docs/init.sql

链接基本库到 Extmail

由于 ExtMan 的体系与 ExtMail 比较类似,因此 ExtMan 需要使用 ExtMail 中几个基础 perl 模块,在extman 的源码包里,包含了一个叫 buildlink.sh 的小脚本,该脚本完成了这些链接的工作,使用方法:

# cd /var/www/extsuite/extman/libs/Ext
# ./buildlink.sh build /var/www/extsuite/extmail/libs/Ext
# mkdir /var/www/extsuite/extman/tmp
# chown -R vuser:vgroup /var/www/extsuite/extman/tmp
# cp /var/www/extsuite/extman/docs/mysql_virtual_*.cf /etc/postfix/

# vi /var/www/extsuite/extman/webman.cf

# sys_sess_dir, the session dir
SYS_SESS_DIR = /var/www/extsuite/extman/tmp

操作完毕后,需要建立刚才导入 mysql 的 test@extmail.org 帐户的 Maildir,请输入如下命令:

# cd /var/www/extsuite/extman/tools
# ./maildirmake.pl /home/domains/extmail.org/test/Maildir
# chown -R vuser:vgroup /home/domains/extmail.org

测试 maildrop:

# maildrop -V 10 -d test@extmail.org

执行后,应该会出现如下所示:

maildrop: authlib: groupid=1000
maildrop: authlib: userid=1000
maildrop: authlib: logname=test@extmail.org, home=/home/domains/extmail.org/test, mail=/home/domains/extmail.org/test/Maildir/
maildrop: Changing to /home/domains/extmail.org/test

(二)配置 ExtMail 和 ExtMan

因为之前我们已经安装好了 mod_fastcgi 和 FCGI 了,因此,现在我们只需要对 ExtMail 和 ExtMan 和 http 进行配置即可了:

# vi /etc/httpd/conf/httpd.conf

=========== 修改部分 =================

Listen 12.34.56.78:80
#Listen 80

=================================

=========== 新增加部分 =================

LoadModule fastcgi_module modules/mod_fastcgi.so

IfModule mod_fastcgi.c    //两边加上“尖括号”(这里显示不了,不知道为啥)

FastCgiIpcDir /var/lib/fcgi

IfModule   //两边加上“尖括号”(这里显示不了,不知道为啥)

NameVirtualHost 12.34.56.78
Include conf/mail.extmail.org.conf


=================================

注明:上面提及的 12.34.56.78 根据实际情况设置为服务器的 IP 地址。

# vi /etc/hosts    //增加下面这行

12.34.56.78            mail.extmail.org         mail

# vi /etc/httpd/conf/mail.extmail.org.conf

# VirtualHost for ExtMail Solution
# VirtualHost *:80        两边加上“尖括号”

VirtualHost mail.extmail.org           两边加上“尖括号”

ServerName mail.extmail.org

DocumentRoot /var/www/extsuite/extmail/html/

ScriptAlias     /extmail/cgi/   /var/www/extsuite/extmail/dispatch.fcgi/
Alias           /extmail        /var/www/extsuite/extmail/html

ScriptAlias     /extman/cgi/    /var/www/extsuite/extmail/dispatch.fcgi/
Alias           /extman         /var/www/extsuite/extman/html

Location "/extmail/cgi"       两边加上“尖括号”
 SetHandler fastcgi-script
/Location                                  两边加上“尖括号”

Location "/extman/cgi"                  两边加上“尖括号”
 SetHandler fastcgi-script
/Location                                       两边加上“尖括号”

/VirtualHost                                     两边加上“尖括号”


# cd /var/www/extsuite/extmail
# chmod 755 dispatch.fcgi
# chmod 755 dispatch-init
# chmod 755 dispatch_lig.sh
# chown -R vuser:vgroup cgi
# chmod -R 755 cgi

# cd /var/www/extsuite/extman
# chown -R vuser:vgroup cgi
# chmod -R 755 cgi

到此为止,ExtMail 和 ExtMan 的设置部分就结束了:

# /etc/rc.d/init.d/httpd restart

Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

最后访问 http://mail.extmail.org/extmail/,如无意外,将看到 webmail 的登陆页,不过此时还没有加正式的用户,所以不能登陆,包括 test@extmail.org 也不行。必须要登陆到 http://mail.extmail.org/extman/  里增加一个新帐户才能登陆。

ExtMan 的默认超级管理员帐户是 root@extmail.org,密码是 extmail,登陆成功后,建议将密码修改,以确保安全。

(三)postfix 的主要配置文件(范例)

=========== main.cf =================

alias_database = hash:/etc/postfix/aliases
alias_maps = hash:/etc/postfix/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/libexec/postfix
debug_peer_level = 2
html_directory = no
mail_owner = postfix
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop

# hostname

mynetworks = 127.0.0.1
myhostname = mail.extmail.org
mydomain = extmail.org
mydestination = $mynetworks, $myhostname

# banner

mail_name = Postfix - By $mydomain
smtpd_banner = $myhostname ESMTP $mail_name

# response immediately

smtpd_error_sleep_time = 3s
unknown_local_recipient_reject_code = 550

command_time_limit = 120s
smtp_data_done_timeout = 1800s
smtp_connect_timeout = 1200s
queue_run_delay = 300s
bounce_queue_lifetime = 3600s
maximal_queue_lifetime = 3600s
minimal_backoff_time = 600s
maximal_backoff_time = 3600s

# extmail config here

virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_transport = maildrop:

# maildrop setting

maildrop_destination_concurrency_limit = 1
maildrop_destination_recipient_limit = 1

# smtpd related config

smtpd_recipient_restrictions =
       permit_mynetworks,
       permit_sasl_authenticated,
       reject_non_fqdn_hostname,
       reject_non_fqdn_sender,
       reject_non_fqdn_recipient,
       reject_unauth_destination,
       reject_unauth_pipelining,
       reject_invalid_hostname

# SMTP sender login matching config

smtpd_sender_restrictions =
       reject_sender_login_mismatch,
       reject_authenticated_sender_login_mismatch,
       reject_unauthenticated_sender_login_mismatch

smtpd_sender_login_maps =
       mysql:/etc/postfix/mysql_virtual_sender_maps.cf,
       mysql:/etc/postfix/mysql_virtual_alias_maps.cf

# SMTP AUTH config here

broken_sasl_auth_clients = yes
smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $mydomain
smtpd_sasl_security_options = noanonymous

# Content-Filter

#header_checks = regexp:/etc/postfix/header_checks
receive_override_options = no_address_mappings

# Message and return code control

mailbox_size_limit = 419430400
message_size_limit = 41943040
show_user_unknown_table_name = no

# Base Config

line_length_limit = 40960
header_size_limit = 1024000
queue_minfree = 94371840
bounce_size_limit = 51200
smtp_destination_recipient_limit = 10
smtpd_client_connection_rate_limit = 50
smtpd_client_connection_count_limit = 50

===================================


=========== master.cf =================

#
# Postfix master process configuration file.  For details on the format
# of the file, see the Postfix master(5) manual page.
#
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
#submission inet n      -       n       -       -       smtpd
#       -o smtpd_etrn_restrictions=reject
#       -o smtpd_client_restrictions=permit_sasl_authenticated,reject
#smtps    inet  n       -       n       -       -       smtpd
#  -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes
#submission   inet    n       -       n       -       -       smtpd
#  -o smtpd_etrn_restrictions=reject
#  -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes
#628      inet  n       -       n       -       -       qmqpd
pickup    fifo  n       -       n       60      1       pickup
cleanup   unix  n       -       n       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
#qmgr     fifo  n       -       n       300     1       oqmgr
tlsmgr    unix  -       -       n       1000?   1       tlsmgr
rewrite   unix  -       -       n       -       -       trivial-rewrite
bounce    unix  -       -       n       -       0       bounce
defer     unix  -       -       n       -       0       bounce
trace     unix  -       -       n       -       0       bounce
verify    unix  -       -       n       -       1       verify
flush     unix  n       -       n       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
smtp      unix  -       -       n       -       -       smtp
# When relaying mail as backup MX, disable fallback_relay to avoid MX loops
relay     unix  -       -       n       -       -       smtp
       -o fallback_relay=
#       -o smtp_helo_timeout=5 -o smtp_connect_timeout=5
showq     unix  n       -       n       -       -       showq
error     unix  -       -       n       -       -       error
discard   unix  -       -       n       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       n       -       -       lmtp
anvil     unix  -       -       n       -       1       anvil
scache    unix  -       -       n       -       1       scache
#
# ====================================================================
# Interfaces to non-Postfix software. Be sure to examine the manual
# pages of the non-Postfix software to find out what options it wants.
#
# Many of the following services use the Postfix pipe(8) delivery
# agent.  See the pipe(8) man page for information about ${recipient}
# and other message envelope options.
# ====================================================================
#
# maildrop. See the Postfix MAILDROP_README file for details.
# Also specify in main.cf: maildrop_destination_recipient_limit=1
#
maildrop  unix  -       n       n       -       -       pipe
 #flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
 flags=DRhu user=vuser argv=maildrop -w 90 -d ${user}@${nexthop} ${recipient} ${user} ${extension} {nexthop}
#
# The Cyrus deliver program has changed incompatibly, multiple times.
#
old-cyrus unix  -       n       n       -       -       pipe
 flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user}
# Cyrus 2.1.5 (Amos Gouaux)
# Also specify in main.cf: cyrus_destination_recipient_limit=1
cyrus     unix  -       n       n       -       -       pipe
 user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user}
#
# See the Postfix UUCP_README file for configuration details.
#
uucp      unix  -       n       n       -       -       pipe
 flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail.postfix ($recipient)
#
# Other external delivery methods.
#
ifmail    unix  -       n       n       -       -       pipe
 flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
 flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient

127.0.0.1:10025 inet    n       -       n       -       -       smtpd
   -o content_filter=
   -o local_recipient_maps=
   -o relay_recipient_maps=
   -o smtpd_restriction_classes=
   -o smtpd_client_restrictions=
   -o smtpd_helo_restrictions=
   -o smtpd_sender_restrictions=
   -o smtpd_recipient_restrictions=permit_mynetworks,reject
   -o mynetworks=127.0.0.0/8
   -o strict_rfc821_envelopes=yes
   -o smtpd_error_sleep_time=0
   -o smtpd_soft_error_limit=1001
   -o smtpd_hard_error_limit=1000
   -o receive_override_options=

smtps     inet  n       -       n       -       -       smtpd
 -o smtpd_tls_wrappermode=yes
 -o smtpd_sasl_auth_enable=yes
 -o smtpd_client_restrictions=permit_sasl_authenticated,reject

===================================

| 引用(0)
BLEAI
2008-1-28 15:32
# maildrop -V 10 -d test@extmail.org
提示:Invalid user specified.
日记本mail文件提示:
Jan 28 14:48:17 mail authdaemond: received userid lookup request: test@extmail.org
Jan 28 14:48:17 mail authdaemond: authmysql: trying this module
Jan 28 14:48:17 mail authdaemond: SQL query: SELECT username,password,"",uidnumber,gidnumber,                          CONCAT('/home/domains/',homedir),                                         CONCAT('/home/domains/',maildir),                                         quota,                                                                    name                                                                      FROM mailbox                                                              WHERE username = 'test@extmail.org'
Jan 28 14:48:17 mail authdaemond: zero rows returned
Jan 28 14:48:17 mail authdaemond: authmysql: REJECT - try next module
Jan 28 14:48:17 mail authdaemond: FAIL, all modules rejected
BLEAI
2008-1-28 15:28
运行:maildrop -V 10 -d test@extmail.org
提示:Invalid user specified.

找了几天资料都搞不定,只有发贴求助了^_^

日记本mail文件提示:
Jan 28 14:48:17 mail authdaemond: received userid lookup request: test@extmail.org
Jan 28 14:48:17 mail authdaemond: authmysql: trying this module
Jan 28 14:48:17 mail authdaemond: SQL query: SELECT username,password,"",uidnumber,gidnumber,                          CONCAT('/home/domains/',homedir),                                         CONCAT('/home/domains/',maildir),                                         quota,                                                                    name                                                                      FROM mailbox                                                              WHERE username = 'test@extmail.org'
Jan 28 14:48:17 mail authdaemond: zero rows returned
Jan 28 14:48:17 mail authdaemond: authmysql: REJECT - try next module
Jan 28 14:48:17 mail authdaemond: FAIL, all modules rejected
分页: 1/1 第一页 1 最后页
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]