歡迎您光臨本站 註冊首頁

搭建基於Extman與Extmail的Postfix郵件伺服器

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

搭建基於Extman與Extmail的Postfix郵件伺服器

1. 安裝配置Postfix
# rpm -ivh postfix-2.3.3-2.src.rpm
# cd /usr/src/redhat/SPECS/
# vi postfix.spec
%define MYSQL 0修改為%define MYSQL 1
# rpmbuild -ba postfix.spec
# cd /usr/src/redhat/RPMS/i386/
# rpm -ivh postfix-2.3.3-2.i386.rpm
# cd /etc/postfix/
# vi main.cf
#=====================BASE=========================
myhostname = mail.vvmit.com
mydomain = vvmit.com
myorigin = $mydomain
mydestination = $myhostname localhost localhost.$mydomain
mynetworks = 127.0.0.0/8
inet_interfaces = all
#=====================Vritual Mailbox settings=========================
virtual_minimum_uid = 88
virtual_mailbox_base = /var/spool/mail
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_uid_maps = static:89
virtual_gid_maps = static:89
virtual_transport = virtual
maildrop_destination_recipient_limit = 10000
maildrop_destination_concurrency_limit = 50000
#====================QUOTA========================
message_size_limit = 52428800
mailbox_size_limit = 209715200
virtual_mailbox_limit = 209715200
virtual_create_maildirsize = yes
virtual_mailbox_extended = yes
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_maildir_limit_message = Sorry, the user's maildir has overdrawn his diskspace quota, please try again later.
virtual_overquota_bounce = yes
#====================SASL========================
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_mynetworks,permit_sasl_authenticated,reject_invalid_hostname,reject_non_fqdn_hostname,reject_unknown_sender_domain,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unknown_recipient_domain,reject_unauth_pipelining,reject_unauth_destination,permit
smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = /var/run/dovecot/auth-client
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_sasl_application_name = smtpd
smtpd_banner=$myhostname ESMTP "Version not Available"
readme_directory = no
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
html_directory = no
setgid_group = postdrop
command_directory = /usr/sbin
manpage_directory = /usr/local/man
daemon_directory = /usr/libexec/postfix
newaliases_path = /usr/bin/newaliases
mailq_path = /usr/bin/mailq
queue_directory = /var/spool/postfix
mail_owner = postfix

# vi mysql_virtual_alias_maps.cf
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = alias
select_field = goto
where_field = address
additional_conditions = AND active = '1'

# vi mysql_virtual_domains_maps.cf
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = domain
select_field = description
where_field = domain
additional_conditions = AND active = '1'

# vi mysql_virtual_mailbox_limit_maps.cf
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = mailbox
select_field = quota
where_field = username
additional_conditions = AND active = '1'

# vi mysql_virtual_mailbox_maps.cf
user = extmail
password = extmail
hosts = localhost
dbname = extmail
table = mailbox
select_field = maildir
where_field = username
additional_conditions = AND active = '1'

# chkconfig postfix on
# chkconfig sendmail off
# /etc/rc.d/init.d/sendmail stop
# /etc/rc.d/init.d/postfix start

2. 配置Dovecot
# vi /etc/dovecot.conf
driver = mysql
connect = host=/var/lib/mysql/mysql.sock dbname=extmail user=extmail password=extmail
default_pass_scheme = MD5
password_query = SELECT password FROM mailbox WHERE username = '%u'
user_query = SELECT maildir, 89 AS uid, 89 AS gid FROM mailbox WHERE username = '%u'

# vi /etc/dovecot-mysql.conf
base_dir=/var/run/dovecot
protocols=imap pop3
listen=*
disable_plaintext_auth = no
ssl_disable = yes
mail_location = maildir:/var/spool/mail/%d/%n/Maildir
auth default {
        mechanisms = PLAIN LOGIN CRAM-MD5 DIGEST-MD5
        passdb sql {
                args = /etc/dovecot-mysql.conf
        }
        userdb sql {
                args = /etc/dovecot-mysql.conf
        }
        socket listen {
                client {
                        path = /var/run/dovecot/auth-client
                        mode = 0660
                        user = postfix
                        group = postfix
                }
        }
}
first_valid_uid = 89
# chkconfig dovecot on
# /etc/rc.d/init.d/dovecot start

3. 安裝配置Extmail和Extman
1)安裝配置Extmail
# tar -zvxf extmail-1\\.0.4.tar.gz
# mv extmail-1.0.4/ /var/www/cgi-bin/extmail
# cd /var/www/cgi-bin/extmail/
# cp webmail.cf.default webmail.cf
# vi webmail.cf
SYS_CONFIG = /var/www/extsuite/extmail/
修改為SYS_CONFIG = /var/www/cgi-bin/extmail/

SYS_LANGDIR = /var/www/extsuite/extmail/lang
修改為SYS_LANGDIR = /var/www/cgi-bin/extmail/lang

SYS_TEMPLDIR = /var/www/extsuite/extmail/html
修改為SYS_TEMPLDIR = /var/www/cgi-bin/extmail/html

SYS_SESS_DIR = /tmp/
修改為SYS_SESS_DIR = /tmp/extmail
#需要手工創建並賦予許可權

SYS_USER_LANG = en_US修改為SYS_USER_LANG = zh_CN

SYS_USER_CHARSET = utf-8修改為SYS_USER_CHARSET = gb2312

SYS_MAILDIR_BASE = /home/domains
修改為SYS_MAILDIR_BASE = /var/spool/mail

SYS_MYSQL_USER = db_user修改為SYS_MYSQL_USER = extmail

SYS_MYSQL_PASS = db_pass修改為SYS_MYSQL_PASS = extmail

SYS_MYSQL_ATTR_NDQUOTA = netdiskquota修改為SYS_MYSQL_ATTR_NDQUOTA = quota

SYS_G_ABOOK_FILE_PATH = /var/www/extsuite/extmail/globabook.cf
修改為SYS_G_ABOOK_FILE_PATH = /var/www/cgi-bin/extmail/globabook.cf

SYS_G_ABOOK_FILE_CHARSET = utf-8修改為SYS_G_ABOOK_FILE_CHARSET = gb2312
# chown -R postfix:postfix cgi/
# mkdir /tmp/extmail
# chown -R postfix.postfix /tmp/extmail/
# rpm -ivh perl-Unix-Syslog-1.0-1.el5.rf.i386.rpm
#需要Perl-Unix-Syslog的支持

2)安裝配置Extman
# tar -zvxf extman-0\\.2.4.tar.gz
# mv extman-0.2.4/ /var/www/cgi-bin/extman
# cd /var/www/cgi-bin/extman/
# vi webman.cf
SYS_CONFIG = /var/www/extsuite/extman/修改為SYS_CONFIG = /var/www/cgi-bin/extman/

SYS_LANGDIR = /var/www/extsuite/extman/lang
修改為SYS_LANGDIR = /var/www/cgi-bin/extman/lang

SYS_TEMPLDIR = /var/www/extsuite/extman/html
修改為SYS_TEMPLDIR = /var/www/cgi-bin/extman/html

SYS_MAILDIR_BASE = /home/domains修改為SYS_MAILDIR_BASE = /var/spool/mail

添加SYS_LANG = zh_CN
SYS_CHARSET = gb2312

SYS_MYSQL_USER = webman修改為SYS_MYSQL_USER = extmail

SYS_MYSQL_PASS = webman修改為SYS_MYSQL_PASS = extmail

# chown -R postfix.postfix cgi/
# mkdir /tmp/extman
# chown -R postfix.postfix /tmp/extman
# rpm -ivh perl-GD-2.35-1.el5.rf.i386.rpm

4. 配置apache
# vi /etc/httpd/conf/httpd.conf
User postfix
Group postfix
NameVirtualHost *:80
<VirtualHost *:80>
ServerName mail.benet.com
DocumentRoot /var/www/cgi-bin/
ScriptAlias /extmail/cgi/ /var/www/cgi-bin/extmail/cgi/
Alias /extmail/ /var/www/cgi-bin/extmail/html/
ScriptAlias /extman/cgi/ /var/www/cgi-bin/extman/cgi/
Alias /extman/ /var/www/cgi-bin/extman/html/
</VirtualHost>
# chkconfig httpd on
# /etc/rc.d/init.d/httpd start
訪問http://192.168.1.200/extmail和http://192.168.1.200/extman

5. 配置MySQL
# chkconfig mysqld on
# /etc/rc.d/init.d/mysqld start
# mysqladmin -u root password 123456
# mysql -u root -p
Enter password:
# mysql -u root -p < /var/www/cgi-bin/extman/docs/extmail.sql
Enter password:
# mysql -u root -p < /var/www/cgi-bin/extman/docs/init.sql
Enter password:
# /etc/rc.d/init.d/mysqld restart
# mysql -u extmail -p

6. 測試
登陸http://192.168.1.200/extman,賬號是root@extmail.org(不能修改),密碼是extmail*123*。
添加域benet.com;   
提示:extmail@localhost沒有許可權;
# mysql –u root -p
mysql> grant all privileges on *.* to 'extmail'@'localhost' identified by 'extmail' with grant option;
再次添加benet.com域,提示成功添加;
在benet.com域添加用戶hushan和chenwei;

打開網站http://192.168.1.200/extmail,使用用戶hushan登陸

[ 本帖最後由 mitmax 於 2009-5-31 22:20 編輯 ]
《解決方案》

支持下。
《解決方案》

回復 #1 mitmax 的帖子

呵呵  不錯哦
《解決方案》

回復 #1 mitmax 的帖子

相對iredmail 也是可以
比較的實用的
建議還是對一些安全參數做好設置
《解決方案》

請教:extmail安裝遇到問題

在下cent6下裝extmail,參考了文檔:http://wiki.extmail.org/%E7%8E%9 ... %8E%E5%8F%B0-extman

執行到下邊,報錯:

# mysql -u root -p < /var/www/extsuite/extman/docs/extmail.sql #說已經存在,

# mysql -u root -p < /var/www/extsuite/extman/docs/init.sql #
ERROR 1062 (23000) at line 5: Duplicate entry 'support@extmail.org' for key 'PRIMARY'

然後沒管,繼續執行,到下邊,報錯

shell

# /usr/sbin/authtest -s login postmaster@extmail.org extmail

實際結果:
# cd /var/www/extsuite/extman/tools
# ./maildirmake.pl /home/domains/extmail.org/postmaster/Maildir
# chown -R vuser:vgroup /home/domains/extmail.org
# /usr/sbin/authtest -s login postmaster@extmail.org extmail
Authentication FAILED: Operation not permitted
參考如下:http://sinykk.iteye.com/blog/1030270,知道從哪看日誌了,
查看了日誌:cat /var/log/maillog
查到:libauthpgsql.so: cannot open shared object file: No such file,
但在網上搜索沒發現解決辦法。
《解決方案》

好東西 收藏了 。。。。

[火星人 ] 搭建基於Extman與Extmail的Postfix郵件伺服器已經有693次圍觀

http://coctec.com/docs/service/show-post-11747.html