進階會員 | 【教學】Instalation HOWTO for postfix with MySQL / complete virtual user Instalation HOWTO for postfix with MySQL / complete virtual user system. Disclaimer: This HOWTO is based on the assumption that you have a good deal of knowledge of postfix and MySQL. Furthermore you need to read MYSQL.README (comes with the postfix distribution), and basicly everything else there is to read. This is a step by step HOWTO of how to setup a the virtual part of postfix. Postfix install: Unpack postfix. Do (inside the postfix directory): 1: make -f Makefile.init makefiles \ 'CCARGS=-DHAS_MYSQL -I/some/where/include/mysql' \ 'AUXLIBS=/some/where/lib/mysql/libmysqlclient.a -lm' 2: make && make install 3: cp the virtual bin from the virtual directory into the postfix source directory. ie: cp src/virtual/virtual /usr/libexec/postfix Replace the '/some/where/' with your system's path. Now setup postfix as you usually would, but almost all the mapping is done with mysql. main.cf: transport_maps = mysql:/etc/postfix/transport.cf virtual_maps = mysql:/etc/postfix/virtual_remote_aliases.cf virtual_mailbox_base = /data/mail virtual_uid_maps = mysql:/etc/postfix/virtual_ids.cf virtual_gid_maps = mysql:/etc/postfix/virtual_ids.cf virtual_mailbox_maps = mysql:/etc/postfix/virtual_aliases.cf Also remember that relay_domains needs to contain $transport_maps to lookup local virtual domains. alias_maps does not affect the virtual agent. Mysql Setup: Make a mysql user for postfix. I pt. have 5 tables in my system for postfix: mysql> show tables; +------------------------+ | Tables in mail_hosting | +------------------------+ | transport | | virtual_aliases | | virtual_ids | | virtual_remote_aliases | | virtual_users | +------------------------+ transport: mysql> desc transport; +-----------+-----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-----------+-----------+------+-----+---------+-------+ | domain | char(100) | YES | | NULL | | | transport | char(100) | YES | | NULL | | +-----------+-----------+------+-----+---------+-------+ This is needed so that postfix knows it is a virtual domain. Example: mysql> select * from transport; +----------------+-----------+ | domain | transport | +----------------+-----------+ | somedomain.dom | virtual: | +----------------+-----------+ virtual_aliases: mysql> desc virtual_aliases; +------------------+-----------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------------+-----------+------+-----+---------+----------------+ | email_alias | char(100) | YES | | NULL | | | local_mbox | char(100) | YES | | NULL | | +------------------+-----------+------+-----+---------+----------------+ This table is used to determine where the email's that are virtual is going. Example: mysql> select * from virtual_aliases; +---------------------------+---------------------+ | email_alias | local_mbox | +---------------------------+---------------------+ | [email protected] | somedomain.com/user | | [email protected] | somedomain.com/user | +---------------------------+---------------------+ These two are both going to the same mailbox, so the postmaster could be called an alias (or the user could be an alias, whatever). The path to local_mbox is relative to virtual_mailbox_base. virtual_ids: mysql> desc virtual_ids; +-------------+-----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-----------+------+-----+---------+-------+ | email_alias | char(100) | YES | | NULL | | | id | int(3) | YES | | NULL | | +-------------+-----------+------+-----+---------+-------+ This table is used to assign uid+gid to the mailbox per user. since my system only needs one id i simply point both virtual_uid_maps and virtual_gid_maps to the same id. Example: mysql> select * from virtual_ids; +---------------------------+------+ | email_alias | id | +---------------------------+------+ | [email protected] | 756 | | [email protected] | 756 | +---------------------------+------+ virtual_remote_aliases: mysql> desc virtual_remote_aliases; +-------------+-----------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------------+-----------+------+-----+---------+-------+ | email_alias | char(100) | YES | | NULL | | | remote_addr | char(100) | YES | | NULL | | +-------------+-----------+------+-----+---------+-------+ ... is used to forward mail to other domains. Example: mysql> select * from virtual_remote_aliases; +---------------------+-------------------------------+ | email_alias | remote_addr | +---------------------+-------------------------------+ | [email protected] | [email protected] | +---------------------+-------------------------------+ virtual_users: Well, thats that. Now, after doing this you want to monitor your logs, the permissions on the mailbox's, etc etc to see if everything works ok. if not, send me a mail and I'll probably make a FAQ sometime soon. Daniel V. Pedersen [email protected] pgp key: http://www.kummefryser.dk/daniel-gpg.key |
回覆 |
|
![]() | ||||
主題 | 主題作者 | 討論版 | 回覆 | 最後發表 |
[文件]The Complete FreeBSD | repsol | -- FreeBSD & Linux 討 論 版 | 0 | 2006-04-17 03:30 PM |
【求助】請教一個 mysql 的 user 權限問題 | b90220208 | ☉ -- 架 站 DIY 討 論 版 | 9 | 2005-06-08 12:11 AM |
【求助】postfix+mysql 做 virtual usrs+virtual domain 時 procmail 無法在virtual usrs 的帳號作用 | REN | -- FreeBSD & Linux 討 論 版 | 1 | 2005-05-09 04:47 PM |
請問 Nero 的 No seek complete 是什麼意思?如何解決? | TPBUNNY | -- 光 碟 燒 錄 討 論 版 | 2 | 2003-11-03 04:26 PM |
Default POP3 Virtual 及Default SMTP Virtual Server【求助】 | 地獄貓 | -- 網 路 技 術 版 | 0 | 2002-02-22 11:09 AM |
XML | RSS 2.0 | RSS |
本論壇所有文章僅代表留言者個人意見,並不代表本站之立場,討論區以「即時留言」方式運作,故無法完全監察所有即時留言,若您發現文章可能有異議,請 email :[email protected] 處理。