How to configure Postfix and Mailman to work with virtual domains and virtual hosts.
This document (3279773) is provided subject to the disclaimer at the end of this document.
Environment
Situation
Resolution
Check the base installation:
# /usr/lib/mailman/bin/check_perms –f
Enable mailman in apache2. Edit /etc/apache2/conf.d/mailman.conf and comment out (with a lead #) and
Add virtual users to manage the virtual hosts
# useradd vuser –u 1001
# groupadd vuser –g 1050
Edit /etc/postfix/main.cf
Change virtual_alias_maps = hash:/etc/postfix/virtual to
virtual_alias_maps = hash:/etc/postfix/virtual, hash:/var/lib/mailman/data/virtual-mailman
Add virtual_mailbox_domains = for each of the virtual domains (comma separated, and do not include the main/non-virtual hostname)
Add the following three lines:
virtual_uid_maps = static:1001
virtual_gid_maps = static:1050
virtual_mailbox_base = /var/spool/virtual_mailboxes
Comment out inet_interfaces = 127.0.0.1 ::1 so that the actual adapters will work.
Uncomment the recipient_delimiter = +
Assuming that the host is called main.dom.ain, and the virtual hosts are called second.dom.ain andthird.dom.ain, then the above edits would result in the following:
virtual_alias_maps = hash:/etc/postfix/virtual, hash:/var/lib/mailman/data/virtual-mailman
virtual_alias_domains = hash:/etc/postfix/virtual
virtual_mailbox_domains = second.dom.ain, third.dom.ain
virtual_uid_maps = static:1001
virtual_gid_maps = static:1050
virtual_mailbox_base = /var/spool/virtual_mailboxes
myhostname = main.dom.ain
# inet_interfaces = 127.0.0.1 ::1
recipient_delimiter = +
In /usr/lib/mailman/Mailman edit mm_cfg.py
For each virtual host, add a add_virtualhost() line.
Add POSTFIX_STYLE_VIRTUAL_DOMAINS = for each of the virtual domains
Again, assuming that the host is called main.dom.ain, and the virtual hosts are called second.dom.ain andthird.dom.ain, then the above edits would result in the following:
add_virtualhost('second.dom.ain', 'second.dom.ain')
add_virtualhost('third.dom.ain', 'third.dom.ain')
POSTFIX_STYLE_VIRTUAL_DOMAINS = 'second.dom.ain','third.dom.ain'
If you wanted the web page to be www.second.com.ain, then the add_virtual_host would look like add_virtualhost('www.second.dom.ain','second.dom.ain')
Check the permissions on /var/lib/mailman/aliases so that it is RWX for mailman:mailman
Run the following:
# /usr/lib/mailman/bin/genaliases
# postfix reload
# /usr/lib/mailman/bin/mailmanctl restart
# apache2ctl stop
# apache2ctl start
Lastly, but very critical, make sure that your virtual hosts have DNS A and MX records. If the virtual host is only CNAMEd to the main host, then you will have problems with the From:, To:, and/or Reply-To: fields in the e-mails.
For example, you should have:
main.dom.ain. 36000 IN A 10.1.2.3
main.dom.ain.36000 IN MX 10 main.dom.ain.
second.dom.ain. 36000 IN A 10.1.2.3
second.dom.ain.36000 IN MX 10 second.dom.ain.
and NOT:
main.dom.ain. 36000 IN A 10.1.2.3
main.dom.ain. 36000 IN MX 10 main.dom.ain.
second.dom.ain.36000 IN CNAME main.dom.ain.
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:3279773
- Creation Date: 23-Apr-2007
- Modified Date:31-Mar-2021
-
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com