马哥linux高薪中级-POSTFIX邮件服务
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了马哥linux高薪中级-POSTFIX邮件服务相关的知识,希望对你有一定的参考价值。
五、邮件服务器的虚拟域
简介
虚拟域功能类似于httpd的虚拟主机服务,同样支持一台物理主机服务器创建和支持多个虚拟域名,并为其提供邮件服务,实现此功能需要涉及到mydestination、mydomain、myorigin几个参数。
当一台服务器运行多个虚拟域的情况下,势必会给查询带来负担,这样就需要一个快速的检索数据库,常用的有hash、ladp、mysql等,hash我们在前面已经讲过了,就是通过postmap来生成需要的索引文件*.db。确定是不灵活,当账户信息文件需要经常变化的时候,就需要手动多次生成索引文件
courier-authlib是Courier组件中的认证库,它是courier组件中一个独立的子项目,用于为Courier的其它组件提供认证服务。其认证功能通常包括验正登录时的帐号和密码、获取一个帐号相关的家目录或邮件目录等信息、改变帐号的密码等。而其认证的实现方式也包括基于PAM通过/etc/passwd和/etc/shadow进行认证,基于GDBM或DB进行认证,基于LDAP/MySQL/PostgreSQL进行认证等。因此,courier-authlib也常用来与courier之外的其它邮件组件(如postfix)整合为其提供认证服务。
安装courier-authlib
1、下载courier-authlib-0.67.0.tar.gz,解压缩并进入courier目录
[[email protected] ~]# tar xf courier-authlib-0.67.0.tar.bz2
[[email protected] ~]# ls
anaconda-ks.cfg courier-authlib-0.67.0 courier-authlib-0.67.0.tar.bz2 install.log install.log.syslog Mail Maildir main.cf sent
[[email protected] ~]# cd courier-authlib-0.67.0
[[email protected] courier-authlib-0.67.0]# ls
aclocal.m4 auth_getoption.html auth_mkhomedir.html authpgsqllib.cpp auth_sasl_ex.3 authuserdbpwd.c courier-authlib.lpspec.in libs README.authdebug.html.in
authconfigfile.cpp auth_getuserinfo.3 authmksock.c authpgsqlrc authsaslfrombase64.c authwait.h courier-authlib.service.in ltmain.sh README_authlib.html.in
authconfigfile.h auth_getuserinfo.html authmoduser2.c authpipe.c auth_sasl.html ChangeLog courier-authlib.spec Makefile.am README.authmysql.html
authcustom.c auth.h authmoduser3.c authpipelib.c authsasllogin.c checkpassword.c courier-authlib.spec.in Makefile.in README.authmysql.myownquery
authcustom.h authinfo.c authmysql.cpp authpipelib.h authsaslplain.c checkpasswordmd5.c courier-authlib.sysvinit.in missing README.authpostgres.html
authdaemon.c authldap.c authmysql.h authpwd.c authsasltobase64.c checkpasswordsha1.c courierauthsaslclient.h NEWS README.authsqlite.html
authdaemond.c authldapescape.c authmysqllib.cpp authpwdenumerate.c authshadow.c compile courierauthsasl.h NEWS.html README.html
authdaemondcpp.cpp authldap.h authmysqlrc auth_sasl.3 authsqlite.cpp config.guess courierauthstaticlist.h pgpkeys.txt README.ldap
authdaemond.in authldap.ldif authoption.c authsasl.c authsqlite.h config.sub cramlib.c preauthcustom.c samplepipe.pl
authdaemonlib.c authldaplib.cpp AUTHORS authsaslclient.c authsqlitelib.cpp configure cryptpassword.c preauthdaemon.c sysconftool
authdaemonrc.in authldaprc authpam.c authsaslclientcram.c authsqliterc configure.ac dbobj.config.in preauthldap.c userdb
authdaemontest.c authldap.schema authpasswd.1 authsaslclientcrammd5.c authsyschangepwd.c COPYING dbobj.h.in preauthmysql.cpp userdb-test-cram-md5.pl.in
auth_enumerate.3 authlib.3.in auth_passwd.3 authsaslclientcramsha1.c authsyscommon.c COPYING.GPL debug.c preauthpam.c
authenumerate.c authlib.html.in authpasswd.c authsaslclientexternal.c authsystem.passwd.in courier_auth_config.h depcomp preauthpwd.c
auth_enumerate.html auth_login.3 auth_passwd.html authsaslclient.h authtest.1 courier_auth_config.h.in INSTALL preauthshadow.c
auth_generic.3 auth_login.html authpasswd.html authsaslclientlogin.c authtest.c courierauthdebug.h INSTALL.html preauthuserdb.c
auth_generic.html authmigrate.in authpgsql.c authsaslclientplain.c authtest.html courierauth.h install-sh preauthuserdbcommon.c
auth_getoption.3 auth_mkhomedir.3 authpgsql.h authsaslcram.c authuserdb.c courier-authlib.lpspec liblog README
2、编译安装courier-authlib
依赖环境:
A modern version of gcc (http://www.gnu.org/software/gcc/)
The GNU linker (http://www.gnu.org/software/binutils/)
Libtool (http://www.gnu.org/software/libtool/). Additional, libtool‘s libltdl library, and its development files, must be installed. On some platforms this is a separate package. On Fedora, this is the libtool-ltdl-devel package, for example.
GNU make (http://www.gnu.org/software/make/)
The "
expect
" command.expect
is usually included with most systems.Expect
can be downloaded fromhttp://expect.nist.gov/
if it‘s not installed on your system. This utility is used to change system login passwords, by scripting thepasswd
command. If you do not haveexpect
installed you will not be able to change system login passwords. However non-system authentication modules (LDAP, PostgreSQL, and others) will work.Courier Unicode Library. Before installing Courier-IMAP, download and install http://www.courier-mta.org/unicode/.
编译相关选项:根据具体情况选择。
--prefix=/usr/local/courier-authlib
--sysconfdir=/etc
--without-authpam 不支持基于pam认证
--without-authshadow 不支持基于shadow认证
--without-authvchkpw 不支持基于vchkpw认证
--without-authpgsql 不支持基于pgsql认证
--without-authsqlite 不支持基于sqlitle认证
--with-authmysql 基于mysql认证
--with-mysql-libs=/usr/lib/mysql 指定mysql库文件路径
--with-mysql-includes=/usr/include/mysql 指定mysql头文件路径
--with-redhat 对redhat系统进行自动优化,其他系统不要使用此选项。
--with-authmysqlrc=/etc/authmysqlrc 指定mysqlrc配置文件位置
--with-authdaemonrc=/etc/authdaemonrc 指定守护进程配置文件位置
--with-mailuser=postfix 指定邮件收发管理用户
--with-mailgroup=postfix 指定用户组
--with-ltdl-lib=/usr/lib 指定ltdl库位置,需要libtool-ltdl和libtool-ltdl-devel包
--with-ltdl-include=/usr/include 指定ltdl头文件位置。需要libtool-ltdl和libtool-ltdl-devel包
--with-authdaemonvar=/var/spool/authdaemon 指定套接字socket文件位置。不指定默认在/usr/local/courier-authlib/var/spool/authdaemon下
注意:我这里安装的0.67版本,此软件包需要expect、Courier Unicode Library 1.2软件包,我这里下载的是expect5.4,而expect又需要tcl软件包,我这里yum安装的tcl和tcl-devel。
编译安装courier-unicode,依赖于pcre软件包,而pcre最新版又依赖其他包,所以都要一并装上。并且安装过程中需要使用普通用户,如果使用root安装会有以下错误提示:
编译中间错误提示
configure: WARNING: === Do not compile Courier as root. Compile
configure: WARNING: === Courier as a non-root user then su to
configure: WARNING: === root before running make install. You must now
configure: WARNING: === remove this entire directory and then extract the
configure: WARNING: === source code from the tarball as a non-root user
configure: WARNING: === and rerun the configure script. If you have read
configure: WARNING: === the INSTALL file you should have known this. So
configure: WARNING: === you better read INSTALL again
configure: error: aborted.
error: Bad exit status from /var/tmp/rpm-tmp.77978 (%prep)
RPM build errors:
Bad exit status from /var/tmp/rpm-tmp.77978 (%prep)
提示我们不要用root 编译
我们新建个用户,然后加入编译目录的权限
[[email protected] ~]# ls
anaconda-ks.cfg autoconf-latest.tar.xz automake-1.15.tar.xz courier-0.76.4.20170218.tar.bz2 courier-authlib-0.67.0.tar.bz2 courier-unicode-1.4.tar.bz2 expect5.45.tar install.log.syslog libtool-2.4.tar.xz Maildir pcre2-10.23
autoconf-2.69 automake-1.15 courier-0.76.4.20170218 courier-authlib-0.67.0 courier-unicode-1.4 expect5.45 install.log libtool-2.4 Mail main.cf sent
安装依赖包,有些可能需要编译安装,因为yum安装的版本和编译安装之间由于时间问题,可能不兼容。
[[email protected] courier-authlib-0.67.0]# yum -y install libtool-ltdl libtool-ltdl-devel expect perl-DBD-MySQL tcl tcl-devel libart_lgpl libart_lgpl-devel libtool-ltdl libtool-ltdl-devel
编译安装courier-authlib
[[email protected] courier-authlib-0.67.0]# ./configure --prefix=/usr/local/courier-authlib --sysconfdir=/etc --without-authpam --without-authshadow --without-authvchkpw --without-authpgsql --without-authsqlite --with-authmysql --with-mysql-libs=/usr/lib/mysql --with-mysql-includes=/usr/include/mysql --with-redhat --with-authmysqlrc=/etc/authmysqlrc --with-authdaemonrc=/etc/authdaemonrc --with-mailuser=postfix --with-mailgroup=postfix --with-ltdl-lib=/usr/local/ltdl/lib/ --with-ltdl-include=/usr/local/ltdl/include/ --with-authdaemonvar=/var/spool/authdaemon/
&&make &&make install
3、修改文件权限及复制文件,这个和前面编译使用的参数定义配置文件是对应的
[[email protected] courier-authlib-0.67.0]# chmod -R 755 /var/spool/authdaemon/
[[email protected] courier-authlib-0.67.0]# ll /var/spool/authdaemon/ -d
drwxr-xr-x. 2 postfix postfix 4096 2月 28 16:10 /var/spool/authdaemon/
[[email protected] courier-authlib-0.67.0]# cp /etc/auth
authdaemonrc.dist authmysqlrc.dist
[[email protected] courier-authlib-0.67.0]# cp /etc/authdaemonrc.dist /etc/authdaemonrc
[[email protected] courier-authlib-0.67.0]# cp /etc/authmysqlrc.dist /etc/authmysqlrc
4、修改/etc/authdaemonrc文件
#authmodulelist="authuserdb authpwd authmysql authcustom authpipe"
authmodulelist="authmysql "
##NAME: authmodulelistorig:4
#
# This setting is used by Courier‘s webadmin module, and should be left
# alone
#authmodulelistorig="authuserdb authpwd authmysql authcustom authpipe"
authmodulelistorig="authmysql "
daemons=5 用于设置进程数
##NAME: authdaemonvar:2
#
# authdaemonvar is here, but is not used directly by authdaemond. It‘s
# used by various configuration and build scripts, so don‘t touch it!
authdaemonvar=/var/spool/authdaemon/ 可以手动设置socket位置。
5、修改/etc/authmysqlrc配置文件
MYSQL_SERVER = localhost localhost mysql服务器的地址。localhost表示本机
MYSQL_PORT = 3306 3306 mysql的监听地址
MYSQL_USERNAME =extmail extmail 指定连接mysql的账号。因为后边要用extmail进行管理,extmail安装后默认用户为extmail。并且在实际工作中建议修改,记得其他涉及此账户的都要修改。
MYSQL_PASSWORD = extmail extmail 指定账号的密码
MYSQL_SOCKET = /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock 指定mysql套接字位置。
MYSQL_DATABASE = extmail extmail 指定要使用的数据库,而不是数据库软件。这里使用extmail软件和它搭配使用,而涉及的数据库是extmail。
MYSQL_USER_TABLE = mailbox mailbox 指定存放用户数据所在的表,这个也是extmail自动生成的。
MYSQL_CRYPT_PWFIELD = password password 指定用户密码字段
MYSQL_UID_FIELD = 2525 ‘2525‘ 指定访问进程的uid,postfix的uid为2525。
MYSQL_GID_FIELD = 2525 ‘2525‘ 指定访问进程的gid。
MYSQL_LOGIN_FIELD = username username 指定用户账号字段,extmail自动生成。
MYSQL_HOME_FIELD =concat(‘/var/mailbox/‘,homedir) 指定用户家目录的位置。虚拟用户是没有家目录,所以和邮箱目录保持一致。contcat()是mysql的函数,作用是将括号内的内容连接起来。
MYSQL_NAME_FIELD = name 指定用户名称的字段
MYSQL_MAILDIR_FIELD = concat(‘/var/mailbox/‘,maildir) 指定用户邮箱目录的位置。
[[email protected] ~]# more /etc/authmysqlrc |grep -v ^$ |grep -v ^#
MYSQL_SERVER mail.dtedugongbing.com
MYSQL_USERNAME extmail
MYSQL_PASSWORD extmail
MYSQL_PORT 3306
MYSQL_OPT 0
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD 2525
MYSQL_GID_FIELD 2525
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD concat(‘/var/mailbox/‘,homedir)
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD concat(‘/var/mailbox/‘,maildir)
6、从源码包中复制执行脚本到init.d目录中。
[[email protected] ~]# cp /root/courier-authlib-0.67.0/courier-authlib.sysvinit /etc/init.d/courier-authlib
[[email protected] ~]# chkconfig add courier-authlib
[[email protected] ~]# chkconfig --add courier-authlib
[[email protected] ~]# chkconfig courier-authlib on
[[email protected] ~]# chkconfig --list courier-authlib
courier-authlib 0:关闭 1:关闭 2:启用 3:启用 4:启用 5:启用 6:关闭
[[email protected] ~]# chmod +x /etc/init.d/courier-authlib
[[email protected] ~]# service courier-authlib start
Starting Courier authentication services: authdaemond
[[email protected] ~]# ps aux |grep authlib
root 11993 0.0 0.0 4068 528 ? S 14:05 0:00 /usr/local/courier-authlib/sbin/courierlogger -pid=/var/spool/authdaemon//pid -start /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root 11994 0.0 0.0 73008 3012 ? S 14:05 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root 11995 0.0 0.0 73008 856 ? S 14:05 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root 11996 0.0 0.0 73008 856 ? S 14:05 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root 11997 0.0 0.0 73008 856 ? S 14:05 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root 11998 0.0 0.0 73008 856 ? S 14:05 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root 11999 0.0 0.0 73008 856 ? S 14:05 0:00 /usr/local/courier-authlib/libexec/courier-authlib/authdaemond
root 12001 0.0 0.0 103332 896 pts/0 S+ 14:05 0:00 grep authlib
7、为用户创建存储用户邮件的目录,按照上面的配置需要创建/var/mailbox/目录,这里需要特别说明一下要实现虚拟域和虚拟用户必须要采用maildir的邮件存储方式(main.cf中配置)
[[email protected] ~]# mkdir /var/mailbox/
[[email protected] ~]# chown -R postfix /var/mailbox/
[[email protected] ~]#
8、修改/var/lib/sasl2/smtp.cf文件。
[[email protected] ~]# vim /usr/lib64/sasl2/smtpd.conf
pwcheck_method:authdaemond
log_level:3
mech_list:plain login
authdaemond_path : /var/spool/authdaemon/socket
7、修改main.cf配置文件,实现虚拟机和虚拟账户功能。
########################Virtual Mailbox Settings########################
virtual_mailbox_base = /var/mailbox 指定用户邮件存放目录的路径
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf 用户邮箱的映射表,通过mysql方式访问指定文件行查找。该文件是查询语句的集合。
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf 虚拟域映射表,该文件由extmail提供。
virtual_alias_domains =
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf 别名映射表
virtual_uid_maps = static:2525
virtual_gid_maps = static:2525
virtual_transport = virtual 指定另一个投递代理MDA
##########################QUOTA Settings######################## 配额相关
message_size_limit = 14336000 邮件大小显示
virtual_mailbox_limit = 20971520 邮箱大小限制
注意:
1、启用虚拟域以后,需要取消中心域,就是注释掉myhostname、mydestination、mydomain、myornigin几个参数,也可以把mydestination的值改成自己需要的。
2、对于mysql5.1以后的版本,其中的服务脚本extmail.sql执行中会有语法错误。需要修改源码包中extmail.sql配置文件,修改后再执行。sed -i ’s/TYPE=ISAM/ENGINE=INNODB’ extmail.sql。
extmail程序下载并安装。
1、编译安装extmail
2、将源码包中的init.sql和extmail.sql文件导入到mysql数据库中。
[[email protected] docs]# service mysqld start
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password ‘new-password‘
/usr/bin/mysqladmin -u root -h mail.dtedugongbing.com password ‘new-password‘
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[ OK ]
Starting mysqld: [ OK ]
[[email protected] docs]#
[[email protected] docs]#
[[email protected] docs]#
[[email protected] docs]# mysql <extmail.sql 导入源码包中docs目录下的sql脚本文件extmail.sql和init.sql。
[[email protected] docs]# mysql <init.sql
[[email protected] docs]# mysql <extmail.sql
3、给extmail数据库授予extmail账户权限及设定密码。
mysql> GRANT ALL PRIVILEGES ON extmail.* TO [email protected] IDENTIFIED BY ‘extmail‘;
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON extmail.* TO [email protected] IDENTIFIED BY ‘extmail‘;
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges
Query OK, 0 rows affected (0.00 sec)
4、复制extmail中于mysql相关的配置文件到/etc/postfix/目录
[[email protected] docs]# cp mysql_virtual_* /etc/postfix/
[[email protected] docs]# ll /etc/postfix/mysql*
-rw-r--r--. 1 root root 166 3月 1 15:15 /etc/postfix/mysql_virtual_alias_maps.cf
-rw-r--r--. 1 root root 168 3月 1 15:15 /etc/postfix/mysql_virtual_domains_maps.cf
-rw-r--r--. 1 root root 170 3月 1 15:15 /etc/postfix/mysql_virtual_limit_maps.cf
-rw-r--r--. 1 root root 172 3月 1 15:15 /etc/postfix/mysql_virtual_mailbox_maps.cf
-rw-r--r--. 1 root root 173 3月 1 15:15 /etc/postfix/mysql_virtual_sender_maps.cf
[[email protected] docs]#
5、创建并修改配置文件dovecot.conf
mail_location = maildir:/var/mailbox/%d/%n/Maildir 设定邮件的位置,%d表示域名,%n表示用户名。均为dovecot的自定义宏。
auth default {
mechanisms = plain 认证机制使用plain
passdb sql { 使用sql方式认证
args = /etc/dovecot-mysql.conf 指定查询文件
}
userdb sql { 使用sql方式认证
args = /etc/dovecot-mysql.conf 指定查询文件
}
6、创建dovecot.conf中指定的mysql查询文件
driver = mysql
connect = host=localhost dbname=extmail user=extmail password=extmail
default_pass_scheme = CRYPT 默认加密方式
password_query = SELECT username AS user,password AS password FROM mailbox WHERE username = ‘%u‘
user_query = SELECT maildir, uidnumber AS uid, gidnumber AS gid FROM mailbox WHERE username = ‘%u‘
说明:如果mysql服务器是本地主机,即host=localhost时,如果mysql.sock文件不是默认的/var/lib/mysql/mysql.sock,可以使用host=“sock文件的路径”来指定新位置。例如使用通用二进制格式安装的mysql,其sock文件通常在/tmp/myql.sock,则connect对应的位置应该是:
connect = host=/tmp/mysql.sock dbname=extmail user=extmail password=extmail
7、修改/var/www/extsuite/extmail/webmail.cf配置文件:
[[email protected] ~]# more /var/www/extsuite/extmail/webmail.cf |grep -v ^# |grep -v ^$
SYS_CONFIG = /var/www/extsuite/extmail/
SYS_LANGDIR = /var/www/extsuite/extmail/lang
SYS_TEMPLDIR = /var/www/extsuite/extmail/html
SYS_HTTP_CACHE = 0
SYS_SMTP_HOST = 127.0.0.1
SYS_SMTP_PORT = 25
SYS_LOG_TYPE = syslog
SYS_LOG_FILE = /var/log/extmail.log
SYS_USER_LANG = zh_CN
SYS_MYSQL_PASS = extmail
SYS_MAILDIR_BASE = /var/mailbox
SYS_MYSQL_DB = extmail
SYS_MYSQL_HOST = localhost
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
SYS_MYSQL_TABLE = mailbox
SYS_MYSQL_ATTR_USERNAME = username
SYS_MYSQL_ATTR_DOMAIN = domain
SYS_MYSQL_ATTR_PASSWD = password
SYS_MYSQL_ATTR_CLEARPW = clearpwd
SYS_MYSQL_ATTR_QUOTA = quota
SYS_MYSQL_ATTR_NDQUOTA = netdiskquota
SYS_MYSQL_ATTR_HOME = homedir
SYS_MYSQL_ATTR_MAILDIR = maildir
SYS_MYSQL_ATTR_DISABLEWEBMAIL = disablewebmail
SYS_MYSQL_ATTR_DISABLENETDISK = disablenetdisk
SYS_MYSQL_ATTR_DISABLEPWDCHANGE = disablepwdchange
SYS_MYSQL_ATTR_ACTIVE = active
SYS_MYSQL_ATTR_PWD_QUESTION = question
SYS_MYSQL_ATTR_PWD_ANSWER = answer
SYS_AUTHLIB_SOCKET = /var/spool/authdaemon/socket
SYS_CONFIG 指定程序目录
SYS_LANGDIR 指定语言字符集的目录
SYS_TEMPLDIR 指定临时文件的目录
SYS_HTTP_CACHE http是否要缓存
SYS_SMTP_HOST 指定smtp服务器
SYS_SMTP_PORT smtp服务端口号
SYS_SMTP_TIMEOUT 指定超时时间
SYS_SPAM_REPORT_ON 发现垃圾邮件是否报告
SYS_USER_LANG 指定语言支持
SYS_MAILDIR_BASE 指定用户的邮筒文件夹
SYS_MYSQL_TABLE 指定在mysql中对应的表
SYS_MYSQL_ATTR_USERNAME 用户名对应的字段属性
SYS_MYSQL_ATTR_DOMAIN 域对应的字段属性
SYS_MYSQL_ATTR_PASSWD 用户密码对应的字段属性
SYS_AUTHLIB_SOCKET 指定courier-authlib socket文件位置HTTP相关配置
安装配置extman文件
拷贝extman解压缩目录到/var/www/extsuite/
[[email protected] ~]# mkdir /var/www/extsuite/extman
[[email protected] ~]# mv /root/extman-1.1/* /var/www/extsuite/extman/
编辑配置文件 /var/www/extsuite/extman/webman.cf
SYS_MAILDIR_BASE = /var/mailbox 这个是postfix配置文件main.conf中设置的邮件存储位置
SYS_SESS_DIR = /tmp/extman/ 临时会话存放位置,需要创建。而属主属组为httpd启动进程的用户和组,这里使用的是postfix。
SYS_CAPTCHA_ON = 0 关闭验证码功能
SYS_DEFAULT_UID = 2525 需要同创建的postfix账户的uid相同
SYS_DEFAULT_GID = 2525
SYS_MYSQL_USER = extman 指定登录mysql使用的用户名
SYS_MYSQL_PASS = extman
SYS_MYSQL_DB = extmail
SYS_MYSQL_HOST = localhost
SYS_MYSQL_SOCKET = /var/lib/mysql/mysql.sock
创建/tmp/extman目录,并更改属组、属主。
[[email protected] extman]# mkdir /tmp/extman/
[[email protected] extman]# chown postfix:postfix /tmp/extman/
创建extman账户及密码,并授权
mysql> GRANT ALL PRIVILEGES ON extman.* TO [email protected] IDENTIFIED BY "extman"
-> ;
Query OK, 0 rows affected (0.00 sec)
mysql> GRANT ALL PRIVILEGES ON extman.* TO [email protected] IDENTIFIED BY "extman";
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
修改extman目录下CGI目录权限。
[[email protected] extman]# chown -R postfix:postfix cgi/
httpd配置文件在虚拟主机配置段内添加以下信息。
Scriptalias /extman/cgi /var/www/extsuite/extman/cgi
Alias /extman /var/www/extsuite/extman/html
<VirtualHost *:8081>
ServerName mail.dtedugongbing.com
DocumentRoot /var/www/extsuite/extmail/html/
ScriptAlias /extmail/cgi /var/www/extsuite/extmail/cgi
Alias /extmail /var/www/extsuite/extmail/html/
CustomLog logs/mail.qupeiyin.net.log common
Scriptalias /extman/cgi /var/www/extsuite/extman/cgi
Alias /extman /var/www/extsuite/extman/html
</VirtualHost>
以上是关于马哥linux高薪中级-POSTFIX邮件服务的主要内容,如果未能解决你的问题,请参考以下文章