summaryrefslogtreecommitdiff
path: root/debian/local/sendmailconfig
blob: adbb51302aa291a700d5b399ee5dc8d3b5582622 (plain)
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
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
#!/bin/sh -e
#-----------------------------------------------------------------------------
# $Sendmail: sendmailconfig,v 8.14.3 2008-05-04 22:26:20 cowboy Exp $
#
# Interactively configure Sendmail for Debian
#
# Copyright (c) 1998-2008 Richard Nelson.  All Rights Reserved.
#
# Robert Leslie <rob@mars.org>,
# Rick Nelson <cowboy@debian.org>
#
#-----------------------------------------------------------------------------
set -e;

PATH='/usr/sbin:/usr/bin:/sbin:/bin';
SENDMAIL_MC="/etc/mail/sendmail.mc";
SUBMIT_MC="/etc/mail/submit.mc";

# Path to other sendmail helpers
if [ -x ./update_sendmail ]; then
	sm_path='.';
elif [ -x $(dirname $0)/update_sendmail ]; then
	sm_path=$(dirname $0);
else
	sm_path=/usr/share/sendmail;
	fi;
# Bring in sendmail.conf for the network definitions
if [ ! -f /etc/mail/sendmail.conf ]; then
	if [ -x $sm_path/update_conf ]; then
		$sm_path/update_conf;
		fi;
	fi; 
if [ -f /etc/mail/sendmail.conf ]; then
	. /etc/mail/sendmail.conf;
	fi;

set +e;
reload="yes";
umask 022;

#------------------------------------------------------------------------------

while [ $# -gt 0 ]; do
	case "$1" in
		--no-reload)
			reload="";
			shift;
			;;

		*)
			echo "Usage: $0 [--no-reload]" >&2;
			exit 1;
			;;
		esac;
	done;

#------------------------------------------------------------------------------

descrip() {
	echo '';
	echo "$1";
	echo "$1" | sed -e 's/./-/g';
	cat -;
	echo '';
	};

yesno() {
	local N='N' Y='Y';
	local q="$1" def=$(eval "echo -n \$$2");

	while :; do
	echo -n "$q? [$def] ";
	read REPLY;
	REPLY=$(echo -n "$REPLY" | sed -e "s/^\ *//" -e "s/^\t*//");
	test -n "$REPLY" || REPLY="$def";

	case "$REPLY" in
		[Yy]*)
			echo yes > /dev/null;
			eval "$2=\"Y\"";
			return 0;
			;;
		[Nn]*)
			echo no > /dev/null;
			eval "$2=\"N\"";
			return 1;
			;;
		esac;
	done;
	};

input() {
	local q="$1" def=$(eval "echo -n \$$2");

	echo -n "$q? [$def] ";
	read REPLY
	REPLY=$(echo "$REPLY" | sed -e 's/^[	]*//' -e 's/[	]*$//' | cat);
	test -n "$REPLY" || REPLY="$def";

	if [ "NONE" = "$3" ]; then
		case "$REPLY" in
			[Nn][Oo][Nn][Ee]*)
				REPLY='';
				;;
			esac;
		fi;

	eval "$2=\"$REPLY\"";
	};

testconfig() {
	CONFIG=$(grep -Ee "^[[:space:]]*$1" $SENDMAIL_MC 2>/dev/null);
	};

makecf() {
	if [ -x $sm_path/update_sendmail ]; then
		echo "Updating sendmail environment ...";
		$sm_path/update_sendmail || true;
		fi;

	if [ "$reload" ] &&  \
		yesno \
		"Reload the running sendmail now with the new configuration" Y
		then
		echo "Reloading sendmail ...";
		/etc/init.d/sendmail reload >/dev/null;
		fi;
}

#------------------------------------------------------------------------------

if [ -f $SENDMAIL_MC ]; then
	if yesno "Configure sendmail with the existing /etc/mail/sendmail.conf" Y
	then
		if ! $sm_path/update_conf; then
			echo "Correct /etc/mail/sendmail.conf before continuing.";
			exit 1;
			fi;
	else
		echo "Edit /etc/mail/sendmail.conf and reissue $0.";
		exit 0;
		fi;
	if yesno "Configure sendmail with the existing $SENDMAIL_MC" Y
	then
		makecf;
		exit 0;
		fi;
	fi;

###############################################################################

exec 3>$SENDMAIL_MC.new;
trap "rm -f $SENDMAIL_MC.new" 0;

###############################################################################

descrip "Sendmail Configuration" <<-EOT
By answering the following questions, you can configure sendmail for your
system. Default values are determined either by your existing configuration
or from common usage.
EOT

echo -n "Press [ENTER] ";
read REPLY;

cat /usr/share/sendmail/cf/debian/sendmail.mc >&3;
cp -a /usr/share/sendmail/cf/debian/submit.mc \
	$SUBMIT_MC.new;
echo "LOCAL_CONFIG" >&3;

###############################################################################

descrip "Mail Name" <<EOT
Your \`mail name' is the hostname portion of the address to be shown on
outgoing news and mail messages (following the username and @ sign). This
name will be used by other programs besides sendmail; it should be the single,
full domain name (FQDN) from which mail will appear to originate.
EOT

mailname=$(cat /etc/mailname 2>/dev/null || hostname --fqdn);
input "Mail name" mailname;

echo "$mailname" >/etc/mailname;

###############################################################################

descrip "Null Client" <<EOT
A special configuration known as the "null client" can be created for this
host if all mail should be forwarded to a central hub via a local SMTP-based
network. This may be a suitable configuration if you want to forward all of
your mail to your local Internet service provider (ISP) for delivery.

To enable this option, give the name of the host to which all mail should be
forwarded. Otherwise leave the option empty to disable it.
To remove a prior name, use \`NONE'.
EOT

nullclient=""
! testconfig "FEATURE\(\`?nullclient" ||
	nullclient=$(echo -n "$CONFIG" | sed -e 's/[^,]*, *\([^)]*\).*/\1/');

input "Null client forward host" nullclient NONE;

if [ ! -z "$nullclient" ]; then
	echo "EXPOSED_USER(root uucp)dnl # users exempt from masquerading" >&3;
	echo "LOCAL_USER(root)dnl" >&3;
	echo "MASQUERADE_AS(\`$mailname')dnl" >&3;
	echo "FEATURE(\`allmasquerade')dnl" >&3;
	echo "FEATURE(\`masquerade_envelope')dnl" >&3;
	echo "FEATURE(\`nullclient', $nullclient)dnl" >&3;
	fi;

if [ -z "$nullclient" ]; then

###############################################################################
descrip "Smart Host" <<EOT
A "Smart Host" is one that can deliver mail to external machines.  By using
a "Smart Host", we don't need DNS, or good connectivity ourselves.	This is
most likely what you want if you have a dialup link, or sit behind a firewall.

To enable this option, give the name of the host to which all non-local mail
should be forwarded.  Otherwise leave the option empty.
To remove a prior name, use \`NONE'.
EOT

smarthost="";
#if [ -n "$nullclient" ]; then
#	smarthost="$nullclient"
#	fi
! testconfig "define\(\`?SMART_HOST" ||
	 smarthost=$(echo -n "$CONFIG" | sed -e 's/[^:]*:*\([^)]*\).*/\1/');
input "Smart Host:" smarthost NONE;

if [ -n "$smarthost" ]; then
	echo "define(\`SMART_HOST', $smarthost)dnl" >&3;
	echo "MASQUERADE_AS(\`$mailname')dnl" >&3;
	fi;
#if [ -n "$nullclient" ] && [ ! -z "$smarthost" ]; then
#	echo "undefine(\`ALIAS_FILE')dnl" >&3
#	echo "define(\`confFORWARD_PATH', \`')dnl" >&3
#	echo "define(\`MAIL_HUB', \`$smarthost')dnl" >&3
#	echo "MASQUERADE_AS(\`$smarthost')dnl" >&3
#	echo "FEATURE(\`allmasquerade')dnl" >&3
#	echo "FEATURE(\`masquerade_envelope')dnl" >&3
#	fi
###############################################################################

descrip "Address Canonification" <<EOT
Usually sendmail will canonify all addresses by consulting a name server and
resolving hosts to their fully qualified domain name (FQDN). Under special
circumstances you may want to disable this feature, for example if this
machine acts only as a mail gateway.
EOT

test -z "$nullclient" || cat <<EOT
Since this host will be configured as a null client, this option controls
whether addresses will be qualified with \`$mailname' when
sent to the central hub via SMTP. Disabling this feature may cause mail to
appear to come from (and be qualified by the domain for) the hub machine
rather than this host.

EOT

nocanonify="N";
! testconfig "FEATURE\(\`?nocanonify" || nocanonify="Y";

! yesno "Disable address canonification" nocanonify || \
	echo "FEATURE(\`nocanonify')dnl" >&3;

###############################################################################

#descrip "SMTP Mailer" <<EOT
#If you plan to exchange mail with other computers, you should enable the
#SMTP mailer. Even if you don't plan to exchange mail with other computers,
#it is still a good idea to enable this so local programs can use it.
#EOT

smtp="Y";
#if [ -f $SENDMAIL_MC ]; then
#	testconfig "MAILER\(\`?smtp" || smtp="N";
#fi;

#yesno "Enable the SMTP mailer" smtp || true;

###############################################################################

descrip "Masquerade Envelope" <<EOT
If you want mail envelopes (as well as mail headers) to appear to come from
\`$mailname', you can enable this option.
EOT

masqenvelope="Y";
if [ -f $SENDMAIL_MC ]; then
	testconfig "FEATURE\(\`?masquerade_envelope" || masqenvelope="N";
fi;

! yesno "Masquerade envelopes" masqenvelope || \
	echo "FEATURE(\`masquerade_envelope')dnl" >&3;

###############################################################################

descrip "All Masquerade" <<EOT
If enabled, this feature will cause recipient addresses to also appear to come
from \`$mailname'. Normally they get the local hostname.
Although this may be right for ordinary users, it can break local aliases. For
example, if you send to "localalias", the originating sendmail will find that
alias and send to all members, but send the message with
"To: localalias@$mailname". Since that alias likely does
not exist, replies will fail. Use this feature ONLY if you can guarantee that
the ENTIRE namespace of \`$mailname' supersets all the
local entries. If in doubt, it is safe to leave this option disabled.
EOT

allmasquerade="N";
! testconfig "FEATURE\(\`?allmasquerade" || allmasquerade="Y";

! yesno "All masquerade" allmasquerade || \
	echo "FEATURE(\`allmasquerade')dnl" >&3;

###############################################################################

descrip "Dont masquerade mail to local users" <<EOT
Send mail to local recipients without masquerading.
EOT

local_no_masquerade="N";
! testconfig "FEATURE\(\`?local_no_masquerade" || local_no_masquerade="Y";

! yesno "Dont masquerade local" local_no_masquerade ||
	echo "FEATURE(\`local_no_masquerade')dnl" >&3;

###############################################################################

descrip "Always Add Domain" <<EOT
If enabled, the local host domain is included even on locally delivered mail.
Normally it is not added unless it is already present.
EOT

alwaysdomain="N";
! testconfig "FEATURE\(\`?always_add_domain" || alwaysdomain="Y";

! yesno "Always add domain" alwaysdomain || \
	echo "FEATURE(\`always_add_domain')dnl" >&3;

###############################################################################

descrip "Mail Acceptance" <<EOT
Sendmail is usually configured to accept mail for your mail name
($mailname). However, under special circumstances you
may not wish sendmail to do this, particularly if (and disabling this option
generally requires that) mail for \`$mailname' is MXed
to another host. If in doubt, it is safe to leave this option enabled.
EOT

acceptmailname="Y";
if [ -f $SENDMAIL_MC ]; then
	testconfig "^Cw.*$mailname" || acceptmailname="N";
fi;

yesno "Accept mail for \`$mailname'" acceptmailname || true;
test "N" = "$acceptmailname" || \
	echo "LOCAL_CONFIG
Cw$mailname" >&3;

###############################################################################

descrip "Alternate Names" <<EOT
In addition to the canonical mail name \`$mailname', you can
add any number of additional alternate names to recognize for receiving mail.
If other hosts are MXed to you for local mail, this is where you should list
them. This list is saved into the file /etc/mail/local-host-names
so it can be changed later as needed.

To answer this question, separate each alternate name with a space, or answer
\`NONE' to eliminate all alternate names.
EOT

cw_file="/etc/mail/local-host-names";
altnames=$(cat "$cw_file" 2>/dev/null | tr -s '\n \t' ' ' |
		   sed -e 's/^ *//' -e 's/ *$//');
input "Alternate names" altnames NONE;

if [ -n "$altnames" ]; then
	echo "$altnames" | tr -s ' \t' '\n' >$cw_file;
else
	echo "localhost" >$cw_file;
fi;
	chown root:smmsp $cw_file;
	chmod 0644 $cw_file;

echo "FEATURE(\`use_cw_file')dnl" >&3;

###############################################################################

descrip "Trusted Users" <<EOT
Sendmail allows a special group of users to set their envelope "From" address
using the -f option without generating a warning message. If you have
software such as Majordomo installed, you will want to include the usernames
from such software here. Note that "root", "daemon", and "uucp" are included
automatically and do not need to be specified. This list is saved into the
file /etc/mail/trusted-users so it can be changed later as needed.

To answer this question, separate each username with a space, or answer
\`NONE' to eliminate all usernames.
EOT

ct_file="/etc/mail/trusted-users";
trusted=$(cat "$ct_file" 2>/dev/null | tr -s '\n \t' ' ' |
		  sed -e 's/^ *//' -e 's/ *$//');
input "Trusted users" trusted NONE;

if [ -n "$trusted" ]; then
	echo "$trusted" | tr -s ' \t' '\n' >$ct_file;
	chown root:smmsp $ct_file;
	chmod 0644 $ct_file;
else
	cat /dev/null >$ct_file;
fi;

echo "FEATURE(\`use_ct_file')dnl" >&3;
echo "FEATURE(\`use_ct_file')dnl" >> $SUBMIT_MC.new;

###############################################################################

descrip "Redirect Feature" <<EOT
If enabled, this feature will allow you to alias old names to
<new-address>.REDIRECT, causing sendmail to return mail to the sender with
an error but indicating the recipient's new address.
EOT

redirect="N";
! testconfig "FEATURE\(\`?redirect" || redirect="Y";

! yesno "Enable redirect option" redirect || \
	echo "FEATURE(\`redirect')dnl" >&3;

###############################################################################

descrip "UUCP Addresses" <<EOT
Sendmail can be configured to be smart about UUCP addresses, or it can do
nothing special with UUCP addresses at all. If you care about UUCP, you will
need to do some additional configuration, perhaps outside of this script.

*** NOTE *** If you use a smart host or do any kind of forwarding (ie
LUSER_RELAY and LOCAL_RELAY), it is important that you say "Yes"
here to prevent a multi-level relay hole - unless you know for *SURE* that
your smart-host does not deal with UUCP addresses.

(Be safe and just say Y)
EOT

uucp="Y";
if [ -f $SENDMAIL_MC ]; then
	testconfig "FEATURE\(\`?nouucp" || uucp="Y";
fi;

yesno "Enable UUCP addressing" uucp || \
	echo "FEATURE(\`nouucp', \`reject')dnl" >&3;

###############################################################################

descrip "Sticky Host" <<EOT
If enabled, mail sent to \`user@$mailname' is marked as
"sticky" -- that is, the local addresses aren't matched against UDB and don't
go through ruleset 5. This is used if you want a setup where \`user' is not
necessarily the same as \`user@$mailname', e.g., to make
a distinct domain-wide namespace. If in doubt, it is safe to leave this
option disabled.
EOT

sticky="N";
! testconfig "FEATURE\(\`?stickyhost" || sticky="Y";

! yesno "Enable sticky host option" sticky || \
	echo "FEATURE(\`stickyhost')dnl" >&3;

###############################################################################

descrip "DNS" <<EOT
If you are directly connected to the Internet and have access to a domain
name server, you should enable this option.
EOT

dns="Y";
! testconfig "FEATURE\(\`?nodns" || dns="N";
! testconfig "HACK\(\`?nodns" || dns="N";

yesno "Enable DNS" dns || \
	echo "HACK(\`nodns')dnl" >&3;

###############################################################################

if [ Y = "$dns" ]; then

###############################################################################

descrip "Best MX is Local" <<EOT
If enabled, this option will cause sendmail to accept mail as though locally
addressed for any host that lists this machine as the best possible MX record.
This generates additional DNS traffic, but should be OK for low-to-medium
traffic hosts. N.B.: This feature is fundamentally incompatible with wildcard
MX records. If you have a wildcard MX record that matches your domain, you
cannot use this feature.
EOT

bestmxlocal="N";
! testconfig "FEATURE\(\`?bestmx_is_local" || bestmxlocal="Y";

! yesno "Assume best MX is local" bestmxlocal || \
	echo "FEATURE(\`bestmx_is_local')dnl" >&3;

###############################################################################

fi;  # finished DNS configuration

###############################################################################

descrip "Mailertable" <<EOT
If enabled, this option causes sendmail to read mail routing rules from
the text file /etc/mail/mailertable.  This is needed for unusual mailers like
ifmail and fax programs.
More information is in /usr/share/doc/sendmail-doc/op/op.txt.gz.
EOT

mailertable="N";
! testconfig "FEATURE\(\`?mailertable" || mailertable="Y";

! yesno "Enable the mailertable feature" mailertable || \
	echo "FEATURE(\`mailertable')dnl" >&3;

###############################################################################

descrip "Sendmail Restricted Shell" <<EOT
If enabled, this option causes sendmail to use the sendmail restricted shell
program (smrsh) instead of /bin/sh for mailing to programs. This improves your
ability to control what gets run via email; only those programs which appear
in a special directory can be run. If you enable this option, please carefully
read the smrsh(8) man page for further information.
EOT

smrsh="Y";
! testconfig "FEATURE\(\'?smrsh" || smrsh="Y";

! yesno "Use the Sendmail Restricted Shell (smrsh)" smrsh || \
	echo "FEATURE(\`smrsh', \`/usr/lib/sm.bin/smrsh')dnl" >&3;

###############################################################################

#descrip "Mailer Name" <<EOT
#You can change the name used for internally generated outgoing messages.
#Usually this is \`MAILER-DAEMON' but it would not be unreasonable to change
#it to something such as \`postmaster'.
#EOT

#daemon="MAILER-DAEMON";
#! testconfig "define\(\`?confMAILER_NAME" ||
#	daemon=$(echo -n "$CONFIG" | sed -e 's/[^,]*, *`\([^'"'"']*\).*/\1/');

#input "Mailer name" daemon;

#test "MAILER-DAEMON" = "$daemon" ||
#	echo "define(\`confMAILER_NAME', \`$daemon')dnl" >&3;

###############################################################################

#descrip "Me Too" <<EOT
#Sendmail normally excludes the sender address from group expansion. Enabling
#this option will cause the sender to be included.
#EOT

#metoo="N";
#! testconfig "define\(\`?confME_TOO.*True" || metoo="Y";

#! yesno "Enable me too option" metoo ||
#	echo "define(\`confME_TOO', True)dnl" >&3;

###############################################################################

descrip "Message Timeouts" <<EOT
Sendmail will issue a warning message to the sender if it can't deliver a
message within a reasonable amount of time. It will also send a failure
notification and give up trying to deliver the message if it can't deliver it
after an unreasonable amount of time.

You can configure the message timeouts after which warning and failure
notifications are sent. Sendmail's defaults are 4 hours and 5 days (4h/5d),
respectively, but many people feel warnings after only 4 hours are premature.
EOT

qw="4h";
! testconfig "define\(\`?confTO_QUEUEWARN" ||
	qw=$(echo -n "$CONFIG" | sed -e 's/[^,]*, *`\([^'"'"']*\).*/\1/');

qr="5d";
! testconfig "define\(\`?confTO_QUEUERETURN" ||
	qr=$(echo -n "$CONFIG" | sed -e 's/[^,]*, *`\([^'"'"']*\).*/\1/');

timeouts="$qw/$qr";

input "Message timeouts" timeouts;

qw=$(expr "$timeouts" : '\([^/]*\)/');
qr=$(expr "$timeouts" : '[^/]*/\(.*\)');

test "4h" = "$qw" || echo "define(\`confTO_QUEUEWARN', \`$qw')dnl" >&3;
test "5d" = "$qr" || echo "define(\`confTO_QUEUERETURN', \`$qr')dnl" >&3;

###############################################################################
# Support dialup configuration
cat <<-EOT >&3
dnl #
dnl # Dialup/LAN connection overrides
dnl #
include(\`/etc/mail/m4/dialup.m4')dnl
include(\`/etc/mail/m4/provider.m4')dnl
dnl #
EOT

###############################################################################
echo "MAILER_DEFINITIONS" >&3
echo "MAILER(local)dnl" >&3

test "N" = "$smtp" || echo "MAILER(smtp)dnl" >&3;

###############################################################################

if [ -e /etc/ifmail/config ] && \
	[ -e /usr/share/sendmail/cf/mailer/ifmail.m4 ];
then
	echo "MAILER(ifmail)dnl" >&3;
fi;

###############################################################################

fi;  # finished non-"null client" configuration


###############################################################################

echo "" >&3;
echo "LOCAL_CONFIG" >&3;
#if [ -z $nullclient ]; then
#	echo "MASQUERADE_AS($mailname)dnl" >&3
#	fi

if [ -f $SENDMAIL_MC ]; then
	sed -n -e '/^## Custom/,$p' $SENDMAIL_MC >&3;
else
	echo "## Custom configurations below (will be preserved)" >&3;
fi;

descrip "Configuration Complete" <<EOT
Advanced configuration, such as alternate mailers, the use of mailertables,
Bitnet domains, and UUCP domains can be accomplished by manually editing the
$SENDMAIL_MC configuration file and rerunning
\`$0' to generate the appropriate /etc/mail/sendmail.cf
file. (Local changes made at the end of $SENDMAIL_MC
will be preserved by \`$0'.)

The m4 library files for sendmail configuration are kept in the
/usr/share/sendmail/cf directory. You may wish to review the
documentation in /usr/share/doc/sendmail to assist in further customization.

You may wish to customize your alias database; see the aliases(5) man page
for information on the format and use of the /etc/aliases file.
EOT

###############################################################################

exec 3>&-;

if [ -f $SENDMAIL_MC ];then
	echo "Saving old $SENDMAIL_MC as $SENDMAIL_MC.old ...";
	mv -f $SENDMAIL_MC $SENDMAIL_MC.old;
	fi;

chown root:smmsp $SENDMAIL_MC.new;
chmod 0644 $SENDMAIL_MC.new;
mv -f $SENDMAIL_MC.new $SENDMAIL_MC;
if [ ! -f /usr/share/sendmail/cf/feature/msp.m4 ]; then
	chown root:smmsp $SUBMIT_MC.new;
	chmod 0644 $SUBMIT_MC.new;
	mv -f $SUBMIT_MC.new $SUBMIT_MC;
	fi;
trap - 0;

makecf;
exit 0;