xref: /netbsd-src/external/ibm-public/postfix/dist/html/BASIC_CONFIGURATION_README.html (revision a45db23f655e22f0c2354600d3b3c2cb98abf2dc)
1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2        "http://www.w3.org/TR/html4/loose.dtd">
3
4<html>
5
6<head>
7
8<title> Postfix Basic Configuration </title>
9
10<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
11
12</head>
13
14<body>
15
16<h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix Basic Configuration </h1>
17
18<hr>
19
20<h2> Introduction </h2>
21
22<p> Postfix has several hundred configuration parameters that are
23controlled via the <a href="postconf.5.html">main.cf</a> file.  Fortunately, all parameters have
24sensible default values.  In many cases, you need to configure only
25two or three parameters before you can start to play with the mail
26system. Here's a quick introduction to the syntax:  </p>
27
28<ul>
29
30<li> <p> <a href="#syntax">Postfix configuration files</a></p>
31
32</ul>
33
34<p> The text below assumes that you already have Postfix installed
35on the system, either by compiling the source code yourself (as
36described in the <a href="INSTALL.html">INSTALL</a> file) or by installing an already compiled
37version.  </p>
38
39<p> This document covers basic Postfix configuration. Information
40about how to configure Postfix for specific applications such as
41mailhub, firewall or dial-up client can be found in the
42<a href="STANDARD_CONFIGURATION_README.html">STANDARD_CONFIGURATION_README</a> file. But don't go there until you
43already have covered the material presented below.  </p>
44
45<p> The first parameters of interest specify the machine's identity
46and role in the network. </p>
47
48<ul>
49
50<li> <p> <a href="#myorigin"> What domain name to use in outbound mail </a> </p>
51
52<li> <p> <a href="#mydestination"> What domains to receive mail for </a> </p>
53
54<li> <p> <a href="#relay_from"> What clients to relay mail from </a> </p>
55
56<li> <p> <a href="#relay_to"> What destinations to relay mail to </a> </p>
57
58<li> <p> <a href="#relayhost"> What delivery method: direct or
59indirect </a> </p>
60
61</ul>
62
63<p> The default values for many other configuration parameters are
64derived from just these. </p>
65
66<p> The next parameter of interest controls the amount of mail sent
67to the local postmaster: </p>
68
69<ul>
70
71<li> <p> <a href="#notify"> What trouble to report to the postmaster
72</a> </p>
73
74</ul>
75
76<p> Be sure to set the following correctly if you're behind a proxy or
77network address translator, and you are running a backup MX host
78for some other domain: </p>
79
80<ul>
81
82<li> <p> <a href="#proxy_interfaces"> Proxy/NAT external network
83addresses </a> </p>
84
85</ul>
86
87<p>  Postfix daemon processes run in the background, and log problems
88and normal activity to the syslog daemon. Here are a few things
89that you need to be aware of: </p>
90
91<ul>
92
93<li> <p> <a href="#syslog_howto"> What you need to know about
94Postfix logging </a> </p>
95
96</ul>
97
98<p> If your machine has unusual security requirements you may
99want to run Postfix daemon processes inside a chroot environment. </p>
100
101<ul>
102
103<li> <p> <a href="#chroot_setup"> Running Postfix daemon processes
104chrooted </a> </p>
105
106</ul>
107<p> If you run Postfix on a virtual network interface, or if your
108machine runs other mailers on virtual interfaces, you'll have to
109look at the other parameters listed here as well: </p>
110
111<ul>
112
113<li> <p> <a href="#myhostname"> My own hostname </a> </p>
114
115<li> <p> <a href="#mydomain"> My own domain name </a> </p>
116
117<li> <p> <a href="#inet_interfaces"> My own network addresses </a> </p>
118
119</ul>
120
121<h2> <a name="syntax">Postfix configuration files</a></h2>
122
123<p> By default, Postfix configuration files are in /etc/postfix.
124The two most important files are <a href="postconf.5.html">main.cf</a> and <a href="master.5.html">master.cf</a>; these files
125must be owned by root.  Giving someone else write permission to
126<a href="postconf.5.html">main.cf</a> or <a href="master.5.html">master.cf</a> (or to their parent directories) means giving
127root privileges to that person. </p>
128
129<p> In /etc/postfix/<a href="postconf.5.html">main.cf</a> you will have to set up a minimal number
130of configuration parameters.  Postfix configuration parameters
131resemble shell variables, with two important differences: the first
132one is that Postfix does not know about quotes like the UNIX shell
133does.</p>
134
135<p> You specify a configuration parameter as: </p>
136
137<blockquote>
138<pre>
139/etc/postfix/<a href="postconf.5.html">main.cf</a>:
140    parameter = value
141</pre>
142</blockquote>
143
144<p> and you use it by putting a "$" character in front of its name: </p>
145
146<blockquote>
147<pre>
148/etc/postfix/<a href="postconf.5.html">main.cf</a>:
149    other_parameter = $parameter
150</pre>
151</blockquote>
152
153<p> You can use $parameter before it is given a value (that is the
154second main difference with UNIX shell variables). The Postfix
155configuration language uses lazy evaluation, and does not look at
156a parameter value until it is needed at runtime.  </p>
157
158<p> Postfix uses database files for access control, address rewriting
159and other purposes. The <a href="DATABASE_README.html">DATABASE_README</a> file gives an introduction
160to how Postfix works with Berkeley DB, LDAP or SQL and other types.
161Here is a common example of how Postfix invokes a database: </p>
162
163<blockquote>
164<pre>
165/etc/postfix/<a href="postconf.5.html">main.cf</a>:
166    <a href="postconf.5.html#virtual_alias_maps">virtual_alias_maps</a> = <a href="DATABASE_README.html#types">hash</a>:/etc/postfix/virtual
167</pre>
168</blockquote>
169
170<p> Whenever you make a change to the <a href="postconf.5.html">main.cf</a> or <a href="master.5.html">master.cf</a> file,
171execute the following command as root in order to refresh a running
172mail system: </p>
173
174<blockquote>
175<pre>
176# postfix reload
177</pre>
178</blockquote>
179
180<h2> <a name="myorigin"> What domain name to use in outbound mail </a> </h2>
181
182<p> The <a href="postconf.5.html#myorigin">myorigin</a> parameter specifies the domain that appears in
183mail that is posted on this machine. The default is to use the
184local machine name, $<a href="postconf.5.html#myhostname">myhostname</a>, which defaults to the name of the
185machine. Unless you are running a really small site, you probably
186want to change that into $<a href="postconf.5.html#mydomain">mydomain</a>, which defaults to the parent
187domain of the machine name. </p>
188
189<p> For the sake of consistency between sender and recipient addresses,
190<a href="postconf.5.html#myorigin">myorigin</a> also specifies the domain name that is appended
191to an unqualified recipient address. </p>
192
193<p> Examples (specify only one of the following): </p>
194
195<blockquote>
196<pre>
197/etc/postfix/<a href="postconf.5.html">main.cf</a>:
198    <a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#myhostname">myhostname</a> (default: send mail as "user@$<a href="postconf.5.html#myhostname">myhostname</a>")
199    <a href="postconf.5.html#myorigin">myorigin</a> = $<a href="postconf.5.html#mydomain">mydomain</a>   (probably desirable: "user@$<a href="postconf.5.html#mydomain">mydomain</a>")
200</pre>
201</blockquote>
202
203<h2><a name="mydestination"> What domains to receive mail for </a>
204</h2>
205
206<p> The <a href="postconf.5.html#mydestination">mydestination</a> parameter specifies what domains this
207machine will deliver locally, instead of forwarding to another
208machine. The default is to receive mail for the machine itself.
209See the <a href="VIRTUAL_README.html">VIRTUAL_README</a> file for how to configure Postfix for
210<a href="VIRTUAL_README.html#canonical">hosted domains</a>. </p>
211
212<p> You can specify zero or more domain names, "/file/name" patterns
213and/or "<a href="DATABASE_README.html">type:table</a>" lookup tables (such as <a href="DATABASE_README.html#types">hash</a>:, <a href="DATABASE_README.html#types">btree</a>:, nis:, <a href="ldap_table.5.html">ldap</a>:,
214or <a href="mysql_table.5.html">mysql</a>:), separated by whitespace and/or commas.  A "/file/name"
215pattern is replaced by its contents; "<a href="DATABASE_README.html">type:table</a>" requests that a
216table lookup is done and merely tests for existence: the lookup
217result is ignored.  </p>
218
219<p> IMPORTANT: If your machine is a mail server for its entire
220domain, you must list $<a href="postconf.5.html#mydomain">mydomain</a> as well.  </p>
221
222<p> Example 1: default setting. </p>
223
224<blockquote>
225<pre>
226/etc/postfix/<a href="postconf.5.html">main.cf</a>:
227    <a href="postconf.5.html#mydestination">mydestination</a> = $<a href="postconf.5.html#myhostname">myhostname</a> localhost.$<a href="postconf.5.html#mydomain">mydomain</a> localhost
228</pre>
229</blockquote>
230
231<p> Example 2: domain-wide mail server. </p>
232
233<blockquote>
234<pre>
235/etc/postfix/<a href="postconf.5.html">main.cf</a>:
236    <a href="postconf.5.html#mydestination">mydestination</a> = $<a href="postconf.5.html#myhostname">myhostname</a> localhost.$<a href="postconf.5.html#mydomain">mydomain</a> localhost $<a href="postconf.5.html#mydomain">mydomain</a>
237</pre>
238</blockquote>
239
240<p> Example 3: host with multiple DNS A records. </p>
241
242<blockquote>
243<pre>
244/etc/postfix/<a href="postconf.5.html">main.cf</a>:
245    <a href="postconf.5.html#mydestination">mydestination</a> = $<a href="postconf.5.html#myhostname">myhostname</a> localhost.$<a href="postconf.5.html#mydomain">mydomain</a> localhost
246        www.$<a href="postconf.5.html#mydomain">mydomain</a> ftp.$<a href="postconf.5.html#mydomain">mydomain</a>
247</pre>
248</blockquote>
249
250<p> Caution: in order to avoid mail delivery loops, you must list all
251hostnames of the machine, including $<a href="postconf.5.html#myhostname">myhostname</a>, and localhost.$<a href="postconf.5.html#mydomain">mydomain</a>. </p>
252
253<h2> <a name="relay_from"> What clients to relay mail from </a> </h2>
254
255<p> By default, Postfix will forward mail from clients in authorized
256network blocks to any destination.  Authorized networks are defined
257with the <a href="postconf.5.html#mynetworks">mynetworks</a> configuration parameter. The current default is to
258authorize the local machine only. Prior to Postfix 3.0, the default
259was to authorize all clients in the IP subnetworks that the local
260machine is attached to. </p>
261
262<p> Postfix can also be configured to relay mail from "mobile"
263clients that send mail from outside an authorized network block.
264This is explained in the <a href="SASL_README.html">SASL_README</a> and <a href="TLS_README.html">TLS_README</a> documents. </p>
265
266<p> IMPORTANT: If your machine is connected to a wide area network
267then the "<a href="postconf.5.html#mynetworks_style">mynetworks_style</a> = subnet" setting may be too friendly. </p>
268
269<p> Examples (specify only one of the following): </p>
270
271<blockquote>
272<pre>
273/etc/postfix/<a href="postconf.5.html">main.cf</a>:
274    <a href="postconf.5.html#mynetworks_style">mynetworks_style</a> = subnet  (not safe on a wide area network)
275    <a href="postconf.5.html#mynetworks_style">mynetworks_style</a> = host    (authorize local machine only)
276    <a href="postconf.5.html#mynetworks">mynetworks</a> = 127.0.0.0/8   (authorize local machine only)
277    <a href="postconf.5.html#mynetworks">mynetworks</a> = 127.0.0.0/8 168.100.189.2/32 (authorize local machine)
278    <a href="postconf.5.html#mynetworks">mynetworks</a> = 127.0.0.0/8 168.100.189.2/28 (authorize local networks)
279</pre>
280</blockquote>
281
282<p> You can specify the trusted networks in the <a href="postconf.5.html">main.cf</a> file, or
283you can let Postfix do the work for you. The default is to let
284Postfix do the work. The result depends on the <a href="postconf.5.html#mynetworks_style">mynetworks_style</a>
285parameter value.
286
287<ul>
288
289<li> <p> Specify "<a href="postconf.5.html#mynetworks_style">mynetworks_style</a> = host" (the default when
290<a href="postconf.5.html#compatibility_level">compatibility_level</a> &ge; 2) when Postfix should forward mail from
291only the local machine. </p>
292
293<li> <p> Specify "<a href="postconf.5.html#mynetworks_style">mynetworks_style</a> = subnet" (the default when
294<a href="postconf.5.html#compatibility_level">compatibility_level</a> &lt; 2) when Postfix should forward mail from
295SMTP clients in the same IP subnetworks as the local machine.
296On Linux, this works correctly only with interfaces specified
297with the "ifconfig" or "ip" command. </p>
298
299<li> <p> Specify "<a href="postconf.5.html#mynetworks_style">mynetworks_style</a> = class" when Postfix should
300forward mail from SMTP clients in the same IP class A/B/C networks
301as the local machine. Don't do this with a dialup site - it would
302cause Postfix to "trust" your entire provider's network. Instead,
303specify an explicit <a href="postconf.5.html#mynetworks">mynetworks</a> list by hand, as described below.
304</p>
305
306</ul>
307
308<p> Alternatively, you can specify the <a href="postconf.5.html#mynetworks">mynetworks</a> list by hand,
309in which case Postfix ignores the <a href="postconf.5.html#mynetworks_style">mynetworks_style</a> setting.
310To specify the list of trusted networks by hand, specify network
311blocks in CIDR (network/mask) notation, for example: </p>
312
313<blockquote>
314<pre>
315/etc/postfix/<a href="postconf.5.html">main.cf</a>:
316    <a href="postconf.5.html#mynetworks">mynetworks</a> = 168.100.189.0/28, 127.0.0.0/8
317</pre>
318</blockquote>
319
320<p> You can also specify the absolute pathname of a pattern file instead
321of listing the patterns in the <a href="postconf.5.html">main.cf</a> file. </p>
322
323<h2> <a name="relay_to"> What destinations to relay mail to </a> </h2>
324
325<p> By default, Postfix will forward mail from strangers (clients outside
326authorized networks) to authorized remote destinations only.
327Authorized remote
328destinations are defined with the <a href="postconf.5.html#relay_domains">relay_domains</a> configuration
329parameter.  The default is to authorize all domains (and subdomains)
330of the domains listed with the <a href="postconf.5.html#mydestination">mydestination</a> parameter.  </p>
331
332<p> Examples (specify only one of the following): </p>
333
334<blockquote>
335<pre>
336/etc/postfix/<a href="postconf.5.html">main.cf</a>:
337    <a href="postconf.5.html#relay_domains">relay_domains</a> = $<a href="postconf.5.html#mydestination">mydestination</a> (default)
338    <a href="postconf.5.html#relay_domains">relay_domains</a> =           (safe: never forward mail from strangers)
339    <a href="postconf.5.html#relay_domains">relay_domains</a> = $<a href="postconf.5.html#mydomain">mydomain</a> (forward mail to my domain and subdomains)
340</pre>
341</blockquote>
342
343<h2> <a name="relayhost"> What delivery method: direct or
344indirect </a> </h2>
345
346<p> By default, Postfix tries to deliver mail directly to the
347Internet. Depending on your local conditions this may not be possible
348or desirable.  For example, your system may be turned off outside
349office hours, it may be behind a firewall, or it may be connected
350via a provider who does not allow direct mail to the Internet.  In
351those cases you need to configure Postfix to deliver mail indirectly
352via a <a href="postconf.5.html#relayhost">relay host</a>. </p>
353
354<p> Examples (specify only one of the following): </p>
355
356<blockquote>
357<pre>
358/etc/postfix/<a href="postconf.5.html">main.cf</a>:
359    <a href="postconf.5.html#relayhost">relayhost</a> =                   (default: direct delivery to Internet)
360    <a href="postconf.5.html#relayhost">relayhost</a> = $<a href="postconf.5.html#mydomain">mydomain</a>         (deliver via local mailhub)
361    <a href="postconf.5.html#relayhost">relayhost</a> = [mail.$<a href="postconf.5.html#mydomain">mydomain</a>]  (deliver via local mailhub)
362    <a href="postconf.5.html#relayhost">relayhost</a> = [mail.isp.tld]    (deliver via provider mailhub)
363</pre>
364</blockquote>
365
366<p> The form enclosed with <tt>[]</tt> eliminates DNS MX lookups.
367Don't worry if you don't know what that means. Just be sure to
368specify the <tt>[]</tt> around the mailhub hostname that your ISP
369gave to you, otherwise mail may be mis-delivered. </p>
370
371<p> The <a href="STANDARD_CONFIGURATION_README.html">STANDARD_CONFIGURATION_README</a> file has more hints and tips
372for firewalled and/or dial-up networks. </p>
373
374<h2> <a name="notify"> What trouble to report to the postmaster</a> </h2>
375
376<p> You should set up a postmaster alias in the <a href="aliases.5.html">aliases(5)</a> table
377that directs mail to a human person.  The postmaster address is
378required to exist, so that people can report mail delivery problems.
379While you're updating the <a href="aliases.5.html">aliases(5)</a> table, be sure to direct mail
380for the super-user to a human person too. </p>
381
382<blockquote>
383<pre>
384/etc/aliases:
385    postmaster: you
386    root: you
387</pre>
388</blockquote>
389
390<p> Execute the command "newaliases" after changing the aliases
391file.  Instead of /etc/aliases, your alias file may be located
392elsewhere.  Use the command "postconf <a href="postconf.5.html#alias_maps">alias_maps</a>" to find out.</p>
393
394<p> The Postfix system reports problems to the postmaster alias.
395You may not be interested in all types of trouble reports, so this
396reporting mechanism is configurable. The default is to report only
397serious problems (resource, software) to postmaster:  </p>
398
399<p> Default setting: </p>
400
401<blockquote>
402<pre>
403/etc/postfix/<a href="postconf.5.html">main.cf</a>:
404    <a href="postconf.5.html#notify_classes">notify_classes</a> = resource, software
405</pre>
406</blockquote>
407
408<p> The meaning of the classes is as follows: </p>
409
410<blockquote>
411
412<dl>
413
414<dt> bounce </dt> <dd>  Inform the postmaster of undeliverable
415mail.  Either send the postmaster a copy of undeliverable mail that
416is returned to the sender, or send a transcript of the SMTP session
417when Postfix rejected mail.  For privacy reasons, the postmaster
418copy of undeliverable mail is truncated after the original message
419headers.  This implies "2bounce" (see below).  See also the
420<a href="postconf.5.html#luser_relay">luser_relay</a> feature. The notification is sent to the address
421specified with the <a href="postconf.5.html#bounce_notice_recipient">bounce_notice_recipient</a> configuration parameter
422(default:  postmaster).  </dd>
423
424<dt> 2bounce </dt> <dd> When Postfix is unable to return undeliverable
425mail to the sender, send it to the postmaster instead (without
426truncating the message after the primary headers). The notification
427is sent to the address specified with the <a href="postconf.5.html#2bounce_notice_recipient">2bounce_notice_recipient</a>
428configuration parameter (default:  postmaster).  </dd>
429
430<dt> delay </dt> <dd> Inform the postmaster of delayed mail.  In
431this case, the postmaster receives message headers only.  The
432notification is sent to the address specified with the
433<a href="postconf.5.html#delay_notice_recipient">delay_notice_recipient</a> configuration parameter (default:  postmaster).
434</dd>
435
436<dt> policy </dt> <dd> Inform the postmaster of client requests
437that were rejected because of (UCE) policy restrictions.  The
438postmaster receives a transcript of the SMTP session. The notification
439is sent to the address specified with the <a href="postconf.5.html#error_notice_recipient">error_notice_recipient</a>
440configuration parameter (default:  postmaster).  </dd>
441
442<dt> protocol </dt> <dd> Inform the postmaster of protocol errors
443(client or server side) or attempts by a client to execute
444unimplemented commands. The postmaster receives a transcript of
445the SMTP session. The notification is sent to the address specified
446with the <a href="postconf.5.html#error_notice_recipient">error_notice_recipient</a> configuration parameter (default:
447postmaster). </dd>
448
449<dt> resource </dt> <dd> Inform the postmaster of mail not delivered
450due to resource problems (for example, queue file write errors).
451The notification is sent to the address specified with the
452<a href="postconf.5.html#error_notice_recipient">error_notice_recipient</a> configuration parameter (default:  postmaster).
453</dd>
454
455<dt> software </dt> <dd> Inform the postmaster of mail not delivered
456due to software problems. The notification is sent to the address
457specified with the <a href="postconf.5.html#error_notice_recipient">error_notice_recipient</a> configuration parameter
458(default:  postmaster). </dd>
459
460</dl>
461
462</blockquote>
463
464<h2><a name="proxy_interfaces"> Proxy/NAT external network
465addresses</a> </h2>
466
467<p> Some mail servers are connected to the Internet via a network
468address translator (NAT) or proxy. This means that systems on the
469Internet connect to the address of the NAT or proxy, instead of
470connecting to the network address of the mail server. The NAT or
471proxy forwards the connection to the network address of the mail
472server, but Postfix does not know this.  </p>
473
474<p> If you run a Postfix server behind a proxy or NAT, you need to
475configure the <a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a> parameter and specify all the external
476proxy or NAT addresses that Postfix receives mail on. You may
477specify symbolic hostnames instead of network addresses.  </p>
478
479<p> IMPORTANT: You must specify your proxy/NAT external addresses
480when your system is a backup MX host for other domains, otherwise
481mail delivery loops will happen when the primary MX host is down.
482</p>
483
484<p> Example: host behind NAT box running a backup MX host. </p>
485
486<blockquote>
487<pre>
488/etc/postfix/<a href="postconf.5.html">main.cf</a>:
489    <a href="postconf.5.html#proxy_interfaces">proxy_interfaces</a> = 1.2.3.4 (the proxy/NAT external network address)
490</pre>
491</blockquote>
492
493<h2> <a name="syslog_howto"> What you need to know about
494Postfix logging </a> </h2>
495
496<p> Postfix daemon processes run in the background, and log problems
497and normal activity to the syslog daemon. The syslogd process sorts
498events by class and severity, and appends them to logfiles. The
499logging classes, levels and logfile names are usually specified in
500/etc/syslog.conf. At the very least you need something like:  </p>
501
502<blockquote>
503<pre>
504/etc/syslog.conf:
505    mail.err                                    /dev/console
506    mail.debug                                  /var/log/maillog
507</pre>
508</blockquote>
509
510<p> After changing the syslog.conf file, send a "HUP" signal to
511the syslogd process.  </p>
512
513<p> IMPORTANT: many syslogd implementations will not create files.
514You must create files before (re)starting syslogd. </p>
515
516<p> IMPORTANT: on Linux you need to put a "-" character before the
517pathname, e.g., -/var/log/maillog, otherwise the syslogd process
518will use more system resources than Postfix. </p>
519
520<p> Hopefully, the number of problems will be small, but it is a good
521idea to run every night before the syslog files are rotated: </p>
522
523<blockquote>
524<pre>
525# postfix check
526# egrep '(reject|warning|error|fatal|panic):' /some/log/file
527</pre>
528</blockquote>
529
530<ul>
531
532<li> <p> The first line (postfix check) causes Postfix to report
533file permission/ownership discrepancies. </p>
534
535<li> <p> The second line looks for problem reports from the mail
536software, and reports how effective the relay and junk mail access
537blocks are.  This may produce a lot of output.  You will want to
538apply some postprocessing to eliminate uninteresting information.
539</p>
540
541</ul>
542
543<p> The <a href="DEBUG_README.html#logging"> DEBUG_README </a>
544document describes the meaning of the "warning" etc. labels in
545Postfix logging. </p>
546
547<h2> <a name="chroot_setup"> Running Postfix daemon processes
548chrooted </a> </h2>
549
550<p> Postfix daemon processes can be configured (via the <a href="master.5.html">master.cf</a>
551file) to run in a chroot jail.  The processes run at a fixed low
552privilege and with file system access limited to the Postfix queue
553directories (/var/spool/postfix).  This provides a significant
554barrier against intrusion. The barrier is not impenetrable (chroot
555limits file system access only), but every little bit helps.</p>
556
557<p>With the exception of Postfix daemons that deliver mail locally
558and/or that execute non-Postfix commands, every Postfix daemon can
559run chrooted.</p>
560
561<p>Sites with high security requirements should consider to chroot
562all daemons that talk to the network: the <a href="smtp.8.html">smtp(8)</a> and <a href="smtpd.8.html">smtpd(8)</a>
563processes, and perhaps also the <a href="lmtp.8.html">lmtp(8)</a> client. The author's own
564porcupine.org mail server runs all daemons chrooted that can be
565chrooted.  </p>
566
567<p>The default /etc/postfix/<a href="master.5.html">master.cf</a> file specifies that no Postfix
568daemon runs chrooted. In order to enable chroot operation, edit
569the file /etc/postfix/<a href="master.5.html">master.cf</a>, and follow instructions in the
570file.  When you're finished, execute "postfix reload" to make the
571change effective. </p>
572
573<p>Note that a chrooted daemon resolves all filenames relative to
574the Postfix queue directory (/var/spool/postfix). For successful
575use of a chroot jail, most UNIX systems require you to bring in
576some files or device nodes. The examples/chroot-setup directory in
577the source code distribution has a collection of scripts that help
578you set up Postfix chroot environments on different operating
579systems.</p>
580
581<p> Additionally, you almost certainly need to configure syslogd
582so that it listens on a socket inside the Postfix queue directory.
583Examples of syslogd command line options that achieve this for
584specific systems: </p>
585
586<p> FreeBSD: <tt>syslogd -l /var/spool/postfix/var/run/log</tt> </p>
587
588<p> Linux, OpenBSD: <tt>syslogd -a /var/spool/postfix/dev/log</tt> </p>
589
590<h2><a name="myhostname"> My own hostname </a> </h2>
591
592<p> The <a href="postconf.5.html#myhostname">myhostname</a> parameter specifies the fully-qualified domain
593name of the machine running the Postfix system.   $<a href="postconf.5.html#myhostname">myhostname</a>
594appears as the default value in many other Postfix configuration
595parameters. </p>
596
597<p> By default, <a href="postconf.5.html#myhostname">myhostname</a> is set to the local machine name.  If
598your local machine name is not in fully-qualified domain name form,
599or if you run Postfix on a virtual interface, you will have to
600specify the fully-qualified domain name that the mail system should
601use. </p>
602
603<p> Alternatively, if you specify <a href="postconf.5.html#mydomain">mydomain</a> in <a href="postconf.5.html">main.cf</a>, then Postfix
604will use its value to generate a fully-qualified default value
605for the <a href="postconf.5.html#myhostname">myhostname</a> parameter. </p>
606
607<p> Examples (specify only one of the following): </p>
608
609<blockquote>
610<pre>
611/etc/postfix/<a href="postconf.5.html">main.cf</a>:
612    <a href="postconf.5.html#myhostname">myhostname</a> = host.local.domain (machine name is not FQDN)
613    <a href="postconf.5.html#myhostname">myhostname</a> = host.virtual.domain (virtual interface)
614    <a href="postconf.5.html#myhostname">myhostname</a> = virtual.domain (virtual interface)
615</pre>
616</blockquote>
617
618<h2><a name="mydomain"> My own domain name</a> </h2>
619
620<p> The <a href="postconf.5.html#mydomain">mydomain</a> parameter specifies the parent domain of
621$<a href="postconf.5.html#myhostname">myhostname</a>.  By default, it is derived from  $<a href="postconf.5.html#myhostname">myhostname</a>
622by stripping off the first part (unless the result would be a
623top-level domain). </p>
624
625<p> Conversely, if you specify <a href="postconf.5.html#mydomain">mydomain</a> in <a href="postconf.5.html">main.cf</a>, then Postfix
626will use its value to generate a fully-qualified default value
627for the <a href="postconf.5.html#myhostname">myhostname</a> parameter. </p>
628
629<p> Examples (specify only one of the following): </p>
630
631<blockquote>
632<pre>
633/etc/postfix/<a href="postconf.5.html">main.cf</a>:
634    <a href="postconf.5.html#mydomain">mydomain</a> = local.domain
635    <a href="postconf.5.html#mydomain">mydomain</a> = virtual.domain (virtual interface)
636</pre>
637</blockquote>
638
639<h2><a name="inet_interfaces">My own network addresses</a> </h2>
640
641<p>The <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> parameter specifies all network interface
642addresses that the Postfix system should listen on; mail addressed
643to "user@[network address]" will be delivered locally,
644as if it is addressed to a domain listed in  $<a href="postconf.5.html#mydestination">mydestination</a>.</p>
645
646<p> You can override the <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> setting in the Postfix
647<a href="master.5.html">master.cf</a> file by prepending an IP address to a server name. </p>
648
649<p> The default is to listen on all active interfaces.  If you run
650mailers on virtual interfaces, you will have to specify what
651interfaces to listen on.  </p>
652
653<p> IMPORTANT: If you run MTAs on virtual interfaces you must
654specify explicit <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> values for the MTA that receives
655mail for the machine itself:  this MTA should never listen on the
656virtual interfaces or you would have a mailer loop when a virtual
657MTA is down.  </p>
658
659<p> Example: default setting. </p>
660
661<blockquote>
662<pre>
663/etc/postfix/<a href="postconf.5.html">main.cf</a>:
664    <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> = all
665</pre>
666</blockquote>
667
668<p> Example: host running one or more virtual mailers. For
669each Postfix instance, specify only one of the following. </p>
670
671<blockquote>
672<pre>
673/etc/postfix/<a href="postconf.5.html">main.cf</a>:
674    <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> = virtual.host.tld         (virtual Postfix)
675    <a href="postconf.5.html#inet_interfaces">inet_interfaces</a> = $<a href="postconf.5.html#myhostname">myhostname</a> localhost... (non-virtual Postfix)
676</pre>
677</blockquote>
678
679<p> Note: you need to stop and start Postfix after changing this
680parameter.  </p>
681
682</body>
683
684</html>
685