post-install revision 1.1.1.2.10.1 1 #!/bin/sh
2 # $NetBSD: post-install,v 1.1.1.2.10.1 2013/02/25 00:27:05 tls Exp $
3 #
4
5 # To view the formatted manual page of this file, type:
6 # POSTFIXSOURCE/mantools/srctoman - post-install | nroff -man
7
8 #++
9 # NAME
10 # post-install
11 # SUMMARY
12 # Postfix post-installation script
13 # SYNOPSIS
14 # postfix post-install [name=value] command ...
15 # DESCRIPTION
16 # The post-install script performs the finishing touch of a Postfix
17 # installation, after the executable programs and configuration
18 # files are installed. Usage is one of the following:
19 # .IP o
20 # While installing Postfix from source code on the local machine, the
21 # script is run by the postfix-install script to update selected file
22 # or directory permissions and to update Postfix configuration files.
23 # .IP o
24 # While installing Postfix from a pre-built package, the script is run
25 # by the package management procedure to set all file or directory
26 # permissions and to update Postfix configuration files.
27 # .IP o
28 # The script can be used to change installation parameter settings such
29 # as mail_owner or setgid_group after Postfix is already installed.
30 # .IP o
31 # The script can be used to upgrade configuration files and to upgrade
32 # file/directory permissions of a secondary Postfix instance.
33 # .IP o
34 # At Postfix start-up time, the script is run from "postfix check" to
35 # create missing queue directories.
36 # .PP
37 # The post-install script is controlled by installation parameters.
38 # Specific parameters are described at the end of this document.
39 # All installation parameters must be specified ahead of time via
40 # one of the methods described below.
41 #
42 # Arguments
43 # .IP create-missing
44 # Create missing queue directories with ownerships and permissions
45 # according to the contents of $daemon_directory/postfix-files, using
46 # the mail_owner and setgid_group parameter settings from the command
47 # line, process environment or from the installed main.cf file.
48 #
49 # This is required at Postfix start-up time.
50 # .IP set-permissions
51 # Set all file/directory ownerships and permissions according to the
52 # contents of $daemon_directory/postfix-files, using the mail_owner
53 # and setgid_group parameter settings from the command line, process
54 # environment or from the installed main.cf file. Implies create-missing.
55 #
56 # This is required when installing Postfix from a pre-built package,
57 # or when changing the mail_owner or setgid_group installation parameter
58 # settings after Postfix is already installed.
59 # .IP upgrade-permissions
60 # Update ownership and permission of existing files/directories as
61 # specified in $daemon_directory/postfix-files, using the mail_owner
62 # and setgid_group parameter settings from the command line, process
63 # environment or from the installed main.cf file. Implies create-missing.
64 #
65 # This is required when upgrading an existing Postfix instance.
66 # .IP upgrade-configuration
67 # Edit the installed main.cf and master.cf files, in order to account
68 # for missing services and to fix deprecated parameter settings.
69 #
70 # This is required when upgrading an existing Postfix instance.
71 # .IP upgrade-source
72 # Short-hand for: upgrade-permissions upgrade-configuration.
73 #
74 # This is recommended when upgrading Postfix from source code.
75 # .IP upgrade-package
76 # Short-hand for: set-permissions upgrade-configuration.
77 #
78 # This is recommended when upgrading Postfix from a pre-built package.
79 # .IP first-install-reminder
80 # Remind the user that they still need to configure main.cf and the
81 # aliases file, and that newaliases still needs to be run.
82 #
83 # This is recommended when Postfix is installed for the first time.
84 # MULTIPLE POSTFIX INSTANCES
85 # .ad
86 # .fi
87 # Multiple Postfix instances on the same machine can share command and
88 # daemon program files but must have separate configuration and queue
89 # directories.
90 #
91 # To create a secondary Postfix installation on the same machine,
92 # copy the configuration files from the primary Postfix instance to
93 # a secondary configuration directory and execute:
94 #
95 # postfix post-install config_directory=secondary-config-directory \e
96 # .in +4
97 # queue_directory=secondary-queue-directory \e
98 # .br
99 # create-missing
100 # .PP
101 # This creates secondary Postfix queue directories, sets their access
102 # permissions, and saves the specified installation parameters to the
103 # secondary main.cf file.
104 #
105 # Be sure to list the secondary configuration directory in the
106 # alternate_config_directories parameter in the primary main.cf file.
107 #
108 # To upgrade a secondary Postfix installation on the same machine,
109 # execute:
110 #
111 # postfix post-install config_directory=secondary-config-directory \e
112 # .in +4
113 # upgrade-permissions upgrade-configuration
114 # INSTALLATION PARAMETER INPUT METHODS
115 # .ad
116 # .fi
117 # Parameter settings can be specified through a variety of
118 # mechanisms. In order of decreasing precedence these are:
119 # .IP "command line"
120 # Parameter settings can be given as name=value arguments on
121 # the post-install command line. These have the highest precedence.
122 # Settings that override the installed main.cf file are saved.
123 # .IP "process environment"
124 # Parameter settings can be given as name=value environment
125 # variables.
126 # Settings that override the installed main.cf file are saved.
127 # .IP "installed configuration files"
128 # If a parameter is not specified via the command line or via the
129 # process environment, post-install will attempt to extract its
130 # value from the already installed Postfix main.cf configuration file.
131 # These settings have the lowest precedence.
132 # INSTALLATION PARAMETER DESCRIPTION
133 # .ad
134 # .fi
135 # The description of installation parameters is as follows:
136 # .IP config_directory
137 # The directory for Postfix configuration files.
138 # .IP daemon_directory
139 # The directory for Postfix daemon programs. This directory
140 # should not be in the command search path of any users.
141 # .IP command_directory
142 # The directory for Postfix administrative commands. This
143 # directory should be in the command search path of adminstrative users.
144 # .IP queue_directory
145 # The directory for Postfix queues.
146 # .IP data_directory
147 # The directory for Postfix writable data files (caches, etc.).
148 # .IP sendmail_path
149 # The full pathname for the Postfix sendmail command.
150 # This is the Sendmail-compatible mail posting interface.
151 # .IP newaliases_path
152 # The full pathname for the Postfix newaliases command.
153 # This is the Sendmail-compatible command to build alias databases
154 # for the Postfix local delivery agent.
155 # .IP mailq_path
156 # The full pathname for the Postfix mailq command.
157 # This is the Sendmail-compatible command to list the mail queue.
158 # .IP mail_owner
159 # The owner of the Postfix queue. Its numerical user ID and group ID
160 # must not be used by any other accounts on the system.
161 # .IP setgid_group
162 # The group for mail submission and for queue management commands.
163 # Its numerical group ID must not be used by any other accounts on the
164 # system, not even by the mail_owner account.
165 # .IP html_directory
166 # The directory for the Postfix HTML files.
167 # .IP manpage_directory
168 # The directory for the Postfix on-line manual pages.
169 # .IP sample_directory
170 # The directory for the Postfix sample configuration files.
171 # This feature is obsolete as of Postfix 2.1.
172 # .IP readme_directory
173 # The directory for the Postfix README files.
174 # SEE ALSO
175 # postfix-install(1) Postfix primary installation script.
176 # FILES
177 # $config_directory/main.cf, Postfix installation parameters.
178 # $daemon_directory/postfix-files, installation control file.
179 # $config_directory/install.cf, obsolete configuration file.
180 # LICENSE
181 # .ad
182 # .fi
183 # The Secure Mailer license must be distributed with this software.
184 # AUTHOR(S)
185 # Wietse Venema
186 # IBM T.J. Watson Research
187 # P.O. Box 704
188 # Yorktown Heights, NY 10598, USA
189 #--
190
191 umask 022
192
193 PATH=/bin:/usr/bin:/usr/sbin:/usr/etc:/sbin:/etc:/usr/contrib/bin:/usr/gnu/bin:/usr/ucb:/usr/bsd
194 SHELL=/bin/sh
195 IFS="
196 "
197 BACKUP_IFS="$IFS"
198 debug=:
199 #debug=echo
200 MOST_PARAMETERS="command_directory daemon_directory data_directory
201 html_directory mail_owner mailq_path manpage_directory
202 newaliases_path queue_directory readme_directory sample_directory
203 sendmail_path setgid_group"
204 NON_SHARED="config_directory queue_directory data_directory"
205
206 USAGE="Usage: $0 [name=value] command
207 create-missing Create missing queue directories.
208 upgrade-source When installing or upgrading from source code.
209 upgrade-package When installing or upgrading from pre-built package.
210 first-install-reminder Remind of mandatory first-time configuration steps.
211 name=value Specify an installation parameter".
212
213 # Process command-line options and parameter settings. Work around
214 # brain damaged shells. "IFS=value command" should not make the
215 # IFS=value setting permanent. But some broken standard allows it.
216
217 create=; set_perms=; upgrade_perms=; upgrade_conf=; first_install_reminder=
218 obsolete=; keep_list=;
219
220 for arg
221 do
222 case $arg in
223 *=*) IFS= eval $arg; IFS="$BACKUP_IFS";;
224 create-missing) create=1;;
225 set-perm*) create=1; set_perms=1;;
226 upgrade-perm*) create=1; upgrade_perms=1;;
227 upgrade-conf*) upgrade_conf=1;;
228 upgrade-source) create=1; upgrade_conf=1; upgrade_perms=1;;
229 upgrade-package) create=1; upgrade_conf=1; set_perms=1;;
230 first-install*) first_install_reminder=1;;
231 *) echo "$0: Error: $USAGE" 1>&2; exit 1;;
232 esac
233 shift
234 done
235
236 # Sanity checks.
237
238 test -n "$create$upgrade_conf$first_install_reminder" || {
239 echo "$0: Error: $USAGE" 1>&2
240 exit 1
241 }
242
243 # Bootstrapping problem.
244
245 if [ -n "$command_directory" ]
246 then
247 POSTCONF="$command_directory/postconf"
248 else
249 POSTCONF="postconf"
250 fi
251
252 $POSTCONF -d mail_version >/dev/null 2>/dev/null || {
253 echo $0: Error: no $POSTCONF command found. 1>&2
254 echo Re-run this command as $0 command_directory=/some/where. 1>&2
255 exit 1
256 }
257
258 # Also used to require license etc. files only in the default instance.
259
260 def_config_directory=`$POSTCONF -d -h config_directory` || exit 1
261 test -n "$config_directory" ||
262 config_directory="$def_config_directory"
263
264 test -d "$config_directory" || {
265 echo $0: Error: $config_directory is not a directory. 1>&2
266 exit 1
267 }
268
269 # If this is a secondary instance, don't touch shared files.
270 # XXX Solaris does not have "test -e".
271
272 instances=`test ! -f $def_config_directory/main.cf ||
273 $POSTCONF -c $def_config_directory -h multi_instance_directories |
274 sed 's/,/ /'` || exit 1
275
276 update_shared_files=1
277 for name in $instances
278 do
279 case "$name" in
280 "$def_config_directory") ;;
281 "$config_directory") update_shared_files=; break;;
282 esac
283 done
284
285 test -f $daemon_directory/postfix-files || {
286 echo $0: Error: $daemon_directory/postfix-files is not a file. 1>&2
287 exit 1
288 }
289
290 # SunOS5 fmt(1) truncates lines > 1000 characters.
291
292 fake_fmt() {
293 sed '
294 :top
295 /^\( *\)\([^ ][^ ]*\) */{
296 s//\1\2\
297 \1/
298 P
299 D
300 b top
301 }
302 ' | fmt
303 }
304
305 case `uname -s` in
306 HP-UX*) FMT=cat;;
307 SunOS*) FMT=fake_fmt;;
308 *) FMT=fmt;;
309 esac
310
311 # If a parameter is not set via the command line or environment,
312 # try to use settings from installed configuration files.
313
314 # Extract parameter settings from the obsolete install.cf file, as
315 # a transitional aid.
316
317 grep setgid_group $config_directory/main.cf >/dev/null 2>&1 || {
318 test -f $config_directory/install.cf && {
319 for name in sendmail_path newaliases_path mailq_path setgid manpages
320 do
321 eval junk=\$$name
322 case "$junk" in
323 "") eval unset $name;;
324 esac
325 eval : \${$name="\`. $config_directory/install.cf; echo \$$name\`"} \
326 || exit 1
327 done
328 : ${setgid_group=$setgid}
329 : ${manpage_directory=$manpages}
330 }
331 }
332
333 # Extract parameter settings from the installed main.cf file.
334
335 test -f $config_directory/main.cf && {
336 for name in $MOST_PARAMETERS
337 do
338 eval junk=\$$name
339 case "$junk" in
340 "") eval unset $name;;
341 esac
342 eval : \${$name=\`$POSTCONF -c $config_directory -h $name\`} || exit 1
343 done
344 }
345
346 # Sanity checks
347
348 case $manpage_directory in
349 no) echo $0: Error: manpage_directory no longer accepts \"no\" values. 1>&2
350 echo Try again with \"$0 manpage_directory=/pathname ...\". 1>&2; exit 1;;
351 esac
352
353 case $setgid_group in
354 no) echo $0: Error: setgid_group no longer accepts \"no\" values. 1>&2
355 echo Try again with \"$0 setgid_group=groupname ...\" 1>&2; exit 1;;
356 esac
357
358 for path in "$daemon_directory" "$command_directory" "$queue_directory" \
359 "$sendmail_path" "$newaliases_path" "$mailq_path" "$manpage_directory"
360 do
361 case "$path" in
362 /*) ;;
363 *) echo $0: Error: \"$path\" should be an absolute path name. 1>&2; exit 1;;
364 esac
365 done
366
367 for path in "$html_directory" "$readme_directory"
368 do
369 case "$path" in
370 /*) ;;
371 no) ;;
372 *) echo $0: Error: \"$path\" should be \"no\" or an absolute path name. 1>&2; exit 1;;
373 esac
374 done
375
376 # Find out what parameters were not specified via command line,
377 # via environment, or via installed configuration files.
378
379 missing=
380 for name in $MOST_PARAMETERS
381 do
382 eval test -n \"\$$name\" || missing="$missing $name"
383 done
384
385 # All parameters must be specified at this point.
386
387 test -n "$non_interactive" -a -n "$missing" && {
388 cat <<EOF | ${FMT} 1>&2
389 $0: Error: some required installation parameters are not defined.
390
391 - Either the parameters need to be given in the $config_directory/main.cf
392 file from a recent Postfix installation,
393
394 - Or the parameters need to be specified through the process
395 environment.
396
397 - Or the parameters need to be specified as name=value arguments
398 on the $0 command line,
399
400 The following parameters were missing:
401
402 $missing
403
404 EOF
405 exit 1
406 }
407
408 POSTCONF="$command_directory/postconf"
409
410 # Save settings, allowing command line/environment override.
411
412 override=
413 for name in $MOST_PARAMETERS
414 do
415 eval test \"\$$name\" = \"`$POSTCONF -c $config_directory -h $name`\" || {
416 override=1
417 break
418 }
419 done
420
421 test -n "$override" && {
422 $POSTCONF -c $config_directory -e \
423 "daemon_directory = $daemon_directory" \
424 "command_directory = $command_directory" \
425 "queue_directory = $queue_directory" \
426 "data_directory = $data_directory" \
427 "mail_owner = $mail_owner" \
428 "setgid_group = $setgid_group" \
429 "sendmail_path = $sendmail_path" \
430 "mailq_path = $mailq_path" \
431 "newaliases_path = $newaliases_path" \
432 "html_directory = $html_directory" \
433 "manpage_directory = $manpage_directory" \
434 "sample_directory = $sample_directory" \
435 "readme_directory = $readme_directory" \
436 || exit 1
437 }
438
439 # Use file/directory status information in $daemon_directory/postfix-files.
440
441 test -n "$create" && {
442 exec <$daemon_directory/postfix-files || exit 1
443 while IFS=: read path type owner group mode flags junk
444 do
445 IFS="$BACKUP_IFS"
446 set_permission=
447 # Skip comments. Skip shared files, if updating a secondary instance.
448 case $path in
449 [$]*) case "$update_shared_files" in
450 1) $debug keep non-shared or shared $path;;
451 *) non_shared=
452 for name in $NON_SHARED
453 do
454 case $path in
455 "\$$name"*) non_shared=1; break;;
456 esac
457 done
458 case "$non_shared" in
459 1) $debug keep non-shared $path;;
460 *) $debug skip shared $path; continue;;
461 esac;;
462 esac;;
463 *) continue;;
464 esac
465 # Skip hard links and symbolic links.
466 case $type in
467 [hl]) continue;;
468 [df]) ;;
469 *) echo unknown type $type for $path in $daemon_directory/postfix-files1>&2; exit 1;;
470 esac
471 # Expand $name, and canonicalize null fields.
472 for name in path owner group flags
473 do
474 eval junk=\${$name}
475 case $junk in
476 [$]*) eval $name=$junk;;
477 -) eval $name=;;
478 *) ;;
479 esac
480 done
481 # Skip uninstalled files.
482 case $path in
483 no|no/*) continue;;
484 esac
485 # Pick up the flags.
486 case $flags in *u*) upgrade_flag=1;; *) upgrade_flag=;; esac
487 case $flags in *c*) create_flag=1;; *) create_flag=;; esac
488 case $flags in *r*) recursive="-R";; *) recursive=;; esac
489 case $flags in *o*) obsolete_flag=1;; *) obsolete_flag=;; esac
490 case $flags in *[1i]*) test ! -r "$path" -a "$config_directory" != \
491 "$def_config_directory" && continue;; esac
492 # Flag obsolete objects. XXX Solaris 2..9 does not have "test -e".
493 if [ -n "$obsolete_flag" ]
494 then
495 test -r $path -a "$type" != "d" && obsolete="$obsolete $path"
496 continue;
497 else
498 keep_list="$keep_list $path"
499 fi
500 # Create missing directories with proper owner/group/mode settings.
501 if [ -n "$create" -a "$type" = "d" -a -n "$create_flag" -a ! -d "$path" ]
502 then
503 mkdir $path || exit 1
504 set_permission=1
505 # Update all owner/group/mode settings.
506 elif [ -n "$set_perms" ]
507 then
508 set_permission=1
509 # Update obsolete owner/group/mode settings.
510 elif [ -n "$upgrade_perms" -a -n "$upgrade_flag" ]
511 then
512 set_permission=1
513 fi
514 test -n "$set_permission" && {
515 chown $recursive $owner $path || exit 1
516 test -z "$group" || chgrp $recursive $group $path || exit 1
517 # Don't "chmod -R"; queue file status is encoded in mode bits.
518 if [ "$type" = "d" -a -n "$recursive" ]
519 then
520 find $path -type d -exec chmod $mode "{}" ";"
521 else
522 chmod $mode $path
523 fi || exit 1
524 }
525 done
526 IFS="$BACKUP_IFS"
527 }
528
529 # Upgrade existing Postfix configuration files if necessary.
530
531 test -n "$upgrade_conf" && {
532
533 # Postfix 2.0.
534 # Add missing relay service to master.cf.
535
536 grep '^relay' $config_directory/master.cf >/dev/null || {
537 echo Editing $config_directory/master.cf, adding missing entry for relay service
538 cat >>$config_directory/master.cf <<EOF || exit 1
539 relay unix - - n - - smtp
540 EOF
541 }
542
543 # Postfix 1.1.
544 # Add missing flush service to master.cf.
545
546 grep '^flush.*flush' $config_directory/master.cf >/dev/null || {
547 echo Editing $config_directory/master.cf, adding missing entry for flush service
548 cat >>$config_directory/master.cf <<EOF || exit 1
549 flush unix - - n 1000? 0 flush
550 EOF
551 }
552
553 # Postfix 2.1.
554 # Add missing trace service to master.cf.
555
556 grep 'trace.*bounce' $config_directory/master.cf >/dev/null || {
557 echo Editing $config_directory/master.cf, adding missing entry for trace service
558 cat >>$config_directory/master.cf <<EOF || exit 1
559 trace unix - - n - 0 bounce
560 EOF
561 }
562
563 # Postfix 2.1.
564 # Add missing verify service to master.cf.
565
566 grep '^verify.*verify' $config_directory/master.cf >/dev/null || {
567 echo Editing $config_directory/master.cf, adding missing entry for verify service
568 cat >>$config_directory/master.cf <<EOF || exit 1
569 verify unix - - n - 1 verify
570 EOF
571 }
572
573 # Postfix 2.1.
574 # Fix verify service process limit.
575
576 grep '^verify.*[ ]0[ ]*verify' \
577 $config_directory/master.cf >/dev/null && {
578 echo Editing $config_directory/master.cf, setting verify process limit to 1
579 ed $config_directory/master.cf <<EOF || exit 1
580 /^verify.*[ ]0[ ]*verify/
581 s/\([ ]\)0\([ ]\)/\11\2/
582 p
583 w
584 q
585 EOF
586 }
587
588 # Postfix 1.1.
589 # Change privileged pickup service into unprivileged.
590
591 grep "^pickup[ ]*fifo[ ]*n[ ]*n" \
592 $config_directory/master.cf >/dev/null && {
593 echo Editing $config_directory/master.cf, making the pickup service unprivileged
594 ed $config_directory/master.cf <<EOF || exit 1
595 /^pickup[ ]*fifo[ ]*n[ ]*n/
596 s/\(n[ ]*\)n/\1-/
597 p
598 w
599 q
600 EOF
601 }
602
603 # Postfix 1.1.
604 # Change private cleanup and flush services into public.
605
606 for name in cleanup flush
607 do
608 grep "^$name[ ]*unix[ ]*[-y]" \
609 $config_directory/master.cf >/dev/null && {
610 echo Editing $config_directory/master.cf, making the $name service public
611 ed $config_directory/master.cf <<EOF || exit 1
612 /^$name[ ]*unix[ ]*[-y]/
613 s/[-y]/n/
614 p
615 w
616 q
617 EOF
618 }
619 done
620
621 # Postfix 2.2.
622 # File systems have improved since Postfix came out, and all we
623 # require now is that defer and deferred are hashed because those
624 # can contain lots of files.
625
626 found=`$POSTCONF -c $config_directory -h hash_queue_names`
627 missing=
628 (echo "$found" | grep defer >/dev/null) || missing="$missing defer"
629 (echo "$found" | grep deferred>/dev/null)|| missing="$missing deferred"
630 test -n "$missing" && {
631 echo fixing main.cf hash_queue_names for missing $missing
632 $POSTCONF -c $config_directory -e hash_queue_names="$found$missing" ||
633 exit 1
634 }
635
636 # Turn on safety nets for new features that could bounce mail that
637 # would be accepted by a previous Postfix version.
638
639 # [The "unknown_local_recipient_reject_code = 450" safety net,
640 # introduced with Postfix 2.0 and deleted after Postfix 2.3.]
641
642 # Postfix 2.0.
643 # Add missing proxymap service to master.cf.
644
645 grep '^proxymap.*proxymap' $config_directory/master.cf >/dev/null || {
646 echo Editing $config_directory/master.cf, adding missing entry for proxymap service
647 cat >>$config_directory/master.cf <<EOF || exit 1
648 proxymap unix - - n - - proxymap
649 EOF
650 }
651
652 # Postfix 2.1.
653 # Add missing anvil service to master.cf.
654
655 grep '^anvil.*anvil' $config_directory/master.cf >/dev/null || {
656 echo Editing $config_directory/master.cf, adding missing entry for anvil service
657 cat >>$config_directory/master.cf <<EOF || exit 1
658 anvil unix - - n - 1 anvil
659 EOF
660 }
661
662 # Postfix 2.2.
663 # Add missing scache service to master.cf.
664
665 grep '^scache.*scache' $config_directory/master.cf >/dev/null || {
666 echo Editing $config_directory/master.cf, adding missing entry for scache service
667 cat >>$config_directory/master.cf <<EOF || exit 1
668 scache unix - - n - 1 scache
669 EOF
670 }
671
672 # Postfix 2.2.
673 # Add missing discard service to master.cf.
674
675 grep '^discard.*discard' $config_directory/master.cf >/dev/null || {
676 echo Editing $config_directory/master.cf, adding missing entry for discard service
677 cat >>$config_directory/master.cf <<EOF || exit 1
678 discard unix - - n - - discard
679 EOF
680 }
681
682 # Postfix 2.2.
683 # Update the tlsmgr fifo->unix service.
684
685 grep "^tlsmgr[ ]*fifo[ ]" \
686 $config_directory/master.cf >/dev/null && {
687 echo Editing $config_directory/master.cf, updating the tlsmgr from fifo to unix service
688 ed $config_directory/master.cf <<EOF || exit 1
689 /^tlsmgr[ ]*fifo[ ]/
690 s/fifo/unix/
691 s/[0-9][0-9]*/&?/
692 p
693 w
694 q
695 EOF
696 }
697
698 # Postfix 2.2.
699 # Add missing tlsmgr service to master.cf.
700
701 grep '^tlsmgr.*tlsmgr' $config_directory/master.cf >/dev/null || {
702 echo Editing $config_directory/master.cf, adding missing entry for tlsmgr service
703 cat >>$config_directory/master.cf <<EOF || exit 1
704 tlsmgr unix - - n 1000? 1 tlsmgr
705 EOF
706 }
707
708 # Postfix 2.2.
709 # Add missing retry service to master.cf.
710
711 grep '^retry.*error' $config_directory/master.cf >/dev/null || {
712 echo Editing $config_directory/master.cf, adding missing entry for retry service
713 cat >>$config_directory/master.cf <<EOF || exit 1
714 retry unix - - n - - error
715 EOF
716 }
717
718 # Postfix 2.5.
719 # Add missing proxywrite service to master.cf.
720
721 grep '^proxywrite.*proxymap' $config_directory/master.cf >/dev/null || {
722 echo Editing $config_directory/master.cf, adding missing entry for proxywrite service
723 cat >>$config_directory/master.cf <<EOF || exit 1
724 proxywrite unix - - n - 1 proxymap
725 EOF
726 }
727
728 # Postfix 2.5.
729 # Fix a typo in the default master.cf proxywrite entry.
730
731 grep '^proxywrite.*-[ ]*proxymap' $config_directory/master.cf >/dev/null && {
732 echo Editing $config_directory/master.cf, setting proxywrite process limit to 1
733 ed $config_directory/master.cf <<EOF || exit 1
734 /^proxywrite.*-[ ]*proxymap/
735 s/-\([ ]*proxymap\)/1\1/
736 p
737 w
738 q
739 EOF
740 }
741
742 # Postfix 2.8.
743 # Add missing postscreen service to master.cf.
744
745 grep '^#*smtp.*postscreen' $config_directory/master.cf >/dev/null || {
746 echo Editing $config_directory/master.cf, adding missing entry for postscreen TCP service
747 cat >>$config_directory/master.cf <<EOF || exit 1
748 #smtp inet n - n - 1 postscreen
749 EOF
750 }
751
752 # Postfix 2.8.
753 # Add missing smtpd (unix-domain) service to master.cf.
754
755 grep '^#*smtpd.*smtpd' $config_directory/master.cf >/dev/null || {
756 echo Editing $config_directory/master.cf, adding missing entry for smtpd unix-domain service
757 cat >>$config_directory/master.cf <<EOF || exit 1
758 #smtpd pass - - n - - smtpd
759 EOF
760 }
761
762 # Postfix 2.8.
763 # Add temporary dnsblog (unix-domain) service to master.cf.
764
765 grep '^#*dnsblog.*dnsblog' $config_directory/master.cf >/dev/null || {
766 echo Editing $config_directory/master.cf, adding missing entry for dnsblog unix-domain service
767 cat >>$config_directory/master.cf <<EOF || exit 1
768 #dnsblog unix - - n - 0 dnsblog
769 EOF
770 }
771
772 # Postfix 2.8.
773 # Add tlsproxy (unix-domain) service to master.cf.
774
775 grep '^#*tlsproxy.*tlsproxy' $config_directory/master.cf >/dev/null || {
776 echo Editing $config_directory/master.cf, adding missing entry for tlsproxy unix-domain service
777 cat >>$config_directory/master.cf <<EOF || exit 1
778 #tlsproxy unix - - n - 0 tlsproxy
779 EOF
780 }
781
782 # Report (but do not remove) obsolete files.
783
784 test -n "$obsolete" && {
785 cat <<EOF | ${FMT}
786
787 Note: the following files or directories still exist but are
788 no longer part of Postfix:
789
790 $obsolete
791
792 EOF
793 }
794
795 # Postfix 2.9.
796 # Safety net for incompatible changes in IPv6 defaults.
797 # PLEASE DO NOT REMOVE THIS CODE. ITS PURPOSE IS TO AVOID AN
798 # UNEXPECTED DROP IN PERFORMANCE AFTER UPGRADING FROM POSTFIX
799 # BEFORE 2.9.
800 # This code assumes that the default is "inet_protocols = ipv4"
801 # when IPv6 support is not compiled in. See util/sys_defs.h.
802
803 test "`$POSTCONF -dh inet_protocols`" = "ipv4" ||
804 test -n "`$POSTCONF -c $config_directory -nh inet_protocols`" || {
805 echo COMPATIBILITY: editing main.cf, setting inet_protocols=ipv4.
806 echo Specify inet_protocols explicitly if you want to enable IPv6.
807 echo In a future release IPv6 will be enabled by default.
808 $POSTCONF -c $config_directory inet_protocols=ipv4 || exit 1
809 }
810 }
811
812 # A reminder if this is the first time Postfix is being installed.
813
814 test -n "$first_install_reminder" && {
815
816 ALIASES=`$POSTCONF -c $config_directory -h alias_database | sed 's/^[^:]*://'`
817 NEWALIASES_PATH=`$POSTCONF -c $config_directory -h newaliases_path`
818 cat <<EOF | ${FMT}
819
820 Warning: you still need to edit myorigin/mydestination/mynetworks
821 parameter settings in $config_directory/main.cf.
822
823 See also http://www.postfix.org/STANDARD_CONFIGURATION_README.html
824 for information about dialup sites or about sites inside a
825 firewalled network.
826
827 BTW: Check your $ALIASES file and be sure to set up aliases
828 that send mail for root and postmaster to a real person, then
829 run $NEWALIASES_PATH.
830
831 EOF
832
833 }
834
835 exit 0
836