aboutsummaryrefslogtreecommitdiffstats
path: root/doc/mailman-install/postfix-virtual.html
blob: bde606c90fce88ee7ee72b6d6426d176c1c16ac6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" href="mailman-install.css" type='text/css' />
<link rel="first" href="mailman-install.html" title='GNU mailman - installation Manual' />
<link rel='last' href='about.html' title='About this document...' />
<link rel='help' href='about.html' title='About this document...' />
<link rel="next" href="node15.html" />
<link rel="prev" href="postfix-integration.html" />
<link rel="parent" href="node12.html" />
<link rel="next" href="node15.html" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name='aesop' content='information' />
<title>6.1.2 Virtual domains</title>
</head>
<body>
<div class="navigation">
<div id='top-navigation-panel' xml:id='top-navigation-panel'>
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="6.1.1 integrating Postfix and"
  href="postfix-integration.html"><img src='previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="6.1 using the Postfix"
  href="node12.html"><img src='up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="6.1.3 an alternative approach"
  href="node15.html"><img src='next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">GNU Mailman - Installation Manual</td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="postfix-integration.html">6.1.1 Integrating Postfix and</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="node12.html">6.1 Using the Postfix</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node15.html">6.1.3 An alternative approach</a>
</div>
<hr /></div>
</div>
<!--End of Navigation Panel-->

<h3><a name="SECTION001612000000000000000"></a><a name="postfix-virtual"></a>
<br>
6.1.2 Virtual domains
</h3>

<p>
<div class="note"><b class="label">Note:</b>

This section describes how to integrate Mailman with Postfix for automatic
generation of Postfix virtual_alias_maps for Mailman list addresses. Mailman's
support of virtual domains is limited in that list names must be globally
unique within a single Mailman instance, i.e., two lists may not have the same
name even if they are in different domains.
</div>

<p>
Postfix 2.0 supports ``virtual alias domains'', essentially what used to be
called ``Postfix-style virtual domains'' in earlier Postfix versions.  To make
virtual alias domains work with Mailman, you need to do some setup in both
Postfix and Mailman.  Mailman will write all virtual alias mappings to a file
called, by default, <span class="file">/usr/local/mailman/data/virtual-mailman</span>.  It will
also use <b class="program">postmap</b> to create the <b class="program">virtual-mailman.db</b> file
that Postfix will actually use.

<p>
First, you need to set up the Postfix virtual alias domains as described in
the Postfix documentation (see Postfix's <code>virtual(5)</code> manpage).  Note
that it's your responsibility to include the <code>virtual-alias.domain
anything</code> line as described manpage (in recent Postfix this is not required
if the domain is included in virtual_alias_domains in main.cf); Mailman will
not include this line in <span class="file">virtual-mailman</span>.  You are highly encouraged to
make sure your virtual alias domains are working properly before integrating
with Mailman.

<p>
Next, add a path to Postfix's <var>virtual_alias_maps</var> variable, pointing to
the virtual-mailman file, e.g.:

<p>
<div class="verbatim"><pre>
    virtual_alias_maps = &lt;your normal virtual alias files&gt;,
        hash:/usr/local/mailman/data/virtual-mailman
</pre></div>

<p>
assuming you've installed Mailman in the default location.  If you're using an
older version of Postfix which doesn't have the <var>virtual_alias_maps</var>
variable, use the <var>virtual_maps</var> variable instead.

<p>
The default mappings in <span class="file">virtual-mailman</span> map list addresses in virtual
domains to unqualified local names as in:

<p>
<div class="verbatim"><pre>
    mylist@dom.ain         mylist
    mylist-request@dom.ain mylist-request
    # and so on...
</pre></div>

<p>
In some Postfix configurations it may be necessary to qualify those local
names as for example:

<p>
<div class="verbatim"><pre>
    mylist@dom.ain         mylist@localhost
    mylist-request@dom.ain mylist-request@localhost
    # and so on...
</pre></div>

<p>
If this is the case, you can include

<p>
<div class="verbatim"><pre>
    VIRTUAL_MAILMAN_LOCAL_DOMAIN = 'localhost'
</pre></div>

<p>
or whatever qualification is needed in <span class="file">mm_cfg.py</span>.

<p>
Next, in your <span class="file">mm_cfg.py</span> file, you will want to set the variable
<var>POSTFIX_STYLE_VIRTUAL_DOMAINS</var> to the list of virtual domains that Mailman
should update.  This may not be all of the virtual alias domains that your
Postfix installation supports!  The values in this list will be matched
against the <var>host_name</var> attribute of mailing lists objects, and must be an
exact match.

<p>
Here's an example.  Note that this example describes an unusual configuration.
A more usual configuration is described next.  Say that Postfix is configured
to handle the virtual domains <code>dom1.ain</code>, <code>dom2.ain</code>, and
<code>dom3.ain</code>, and further that in your <span class="file">main.cf</span> file you've got the
following settings:

<p>
<div class="verbatim"><pre>
    myhostname = mail.dom1.ain
    mydomain = dom1.ain
    mydestination = $myhostname, localhost.$mydomain
    virtual_alias_maps =
        hash:/some/path/to/virtual-dom1,
        hash:/some/path/to/virtual-dom2,
        hash:/some/path/to/virtual-dom2
</pre></div>

<p>
If in your <span class="file">virtual-dom1</span> file, you've got the following lines:

<p>
<div class="verbatim"><pre>
    dom1.ain  IGNORE
    @dom1.ain @mail.dom1.ain
</pre></div>

<p>
this tells Postfix to deliver anything addressed to <code>dom1.ain</code> to the
same mailbox at <code>mail.dom1.com</code>, its default destination.

<p>
In this case you would not include <code>dom1.ain</code> in
<var>POSTFIX_STYLE_VIRTUAL_DOMAINS</var> because otherwise Mailman will write
entries for mailing lists in the dom1.ain domain as

<p>
<div class="verbatim"><pre>
    mylist@dom1.ain         mylist
    mylist-request@dom1.ain mylist-request
    # and so on...
</pre></div>

<p>
The more specific entries trump your more general entries, thus breaking the
delivery of any <code>dom1.ain</code> mailing list.

<p>
However, you would include <code>dom2.ain</code> and <code>dom3.ain</code> in
<span class="file">mm_cfg.py</span>:

<p>
<div class="verbatim"><pre>
    POSTFIX_STYLE_VIRTUAL_DOMAINS = ['dom2.ain', 'dom3.ain']
</pre></div>

<p>
Now, any list that Mailman creates in either of those two domains, will have
the correct entries written to <span class="file">/usr/local/mailman/data/virtual-mailman</span>.

<p>
In a more usual configuration, <code>dom1.ain</code> would not be a virtual domain
at all as in the following:

<p>
<div class="verbatim"><pre>
    myhostname = mail.dom1.ain
    mydomain = dom1.ain
    mydestination = $myhostname, $mydomain localhost.$mydomain
    virtual_alias_maps =
        hash:/some/path/to/virtual-dom2,
        hash:/some/path/to/virtual-dom2
</pre></div>

<p>
In this case too, you would include <code>dom2.ain</code> and <code>dom3.ain</code> in
<span class="file">mm_cfg.py</span>:

<p>
<div class="verbatim"><pre>
    POSTFIX_STYLE_VIRTUAL_DOMAINS = ['dom2.ain', 'dom3.ain']
</pre></div>

<p>
As in the previous section with the <span class="file">data/aliases*</span> files, you want to
make sure that both <span class="file">data/virtual-mailman</span> and
<span class="file">data/virtual-mailman.db</span> are user and group owned by <code>mailman</code>.

<p>

<div class="navigation">
<div class='online-navigation'>
<p></p><hr />
<table align="center" width="100%" cellpadding="0" cellspacing="2">
<tr>
<td class='online-navigation'><a rel="prev" title="6.1.1 integrating Postfix and"
  href="postfix-integration.html"><img src='previous.png'
  border='0' height='32'  alt='Previous Page' width='32' /></a></td>
<td class='online-navigation'><a rel="parent" title="6.1 using the Postfix"
  href="node12.html"><img src='up.png'
  border='0' height='32'  alt='Up one Level' width='32' /></a></td>
<td class='online-navigation'><a rel="next" title="6.1.3 an alternative approach"
  href="node15.html"><img src='next.png'
  border='0' height='32'  alt='Next Page' width='32' /></a></td>
<td align="center" width="100%">GNU Mailman - Installation Manual</td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
<td class='online-navigation'><img src='blank.png'
  border='0' height='32'  alt='' width='32' /></td>
</tr></table>
<div class='online-navigation'>
<b class="navlabel">Previous:</b>
<a class="sectref" rel="prev" href="postfix-integration.html">6.1.1 Integrating Postfix and</a>
<b class="navlabel">Up:</b>
<a class="sectref" rel="parent" href="node12.html">6.1 Using the Postfix</a>
<b class="navlabel">Next:</b>
<a class="sectref" rel="next" href="node15.html">6.1.3 An alternative approach</a>
</div>
</div>
<hr />
<span class="release-info">Release 2.1, documentation updated on January 11, 2020.</span>
</div>
<!--End of Navigation Panel-->

</body>
</html>