Differences

This shows you the differences between two versions of the page.

Link to this comparison view

postfixadddomain [2015/06/09 12:39] (current)
yassine chaouche created
Line 1: Line 1:
 +\\
 +[[index|Home]] > [[computers|computers]] > [[mail]] > [[postfix]] > [[PostfixAddDomain]] ​ | [[About]]
  
 +You must add the missing domain to your supported domains. First, find out how postfix knows about which domains it is responsible of. In my configuration,​ here is what I have in /​etc/​postfix/​main.cf
 +
 +<​code>​
 +virtual_mailbox_domains = proxy:​mysql:/​etc/​postfix/​mysql-virtual_domains.cf
 +</​code>​
 +
 +This means that I have virtual domains, and that the configuration is in a mysql database whose configuration is set in the file /​etc/​postfix/​mysql-virtual_domains.cf
 +
 +<​code>​
 +user = ispconfig
 +password = xxx
 +dbname = dbispconfig
 +table = mail_domain
 +select_field = domain
 +where_field = domain
 +additional_conditions = and active = '​y'​ and server_id = 1
 +hosts = 127.0.0.1
 +</​code>​
 +
 +That means that postfix needs to run the following query to know if it will deliver mail to any domain locally or not 
 +
 +<​code>​
 +select domain from dbispconfig.mail_domain where domain = '​%s'​ and active ='​y'​ and server_id='​1'​
 +</​code>​
 +
 +If you connect to your mysql database, you should already the default domains you're already using :
 +
 +<​code>​
 +mysql> select * from mail_domain;​
 ++-----------+------------+-------------+---------------+----------------+----------------+-----------+--------------------------+------+---------------+--------------+-------------+--------+
 +| domain_id | sys_userid | sys_groupid | sys_perm_user | sys_perm_group | sys_perm_other | server_id | domain ​                  | dkim | dkim_selector | dkim_private | dkim_public | active |
 ++-----------+------------+-------------+---------------+----------------+----------------+-----------+--------------------------+------+---------------+--------------+-------------+--------+
 +|         1 |          2 |           2 | riud          | ru             ​| ​               |         1 | algerian-radio.dz ​       | n    | default ​      ​| ​             |             | y      |
 +|         3 |          2 |           2 | riud          | ru             ​| ​               |         1 | radioalgerie.dz ​         | n    | default ​      ​| ​             |             | y      |
 ++-----------+------------+-------------+---------------+----------------+----------------+-----------+--------------------------+------+---------------+--------------+-------------+--------+
 +2 rows in set (0.00 sec)
 +
 +mysql> ​
 +</​code>​
 +
 +So what you need to do is simply add a row to that table. You can do so with a shell script if you want, I use shell scripts because they can be copied from one server to another (example from test server to production server), and can be called from other, more complex, scripts and be part of a larger operation. ​
 +
 +<​code>​
 +root@messagerie-secours[10.10.10.19] ~/​SCRIPTS/​MAIL # cat installbackupdomain
 +query="​INSERT INTO mail_domain (sys_userid,​sys_groupid,​sys_perm_user,​sys_perm_group,​server_id,​domain,​active) VALUES (2,​2,'​riud','​ru',​1,'​backup.algerian-radio.dz','​y'​);"​
 +mysql -ubackup -pxxx dbispconfig -e "​$query"​
 +root@messagerie-secours[10.10.10.19] ~/​SCRIPTS/​MAIL # 
 +</​code>​
 +
 +----
 +
 +contact : [[http://​twitter.com/​ychaouche|@ychaouche]] yacinechaouche at yahoocom

QR Code
QR Code postfixadddomain (generated for current page)