1 Date: Mon, 19 Mar 2001 17:33:11 +0300
2 From: "Alexei V. Alexandrov" <ava@elcomsoft.com>
4 Attaced you will find a plain text file where i explain how to
5 setup mailman to use virtual environment (single setup for many
6 domains). I think this will help exim users.
8 If you have any questions, don not hesitate to contact me.
11 Using Mailman in virtual environment.
13 Download mailman and install it in a directory you prefer. (Note: compile mailman
14 to use the GID that your virtual accounts use. mine is "virtual").
15 Let`s presume that all virtual servers have an account in group named "virtual".
16 Setup exim to use mailman in the following way:
18 MAILMAN_HOME = /virtual/usr/mailman
19 MAILMAN_WRAP = MAILMAN_HOME/mail/wrapper
23 ######################################################################
24 # TRANSPORTS CONFIGURATION #
25 ######################################################################
29 command = MAILMAN_WRAP post ${lc:$local_part}
30 current_directory = MAILMAN_HOME
31 home_directory = MAILMAN_HOME
37 command = MAILMAN_WRAP mailcmd ${lc:$local_part}
38 current_directory = MAILMAN_HOME
39 home_directory = MAILMAN_HOME
45 command = MAILMAN_WRAP mailowner ${lc:$local_part}
46 current_directory = MAILMAN_HOME
47 home_directory = MAILMAN_HOME
51 ######################################################################
52 # DIRECTORS CONFIGURATION #
53 # Specifies how local addresses are handled #
54 ######################################################################
56 # Note: these directors should go after forward file driver
57 # and before smart user driver (if you use "catchall" for your
62 require_files = MAILMAN_HOME/${lc:$domain}/lists/${lc:$local_part}/config.db
64 new_address = "${lc:$local_part}-admin@${domain}"
68 require_files = MAILMAN_HOME/${lc:$domain}/lists/${lc:$local_part}/config.db
70 new_address = "${lc:$local_part}-admin@${domain}"
75 require_files = MAILMAN_HOME/${lc:$domain}/lists/${lc:$local_part}/config.db
76 transport = mailman_admin
81 require_files = MAILMAN_HOME/${lc:$domain}/lists/${lc:$local_part}/config.db
82 transport = mailman_request
86 require_files = MAILMAN_HOME/${lc:$domain}/lists/${lc:$local_part}/config.db
89 # The trick is that we create in MAILMAN_HOME directories named like domains that we
90 # recieve mail for. The sufficient directory structure is the following:
98 We have succesfully setup exim to use mailman listmanager. Next we will have to tweak
99 mailman to suite our virtual setup. What we do. Mailman has its default configuration
100 stored in MAILMAN_HOME/Mailman/Defaults.py this file is imported by mm_cfg.py and is
101 used by all other modules. We will twak it to use defaults.py for different domains.
102 Here is how i did it:
104 MAILMAN_HOME/Mailman/mm_cfg.py:
109 def loadDefaults ( name ):
111 module = '/vhost/usr/mailman/' + name + '/Defaults.py'
112 hFile = open ( module, "r" )
113 for line in hFile.readlines():
114 definition = definition + line
115 definition = definition + "\n"
116 exec definition in globals()
118 if os.environ.get('HTTP_HOST') :
119 junk, domain = tuple(string.split(os.environ['HTTP_HOST'], '.', 1))
121 elif os.environ.get('DOMAIN') :
122 loadDefaults(os.environ['DOMAIN'])
124 loadDefaults('Mailman')
126 # from Defaults import *
128 The Defaults.py is stored in the directory: MAILMAN_HOME/domain.com/Defaults.py
129 and is not different from the original one. The lines you should modify are:
131 DEFAULT_HOST_NAME = 'domain.com'
132 DEFAULT_URL = 'http://mail.%s/' % DEFAULT_HOST_NAME
134 LIST_DATA_DIR = os.path.join(VAR_PREFIX, DEFAULT_HOST_NAME + '/lists')
135 LOG_DIR = os.path.join(VAR_PREFIX, DEFAULT_HOST_NAME + '/logs')
136 LOCK_DIR = os.path.join(VAR_PREFIX, DEFAULT_HOST_NAME + '/locks')
137 DATA_DIR = os.path.join(VAR_PREFIX, DEFAULT_HOST_NAME + '/data')
138 QUEUE_DIR = os.path.join(VAR_PREFIX, DEFAULT_HOST_NAME + '/qfiles')
140 We use two environment variables on is HTTP_HOST (to be able to use mailman
141 managment interface for different domains). Other one is DOMAIN (this variable
142 is set by exim). Another thing is is to be able to run the man mailman script
143 called qrunner. As users have there accounts in the system, they are able to use cron.
144 Create a crontab file in the user`s directory with the following contents:
148 * * * * * /virtual/bin/python -S /virtual/usr/mailman/cron/qrunner
150 This will set the DOMAIN variable so the qrunner will use the right settings.
152 If you want to create a new list. first set the environment variable DOMAIN to the
153 desired domain and run the command MAILMAN_HOME/bin/newlist
155 About the managment interface everything is simple. Run the apache server and bind
156 it to a specific address (for ex.: 192.168.10.10). Create for each domain DNS record
157 listserv IN A 192.168.10.10
158 When the user will point his browser to http://listserv.domain.com/ he will see a list
159 of available mailing lists or he will get an error message indicating that the default settings
160 for this domain are not available.
162 That`s it. This setup works for me and it handles over 50 domains.