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 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722
|
#!/usr/bin/perl --
# Semiautomatic configuration script for Debian's Smail package.
# Used after installation to configure a mail system, and can be run
# at any later time (though --force may be needed).
# Copyright 1994 Ian Jackson. There is NO WARRANTY.
# Copyright 1997 Soenke Lange
# See /usr/doc/smail/copyright or type smail -bC for more information.
$|=1;
$etc='/etc';
$testmsg='smailtest';
if ($ARGV[0] eq '--force') { $force=1; shift; }
if (-s "$etc/smail/routers") {
if ($force) {
print "Ignoring existing Smail configuration.\n";
} else {
print "Your mail system (Smail) is already configured; I\'ll leave\n";
print "the existing configuration untouched. \n\n";
print "Use --force to ignore it.\n";
exit(0);
}
}
$rfc1035_label_re= '[A-Za-z]([-0-9A-Za-z]*[0-9A-Za-z])?';
$rfc1035_domain_re= "$rfc1035_label_re(\\.$rfc1035_label_re)*";
$rfc1035_domain_explain=
"Each component must start with a letter, end with an alphanum and ".
"contain\n only alphanums and hyphens. Components must be separated ".
"by full stops.";
chop($syshostname=`hostname --fqdn`);
$? && die "hostname --fqdn gave non-zero exit code $? $syshostname\n";
if ($syshostname !~ m/^$rfc1035_domain_re$/) {
print STDERR "Error: system's FQDN hostname ($syshostname) doesn't match\n".
"RFC1035 syntax; cannot configure the mail system.\n";
exit(1);
}
open(P,"</etc/passwd") || die "cannot read /etc/passwd: $!\n";
@passwd1=@passwd2=<P>;
close(P);
@redirusers= grep(s/^(\w+):([^:]+):(\d+):\d+:.*\n/$1/ &&
length($2) < 13 && $3 < 100, @passwd1);
$defaultpostmaster= (grep(s/^(\w+):([^:]+):(\d+):\d+:.*\n/$1/ &&
length($2) >= 13 && $3 >= 100, @passwd2))[0];
$redirinmessage= join(' ',@redirusers);
push(@redirusers,'');
$redirinalias= join(": root\n",@redirusers);
for (;;) {
undef @files;
# Which major configuration ?
next unless &query(
"I can do certain kinds of automatic configuration of your mail system, by
asking you a number of questions. Later you may want to confirm and/or correct
your answers. In any case, comprehensive information on configuring Smail is
in smail(5) and in /usr/doc/smail/examples and /usr/doc/smail/guide.
You must choose one of the options below:
(1) Internet site: you send and receive Internet mail on this
machine, using SMTP over TCP/IP, select this if you have a smarthost
reachable over SMTP.
(2) UUCP to smarthost (upstream site):
You send and receive mail via UUCP; outbound mail is sent to your
smarthost (probably your service provider) for routing and delivery.
(3) No mail is to be delivered or routed here. Any mail generated on this
system is sent to a central mail switch using SMTP. This configuration is
for workstation, which have mounted /var/spool/mail from a central server.
(4) Local delivery only:
You are not on a network. Mail for local users is delivered.
(5) No configuration will be done now; your mail system will be broken and
should not be used. Use /usr/sbin/smailconfig as root, later.
Select a number from 1 to 5, from the list above.",
'configtype',
-f '/usr/sbin/inetd' ? '1' :
-f '/usr/bin/uucp' ? '2' : '4',
'm/^[12345]$/');
if ($configtype == 5) {
print "\nMail configuration skipped.\n";
print "WARNING: Do not start smail until you have configured it!\n";
print "A sample configuration can be found in /usr/doc/smail/example\n";
exit 0;
}
if ($configtype == 2 && !-x '/usr/bin/uux') {
print "
Warning! You don't appear to have UUCP installed. In this configuration
your mailer will be unable to handle offsite mail without it.\n\n";
}
# What are the hostnames for this system ?
&query(
"What is the `visible' mail name of your system ?
This will appear on From: lines of outgoing messages.",
'visiblename',
$syshostname,
'm/^$rfc1035_domain_re$/ ||
&reswarn("This must conform to RFC1035\'s requirements.\n".
"$rfc1035_domain_explain")') || next if $configtype < 4;
$visiblename= $syshostname if $configtype == 4;
&setfileshort("mailname","$visiblename\n");
&query(
"Does this system have any other names which may appear on incoming
mail messages, apart from the visible name above ($visiblename)
and the system's hostname ($syshostname) ?
If so enter them here, separated with spaces or commas. If there are
none, say \`none'.",
'hostnames',
'none',
'1', 'e') || next if $configtype < 3;
@names= $configtype < 3 ? split(/[ \t,]+/,$hostnames) : ();
$warnexh= 0;
grep(((m/^$rfc1035_domain_re$/ ||
($warnexh= 1,
(print STDERR "\n Warning - name \`$_' doesn't conform to RFC1035's".
" requirements.")))),
@names);
if ($warnexh) { print STDERR "\n$rfc1035_domain_explain\n"; }
unshift(@names, $visiblename) unless $configtype == 3;
unshift(@names, $syshostname) unless $syshostname eq $visiblename;
$colonhostnames= 'hostnames='.join(':',@names);
# Is there a smarthost and what is it called ?
&query(
"Do you have a smarthost available (and accessible via SMTP) ?
A smarthost is a system to which you forward mail you don\'t want to
deliver yourself; it presumably has better connectivity or routing
information than you do. Commercial providers usually provide a
smarthost for their customers, and large organisations will often have
a site mail switch which can be used. Use of a smarthost is strongly
recommended (you\'ll be able to specify exactly when to use it soon).
If a smarthost is available please enter its name (otherwise, \`none').",
'smarthost',
'',
'$_ eq "" || m/^$rfc1035_domain_re$/ ||
&reswarn("This must conform to RFC1035\'s requirements.\n".
"$rfc1035_domain_explain")',
'e') || next if $configtype == 1;
# When should we use the smarthost ?
&query(
"Do you wish to use the smarthost for:
(1) All outbound mail. This is good if your system is poorly
connected, eg via dialup SLIP, as you don't have to talk
to distant machines yourself, and it allows you to send out
just one copy of a message for all its the remote recipients.
(2) Mail that you have failed to find a way to route. This
means that mail for any unknown hosts or domains will be
sent to the smarthost in the hope that it will know better;
if it doesn\'t the smarthost should bounce it back to you.
This is recommended for most situations, and usually results
in faster end-to-end delivery than always using the smarthost.
(3) Only mail to the \`awkward' UUCP and BITNET domains.
These domains don't appear in the Internet routing tables,
and how to reach them varies depending on your location.
Use this if your smarthost\'s admin has asked you to avoid using
the smarthost unnecessarily, or if it is unreliable or very slow.
Select a number from 1 to 3, from the list above.",
'smartwhen',
'2',
'm/^[123]$/') || next if $configtype == 1 && length($smarthost);
$usesmarthost = $configtype == 3 ? 4 :
length($smarthost) ? 4-$smartwhen : 0;
# What is smarthost/smartuser for satellite systems ?
&query(
"You have to tell me where to send all locally-generated mail.
Using $visiblename will result in mail for local users being sent
to whatever system the rest of the world thinks deals with mail for
that address - that had better not be this machine, in that case.",
'smarthost',
$visiblename,
'm/^$rfc1035_domain_re$/ ||
&reswarn("This must conform to RFC1035\'s requirements.\n".
"$rfc1035_domain_explain")') || next if $configtype == 3;
# What is smarthost/smartuser for UUCP leaf nodes ?
&query(
"You have to tell me where to send email bound for remote systems, by telling
me the UUCP name of your smarthost (probably your service provider).",
'smarthost',
'',
'1') || next if $configtype == 2;
# Who is to receive postmaster mail ?
&query(
"Mail for the \`postmaster' and \`root' accounts is usually redirected
to one or more user accounts, of the actual system administrators.
By default, I'll set things up so that mail for \`postmaster' and for
various system accounts is redirected to \`root', and mail for \`root'
is redirected to a real user. This can be changed by editing /etc/aliases.
Note that postmaster-mail should usually be read on the system it is
directed to, rather than being forwarded elsewhere, so (at least one of)
the users you choose should not redirect their mail off this machine.
Which user account(s) should system administrator mail go to ?
Enter one or more usernames separated by spaces or commas . Enter
\`none' if you want to leave this mail in \`root's mailbox - NB this
is strongly discouraged. Also, note that usernames should be lowercase !",
'postmasters',
$defaultpostmaster,
'm/^([-_a-z0-9]+[ \t,]*)*$/ ||
&reswarn("\nUsernames must consist of lowercase alphanums, or - and _.\n")',
'e') || next unless $configtype == 3;
@postmasters= split(/[ \t,]+/,$postmasters);
$rootalias= @postmasters ? "root: ".join(',',@postmasters)."\n" : '';
# now do it ...
&setfile('smail/config',
'# This is the main Smail configuration file.
# Debian Config Version 2',
"
visible_name=$visiblename
more_hostnames=localhost
-domains
$colonhostnames
". ($configtype =~ m/[13]/ ?
'max_load_ave=5
smtp_accept_max=20
smtp_accept_queue=10
rfc1413_query_timeout=15
':''). ($configtype == 2 ?
'spool_grade=C
':'').
'require_configs
-second_config_file
-qualify_file
-retry_file
copying_file=/usr/doc/smail/copyright
max_message_size=10M
# Debian Config Version 2.1
# ----------Begin-----------
# You really should know what you do here!
#WARNING: You will have to add a correct local definition for
# smtp_remote_allow if you have many local networks, or unset it
# if you wish to disable this feature (default).
#WARNING: The current implementation of this feature blocks
# relay from incoming SMTP to *any* outgoing transport. This
# means that even UUCP gateways require explicit permission if
# this feature is enabled.
# it\'s no longer off by default, so all hosts can relay mails over this host.
# as internet get more and more on the dark side ....
# only mails from the localnet are relayed
smtp_remote_allow=localnet
# This flag tells smail to verify the hostnames given in
# HELO or EHLO SMTP commands.
# it\'s off by default
# example to switch it on:
#+smtp_hello_verify
# more helo/ehlo verify switches, see manpages for details
#smtp_hello_verify_literal
#smtp_hello_verify_ptr
# A colon-separated list of host IP patterns that are
# allowed to deliver mail even though they have broken
# DNS or give incorrect or invalid HELO or EHLO SMTP
# greetings.
# it\'s off by default, which mean smtp_hello_broken_allow=*
# example to switch it on:
#smtp_hello_broken_allow=192.168.100.*
# Vixie / MAPS RBL (http://maps.vix.com/rbl)
# switch to turn on the Mail Abuse Protection System (MAPS)
# it\'s off by default
# example to switch it on:
#+vixie_rbl
#vixie_rbl_force_allow="192.168.100.10:[your local ip#]"
# Do not do dns lookups for MAIL FROM: address
# This is debian-Smail only feature... it WILL BE DELETED in the future
# It\'s only use is for local systems with no working dns System
# It\'s off by default
# example to switch it on:
#+smtp_sender_verify
received_field="Received: ${if def:sender_host\
{from $sender_host${if def:sender_host_addr\
{ (really [$sender_host_addr])}} }\
else {${if def:sender_host_addr\
{from [$sender_host_addr] }}}}\
by $visible_name\n\t\
${if def:sender_program\
{via $sender_program }}\
${if def:sender_proto\
{with $sender_proto}\
else {from stdin}}\
${if def:ident_sender\
{ (ident $ident_sender using $ident_method)}}\n\t\
id <$message_id@$primary_name> (Debian Smail$version)\n\t\
${if def:input_addr\
{for ${top:input_addr}}\
else {for <unknown>}}\
; $spool_date "
');
$confdescrip=
"Mail generated on this system will have \`$visiblename' used
as the host part (after the \@) in the From: field and similar places.
";
$confdescrip.= "
Message-ID's, Received lines, etc. will use the system's canonical
hostname, which is currently set to $syshostname.
" if $syshostname ne $visiblename;
$confdescrip.= "
The following hostname(s) will be recognised as referring to this system:
".join(', ',@names)."\n" if $configtype != 3;
$configtype != 3 && &setfile('aliases',
'# This is the aliases file - it says who gets mail for whom.',
"
postmaster: root
$rootalias
$redirinalias
mailer-daemon: postmaster
");
$confdescrip.="
Mail for postmaster, root, etc. will be sent to ".
(@postmasters ? join(', ',@postmasters) : 'root').".\n" if $configtype != 3;
$configtype != 3 && &setfile('smail/directors',
'# This is the Smail directors file, which deals with mail for
# local users (ie, mail which is destined for a user of this system).',
'
# aliasinclude - expand ":include:filename" addresses produced by alias files
aliasinclude:
driver=aliasinclude, # use this special-case driver
nobody; # associate nobody user with addresses
# when mild permission violations
# are encountered
copysecure, # get permissions from alias director
copyowners, # get owners from alias director
# forwardinclude - expand ":include:filename" addrs produced by forward files
forwardinclude:
driver=forwardinclude, # use this special-case driver
nobody;
copysecure, # get perms from forwarding director
copyowners, # get owners from forwarding director
# aliases - search for alias expansions stored in a database
aliases:
driver=aliasfile, # general-purpose aliasing director
-nobody, # all addresses are associated
# with nobody by default, so setting
# this is not useful.
sender_okay, # don\'t remove sender from expansions
owner=postmaster; # problems going to postmaster
file=/etc/aliases, # default: sendmail compatible
owners=root:mail:daemon, # A list of permissible owners/owning
owngroups=root:mail:daemon, # groups for the alias file.
modemask=002, # should not be globally writable
proto=lsearch, # unsorted ASCII file
# if you ever change the line above, change /usr/sbin/mkaliases, too!!!
# dotforward - expand .forward files in user home directories
dotforward:
driver=forwardfile, # general-purpose forwarding director
owner=real-$user, # problems go to the user\'s mailbox
nobody, # use nobody user, if unsecure
sender_okay; # sender never removed from expansion
file=~/.forward, # .forward file in home directories
checkowner, # the user can own this file
owners=root, # or root can own the file
modemask=002, # it should not be globally writable
caution=0-10:uucp:daemon, # don\'t run things as root or daemons
# be extra carefull of remotely accessible home directories
unsecure=0-99:~ftp:~uucp:/tmp:/var/tmp,
# user - match users on the local host with delivery to their mailboxes
user:
driver=user;
transport=local
# real_user - match usernames when prefixed with the string "real-"
#
# This is useful for allowing an address which explicitly delivers to a
# user\'s mailbox file. For example, errors in a .forward file expansion
# can be delivered here, or forwarding loops between multiple machines
# can be resolved by using a real-username address.
# Caution, this is not sendmail compatible :-(
real_user:
driver=user;
transport=local,
prefix="real-",
# lists - expand local mailing lists stored in a list directory.
#
# Mailing lists can be created simply by creating a file in the
# /etc/smail/lists directory. To get local error bounces sent
# to the listowner put their name in /etc/smail/lists/owner-whatever.
lists: driver=forwardfile,
caution, # flag all addresses with caution
nobody, # and then associate the nobody user
-sender_okay, # do remove sender from list expansions
owner=owner-$user; # system V sites may wish to use
# o-$user, as owner-$user may be
# too long for a 14-char filename.
# map the name of the mailing list to lower case
file=lists/${lc:user},
');
$configtype == 3 && &setfile('smail/directors',
'# This is the Smail directors file, which deals with mail for
# local users. However, it is configured to send even mail
# which looks local to our smarthost for processing.',
"
smart_user:
driver=smartuser;
new_user=\$user\@$smarthost,
well_formed_only,
");
$confdescrip.= "\nLocal mail is delivered.\n" if $configtype != 3;
($configtype == 1 || $configtype == 3) && &setfile('smail/routers',
'# This is the Smail routers file, which says what to do with mail destined for
# remote hosts. This configuration is for Internet and satellite systems.',
'
'. ($usesmarthost < 3 ?
'inet_addrs:
driver=gethostbyaddr, transport=smtp;
check_for_local, fail_if_error
inet_hosts:
driver=bind, transport=smtp;
defer_no_connect, -local_mx_okay, defnames,
':''). ($usesmarthost == 0 ?
' gateways=uu.net:uucp:+:cunyvm.cuny.edu:bitnet
':''). ($usesmarthost == 1 ?
" gateways=$smarthost:uucp:bitnet
":''). ($usesmarthost == 2 ?
' ignore_domains=uucp:bitnet
':''). ($usesmarthost < 3 ?
'
':''). ($usesmarthost >= 2 ?
"smart_host:
driver=smarthost, transport=smtp;
path=$smarthost
":''));
$confdescrip.= $configtype == 3 ? "
All mail is sent to $smarthost via SMTP and TCP/IP (using any
MX records in the DNS)." :
$configtype == 1 && $usesmarthost == 3 ? "
Outbound remote mail is sent to $smarthost
via SMTP and TCP/IP (using any MX records in the DNS)." :
$configtype == 1 && $usesmarthost == 2 ? "
Outbound remote mail is first looked up in the Internet DNS, and delivered
using that data if this yields results. Messages for which no
entry is found in the DNS are sent to $smarthost
via SMTP and TCP/IP (using any MX records for it in the DNS)." :
$configtype == 1 && $usesmarthost == 1 ? "
Outbound remote mail is looked up in the Internet DNS, and delivered
using that data if any is found; otherwise such messages are bounced.
Mail for the non-DNS UUCP and BITNET domains is sent to $smarthost
via SMTP and TCP/IP (using any MX records for it in the DNS)." :
$configtype == 1 && $usesmarthost == 0 ? "
Outbound remote mail is looked up in the Internet DNS, and delivered
using that data if any is found; failing that messages are bounced.
Mail for the non-DNS UUCP and BITNET domains are sent to the backbone
sites uu.net and cunyvm.cuny.edu for routing, respectively." :
$configtype == 2 ? "
Outbound remote mail is transmitted via batched UUCP to
$smarthost for routing and delivery." :
$configtype == 4 ? "
Any mail destined for remote addresses is bounced." : die "internal error";
$confdescrip.=
"\n\nMail from the system background tasks will be sent to
root\@$smarthost" if $configtype == 3;
$configtype == 2 && &setfile('smail/routers',
'# This is the Smail routers file, which says what to do with
# mail destined for remote hosts. This configuration sends
# all remote mail to your smarthost via UUCP.',
"
smart_host:
driver=smarthost, transport=uux;
path=$smarthost
");
$configtype == 4 && &setfile('smail/routers',
'# This is the Smail routers file, which says what to do with
# mail destined for remote hosts. However, this configuration
# is for local delivery only, and so has no routing information.
# All mail not recognised as local will be bounced.','');
&setfile('smail/transports',
'# This is the Smail transports file, which gives details of how
# to actually do the various kinds of delivery specified by the
# directors and routers.',
'# Not all of the following are used by all configurations;
# pipe and file may be called implicitly by Smail when delivering
# to local addresses looking like |... /... ~/... .
local: driver=appendfile, # append message to a file
from, # supply a From_ envelope line
local, # use local forms for delivery
inet, # use route-addr addresses for routing
return_path, # include a Return-Path: field
unix_from_hack; # insert > before From in body
append_as_user,
check_user, # use user-id associated with address
file=/var/spool/mail/${lc:strip:user}, # location of mailbox files
group=mail, # group to own file
mode=0660,
suffix="\n" # append an extra newline
smtp: driver=tcpsmtp,
max_addrs=100, # limit on number of addresses
-max_chars,
inet; # use route-addr addresses for routing
use_bind, # resolve MX and multiple A records
defer_no_connect, # try again if the nameserver is down
-local_mx_okay, # fail an MX to the local host
defnames # use standard domain searching
uux: driver=pipe,
uucp, # use UUCP-style addressing forms
from, # supply a From_ envelope line
max_addrs=5,
max_chars=200;
cmd="/usr/bin/uux - -r $host!rmail $(($user)$)",
pipe_as_sender, # have uucp logs contain caller
log_output # save error output for bounce messages
pipe: driver=pipe,
from, # supply a From_ envelope line
local, # use local forms for delivery
inet, # use route-addr addresses for routing
return_path, # include a Return-Path: field
unix_from_hack; # insert > before From in body
cmd="/bin/sh -c $user",
-ignore_status, # ignore a non-zero exit status
-ignore_write_errors, # ignore write errors, i.e., broken pipe
log_output, # save error output for bounce messages
parent_env, # environment info from parent addr
pipe_as_user, # use user-id associated with address
umask=0077
file: driver=appendfile,
from, # supply a From_ envelope line
local, # use local forms for deliver
return_path, # include a Return-Path: field
unix_from_hack; # insert > before From in body
append_as_user, # use user-id associated with addres
file=$user, # file is taken from address
expand_user, # expand ~ and $ within addres
mode=0660,
suffix="\n" # append an extra newline
');
do {
print "\n\nThe following configuration has been entered:
$confdescrip
Is this OK ? Hit Return or type \`y' to confirm it and install,
or \`n' to make changes (in which case we'll go round again, giving you
your previous answers as defaults. (y/n) ";
$!=0; defined($what=<STDIN>) || die "smailconfig: EOF/error on stdin: $!\n";
} while ($what !~ m/^\s*[yn]?\s*$/i);
last unless $what =~ m/^n/i;
}
# How to start smail .... daemon or inetd?
&query(
"You have to select a method starting smail:
The decision as to whether to use a smail daemon, or the inet
daemon depends upon how much mail passes through your site and whether
or not you can always spare 300K of virtual memory.
(1) Generate a line in /etc/inetd.conf. For every remote-connections a
smail session is started. It is the standard.
(2) To invoke a smail daemon at system boot time.
Select a number from 1 to 2, from the list above.",
'startsmail',
'1',
'm/^[12]$/');
if ( $startsmail == 1) {
system("update-rc.d -f smail remove >/dev/null");
system("update-inetd --group MAIL --add \"smtp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/in.smtpd\" >/dev/null");
} else {
system("update-inetd --disable smtp >/dev/null");
system("update-rc.d smail defaults 50 >/dev/null");
system("/etc/init.d/smail start >/dev/null");
}
sub setfileshort {
local ($filename,$value) = @_;
push(@files,$filename);
$filecontents{$filename}= $value;
}
sub setfile {
local ($filename,$value1,$value2,$d) = @_;
chop($d=`date`);
$v=
"$value1\
# It was originally generated by `smailconfig', part of the Smail package
# distributed with Debian, but it may edited by the mail system administrator.
# It was originally generated by smailconfig at $d
# Please modify the above line, if you change this file by hand.
# See smail-config (5) for details of the things that can be configured here.
$value2";
push(@files,$filename);
$filecontents{$filename}=$v;
}
sub reswarn {
print STDERR "$_[0]\n";
return 0;
}
sub query {
local ($question, $varname, $default, $check, $opts) = @_;
local ($allowempty, $response, $e);
print "\n";
$allowempty= $opts =~ m/e/;
if (eval "defined(\$$varname)") {
$default= eval "\$$varname";
$default='none' if $default eq '' && $allowempty;
}
for (;;) {
print "$question\nEnter value (";
print "default=\`$default', " if length($default);
print "\`x' to restart): ";
$!=0; defined($iread=<STDIN>) || die "smailconfig: EOF/error on stdin: $!\n";
$_= $iread; s/^\s+//; s/\s+$//;
return 0 if m/^x$/i;
$_= $default if $_ eq '';
if (!length($_)) {
print " Sorry, you must enter a value.\n";
next;
}
$_= '' if $_ eq 'none' && $allowempty;
$response= $_;
last if eval $check;
if (length($@)) {
print STDERR " Aargh, bug - bug - please report:\n$@\nin\n $check\n";
last;
} else {
print " Sorry, that value is not acceptable.\n";
}
}
$e= "\$$varname = \$response;";
eval $e; length($@) && die "aargh - internal error ($e): $@";
1;
}
for $f (@files) {
open(N,">$etc/$f.postinstnew") || die "Error creating $etc/$f.postinstnew: $!\n";
print(N $filecontents{$f}) || die "Error writing $etc/$f.postinstnew: $!\n";
close(N) || die "Error closing $etc/$f.postinstnew: $!\n";
}
while (defined($f= pop(@files))) {
rename("$etc/$f.postinstnew","$etc/$f") || die "Error installing $etc/$f: $!\n";
}
system('crontab','-u','mail',"$etc/smail/crontab") || print "No crontab installed\n";
print "
Configuration installed.
";
exec $testmsg, $configtype == 4 ? '--localonly' : '--allowremote';
die "Error running $testmsg: $!\n";
|