13. Configure Dovecot to complete receiving user verification by accessing MySQL
The dovecot itself is supported by the MySQL authentication method, which provides a configuration file named Auth-sql.conf.ext under/etc/dovecot/conf:
[[email protected] ~]# cd/etc/dovecot/conf.d/[[email protected] conf.d]# ls auth-master.conf.ext auth-master.conf.ext
Dovecot The default use of the recipient authentication method is the System account password authentication, so the file is not loaded by default, so to edit the/etc/dovecot/conf/10-auth.conf file:
[Email protected] conf.d]# vi 10-auth.conf #!include auth-system.conf.ext #注释该行!include auth-sql.conf.ext #启用该行
The above modification indicates that the System account password verification configuration file will no longer be loaded and the MySQL certified configuration file is loaded, so the Auth-sql.conf.ext file is configured:
[[Email protected] conf.d]# VI auth-sql.conf.extpassdb {driver = SQL #sql驱动 # Path for SQL configuration fil E, see example-config/dovecot-sql.conf.ext args =/etc/dovecot/dovecot-sql.conf #详细配置文件}userdb {driver = sql #sql驱动 args =/etc/dovecot/dovecot-sql.conf #详细配置文件}
Create the dovecot-sql.conf file under/etc/dovecot and add the following:
[Email protected] dovecot]# vi dovecot-sql.confdriver = mysql #驱动connect = host=localhost dbname=extmail user=extmail Password=extmaildefault_pass_scheme = Cryptpassword_query = SELECT username as user,password as password from mailbox wher E username = '%u ' user_query = SELECT maildir,uidnumber as uid,gidnumber as GID from mailbox WHERE username = '%u '
Note: The contents of the Passdb and UserDB driver configuration of the Auth-sql.conf.ext file are different from dovecot-sql.conf driver, one for SQL and one for MySQL (I don't know why, is it a fixed format?). )
If you restart Dovecot, the following error message is found in/var/log/maillog: Unknown passdb driver ' mysql ', please install Dovecot-mysql package.
14. Configuring Extmail and Extman
Extmail provides a configuration file named WEBMAIL.CF that can be modified for its program content and access to MySQL, editing/var/www/extsuite/extmail/webmail.cf:
[[email protected] ~]# Cd/var/www/extsuite/extmail/[[email protected] extmail]# CP webmail.cf webmail.cf.default[[ Email protected] extmail]# VI Webmail.cfsys_user_lang = ZH_CN #修改默认语言SYS_MAILDIR_BASE =/mailbox #修改maildir路径SYS_MYS Ql_user = Extmail #访问mysql的用户, consistent with Extmail library Sys_mysql_pass = Extmail
The configuration name provided by Extman is called WEBMAN.CF, and the/VAR/WWW/EXTSUITE/EXTMAIL/WEBMAN.CF is edited:
[Email protected] extmail]# CD. [[Email protected] extsuite]# CD Extman/[[email protected] extman]# CP webman.cf Webman.cf.default[[email protected] Extm an]# VI webman.cfsys_maildir_base =/mailboxsys_captcha_on = 0 #不使用验证码验证登录SYS_DEFAULT_UID = 2525 #运行该程序的用户UID, should be post Fix uidsys_default_gid = 2525 #运行该程序的用户GID, should be postfix gidsys_mysql_user = Extmailsys_mysql_pass = Extmail
Create the/tmp/extman directory and modify the genus Master Group to Postfix:
[Email protected] ~]# mkdir/tmp/extman[[email protected] ~]# chown Postfix.postfix/tmp/extman
15. Deploying Extmail and Extman
So far, Postfix has been configured to support virtual users, Courier-authlib and CRYUS-SASL have also been configured to call each other, while supporting access to MySQL for virtual user authentication, Dovecot can also access the MySQL database for virtual user receipt verification, webmail also complete the configuration, so now as long as the Extmail and Extman deployed, and through the Extman provided by the Web management interface to create virtual users and virtual domain, You can test the entire messaging system!
The Apache server was previously installed (see section 8th), and the Web application for Extmail and Extman was moved to the Apache server under the Default Web application publishing path (see section 9th), because the service that sent and received the mail was run by the postfix user. Therefore, modify the owner and/var/www/extsuite of these two Web application file parent directories to Postfix:
[Email protected] ~]# chown-r postfix.postfix/var/www/extsuite/
Configure Apache server configuration file/etc/httpd/conf/httpd.conf:
[Email protected] ~]# vi/etc/httpd/conf/httpd.conf <virtualhost *:80> #开启虚拟主机 documentroot/var/www/extsuite /extmail/html/servername mail.ahltnew.com #与系统主机名一致 scriptalias/extmail/cgi/var/www/extsuite/extmail/cgi Al ias/extmail/var/www/extsuite/extmail/html scriptalias/extman/cgi/var/www/extsuite/extman/cgi alias/extman/var/ www/extsuite/extman/html suexecusergroup postfix postfix #表示切换成postfix用户和postfix组来运行该Web程序 </VirtualHost>
16. Restart all related services
At this point, all the configurations have been completed and the following services are restarted:
[Email protected] ~]# service postfix restart #postfix [[email protected] ~]# service cyrus-authlib Restart #cyrus-A Uthlib[[email protected] ~]# service SASLAUTHD restart #cyrus-sasl[[email protected] ~]# service Dovecot Restart #do Vecot[[email protected] ~]# service httpd restart #apache server
At this point, the mailbox system setup basically ended.
Note: The logs during the Postfix,cyrus-authlib,cyrus-sasl,dovecot run can be viewed through/var/log/maillog, and the Apache server logs are/var/log/httpd/ Error_log for viewing.
Visit http://host Ip/extmail to log in to Extmail, if the page prompts Unix::syslog not found, install the Perl-unix-syslog package.
[email protected] ~]# Yum install Perl-unix-syslog
In order to access security, you can only assign the permissions of select to MySQL extmail users, create a new Extmail library for users to modify MySQL, and modify webman.cf Sys_mysql_user and Sys_mysql_ Pass configuration item content is the user's information, that is, can achieve webmail access and management of the separation of permissions.
Mail system Server Setup record (v) (postfix+cyrus-sasl+courier-authlib+dovecot+extmail+mysql)