POSTFIX+MYSQL-12110289
##1westos.westos.com端:
yum install mysql httpd php php-mysql -y
# ls
phpMyAdmin-3.4.0-all-languages.tar.bz2
# tar -jxf phpMyAdmin-3.4.0-all-languages.tar.bz2
# mv phpMyAdmin-3.4.0-all-languages admin
# rm -fr phpMyAdmin-3.4.0-all-languages.tar.bz2
# ls
admin
# cd admin/
# cp -p config.sample.inc.php config.inc.php
# vim config.inc.php
17 $cfg['blowfish_secret'] = 'westos';
# systemctl restart httpd
linux.linux.com端:
vim /etc/hosts
172.25.99.200 linux.linux.com linux.com
# firefox
##2.
westos.westos.com端:
# mysql -uroot -predhat
MariaDB [(none)]> CREATE USER postfix@localhost> 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)
测试:
# mysql -upostfix -ppostfix
Welcome to the MariaDB monitor.Commands end with ; or \g.
Your MariaDB connection> 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
##登陆成功表示操作正确
# cd /etc/postfix/
# vim mysql-users.cf
hosts = localhost
user = postfix
password = postfix
dbname = email
table = muser
select_field = username
where_field = username
# postmap -q "admin@westos.org" mysql:/etc/postfix/mysql-users.cf
admin@westos.org
# postmap -q "lee@westos.org" mysql:/etc/postfix/mysql-users.cf
lee@westos.org
# vim mysql-domain.cf
hosts = localhost
user = postfix
password = postfix
dbname = email
table = muser
select_field = domain
where_field = domain
# postmap -q "westos.org" mysql:/etc/postfix/mysql-domain.cf
westos.org,westos.org
# vim mysql-maildir.cf
hosts = localhost
user = postfix
password = postfix
dbname = email
table = muser
select_field = maildir
where_field = username
# postmap -q "admin@westos.org" mysql:/etc/postfix/mysql-maildir.cf
/home/vmail/westos.org/admin/
# groupadd vmail -g 666
# useradd -u 666 -g 666 vmail -s /sbin/nologin
# postconf -e "virtual_gid_maps = static:666"
# postconf -e "virtual_uid_maps = static:666"
# postconf -e "virtual_alias_maps = mysql:/etc/postfix/mysql-users.cf"
# postconf -e "virtual_alias_domains = mysql:/etc/postfix/mysql-domain.cf"
# 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端:
# vim 10-auth.conf
123 !include auth-sql.conf.ext
# cp /usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext .
# 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'
# vim 10-mail.conf
29 mail_location = maildir:/vmail/%d/%n
169 first_valid_uid = 666
176 first_valid_gid = 666
# yum install dovecot-mysql.x86_64 -y
# systemctl restart dovecot.service
页:
[1]