码迷,mamicode.com
首页 > 数据库 > 详细

POSTFIX+MYSQL

时间:2016-12-09 01:38:48      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:mysql

##1

westos.westos.com端:

    yum install mysql httpd php php-mysql -y

    [root@westos html]# ls

    phpMyAdmin-3.4.0-all-languages.tar.bz2

    [root@westos html]# tar -jxf phpMyAdmin-3.4.0-all-languages.tar.bz2

    [root@westos html]# mv phpMyAdmin-3.4.0-all-languages admin

    [root@westos html]# rm -fr phpMyAdmin-3.4.0-all-languages.tar.bz2

    [root@westos html]# ls

    admin

    [root@westos html]# cd admin/

    [root@westos admin]# cp -p config.sample.inc.php config.inc.php

    [root@westos admin]# vim config.inc.php

        17 $cfg[‘blowfish_secret‘] = ‘westos‘;

    [root@westos admin]# systemctl restart httpd

    

 

 

 

 

linux.linux.com端:

    vim /etc/hosts

        172.25.99.200 linux.linux.com linux.com

    [root@linux thunderbird]# firefox

    

技术分享

技术分享

技术分享

 

##2.

 

westos.westos.com端:

    [root@westos admin]# mysql -uroot -predhat

    MariaDB [(none)]> CREATE USER postfix@localhost identified by ‘postfix‘;

    Query OK, 0 rows affected (0.00 sec)

     

    MariaDB [(none)]> GRANT INSERT,UPDATE,SELECT on email.* to postfix@localhost;

    Query OK, 0 rows affected (0.00 sec)

     

 

 

测试:

[root@westos admin]# mysql -upostfix -ppostfix

Welcome to the MariaDB monitor.  Commands end with ; or \g.

Your MariaDB connection id is 31

Server version: 5.5.41-MariaDB MariaDB Server

 

Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.

 

Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.

 

MariaDB [(none)]> quit

Bye

##登陆成功表示操作正确

 

[root@westos admin]# cd /etc/postfix/

[root@westos postfix]# vim mysql-users.cf

    hosts = localhost

    user = postfix

    password = postfix

    dbname = email

    table = muser

    select_field = username

    where_field = username

 

[root@westos postfix]# postmap -q "admin@westos.org" mysql:/etc/postfix/mysql-users.cf

admin@westos.org

[root@westos postfix]# postmap -q "lee@westos.org" mysql:/etc/postfix/mysql-users.cf

lee@westos.org


 

[root@westos postfix]# vim mysql-domain.cf

    hosts = localhost

    user = postfix

    password = postfix

    dbname = email

    table = muser

    select_field = domain

    where_field = domain

[root@westos postfix]# postmap -q "westos.org" mysql:/etc/postfix/mysql-domain.cf

westos.org,westos.org

 

[root@westos postfix]# vim mysql-maildir.cf

    hosts = localhost

    user = postfix

    password = postfix

    dbname = email

    table = muser

    select_field = maildir

    where_field = username

[root@westos postfix]# postmap -q "admin@westos.org" mysql:/etc/postfix/mysql-maildir.cf

/home/vmail/westos.org/admin/

 

 

[root@westos postfix]# groupadd vmail -g 666

[root@westos postfix]# useradd -u 666 -g 666 vmail -s /sbin/nologin

[root@westos postfix]# postconf -e "virtual_gid_maps = static:666"

[root@westos postfix]# postconf -e "virtual_uid_maps = static:666"

[root@westos postfix]# postconf -e "virtual_alias_maps = mysql:/etc/postfix/mysql-users.cf"

[root@westos postfix]# postconf -e "virtual_alias_domains = mysql:/etc/postfix/mysql-domain.cf"

[root@westos postfix]# postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/mysql-maildir.cf"

 

 

 

测试:

mail admin@westos.org


cd /home/vmail/westos.org/admin/new/

技术分享

 

 

 

##3.



linux.linux.com端:

[root@linux conf.d]# vim 10-auth.conf

    123 !include auth-sql.conf.ext

[root@linux dovecot]# cp /usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext .

[root@linux dovecot]# vim dovecot-sql.conf.ext

    32 driver = mysql

    71 connect = host=localhost dbname=email user=postfix password=postfix

    78 default_pass_scheme = PLAIN

    107 password_query = \

    108   SELECT username, domain, password \

    109   FROM muser WHERE username = ‘%u‘ AND domain = ‘%d‘

    125 user_query = SELECT home, 666 AS uid, 666 AS gid FROM muser WHERE usernm=ame     = ‘%u‘

     

[root@linux conf.d]# vim 10-mail.conf

    29 mail_location = maildir:/vmail/%d/%n

    169 first_valid_uid = 666

    176 first_valid_gid = 666

[root@linux conf.d]# yum install dovecot-mysql.x86_64 -y

[root@linux conf.d]# systemctl restart dovecot.service


技术分享


本文出自 “12110289” 博客,谢绝转载!

POSTFIX+MYSQL

标签:mysql

原文地址:http://12120289.blog.51cto.com/12110289/1880738

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!