postfix:
1.access clinet add to mail.cf
smtpd_client_restrictions = check_client_access hash:/etc/postfix/access
2.access sender add to mail.cf
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender
cat sender
tom@example.com reject
postmap sender
3.access to add to mail.cf
smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/recipient, permit_mynetwork
s, reject_unauth_destination
cat recipient
jack@example.com REJECT
postmap recipient
4.address rewrite
smtp_generic_maps = hash:/etc/postfix/generic
cat generic
pei@example.com lvpei@163.com
postmap generic
5.smtp sasl
smtpd_client_restrictions = check_client_access hash:/etc/postfix/ access,permit_sasl_aut
henticated
smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender
smtpd_recipient_restrictions = check_sender_access hash:/etc/postfix/recipient, permit_mynetwork
s,permit_sasl_authenticated, reject_unauth_destination
smtp_generic_maps = hash:/etc/postfix/generic
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
6.postfix support mysql
yum install mysql mysql-devel mysql-server gcc db*-devel
tar
make -f Makefile.init makefiles 'CCARGS=-DHAS_MYSQL -I/usr/include/mysql/' 'AUXLIBS=-L/usr
/lib/mysql/ -lmysqlclient -lz -lm'
make upgrade
useradd virtual -s /sbin/nologin
postconf -e 'virtual_alias_domains = mysql:/etc/postfix/mysql_alias.cf
postconf -e 'virtual_uid_maps = static:504'
postconf -e 'virtual_gid_maps = static:504'
postconf -e 'virtual_mailbox_base = /home/virtual'
' postconf -e 'virtual_alias_domains = mysql:/etc/postfix/mysql_alias.cf'
postconf -e 'virtual_mailbox_domains = mysql:/etc/postfix/mysql_domains.cf'
postconf -e 'virtual_mailbox_maps = mysql:/etc/postfix/mysql_mailboxs.cf'
touch /etc/postfix/mysql_alias.cf /etc/postfix/mysql_domains.cf /etc/postfix/mysql_mailboxs.cf
cat /etc/postfix/mysql_alias.cf
host = localhost
user = postfix
password = postfix
dbname = postfix
table = mail
select_field = username
where_field = username
7.dovecot support mysql storage users
211 mail_location = maildir:/home/virtual/%d/%n/ (line 211)
869 passdb sql {
870 # Path for SQL configuration file, see doc/dovecot-sql-example.conf
871 args = dovecot-sql.conf
872 }
930 userdb sql {
931 # Path for SQL configuration file, see doc/dovecot-sql-example.conf
932 args = dovecot-sql.conf
933 }
8 vi /etc/dovecot-sql.cf
28 driver = mysql
54 connect = host=localhost dbname=postfix user=postfix password=postfix
91 password_query = SELECT username as user, password FROM mail WHERE usern ame =
'%u'
109 user_query = SELECT maildir, 504 AS uid, 504 AS gid FROM mail WHERE user name = '%
u'
INFRO MYSQL: mysql> grant all on postfix.mail to postfix@"%" identified by 'postfix';
mysql -u postfix -p -h localhost
mysql> select * from postfix.mail;
+---------------+----------+----------+----------------+
| username | password | domain | maildir |
+---------------+----------+----------+----------------+
| zhou@yema.com | 123 | yema.com | yema.com/zhou/ |
+---------------+----------+----------+----------------+
Bhanv 2010.7.16