You are on page 1of 12

developerWorks 31.01.

2007

LPI:
(LPIC-2) 206


Linux
.
LPI :
Sendmail , Procmail ,
Majordomo innd (InterNetNews daemon) NNTP.
, ,
, , , NNTP
Web-.
, Sendmail Procmail
, .
Sendmail postfix,
Sendmail.
, Procmail .
, Majordomo .
Majordomo listserv, mailman
Majordomo. , LPI,
Majordomo.


Linux-, man
.
, .
Linux Documentation Project,
, HOWTO.
. Linux; ,
O'Reilly TCP/IP Network Administration (
TCP/IP) (Craig Hunt) (
, )

Majordomo?
[ ] -- ,
, (mail transport
program -- MTA), Sendmail. , MTA ,
,
, , , .
,
(,
(-)).
, ,
.
, MTA.
, Majordomo
. ,

Mailman. , Majordomo
, (
, ).
Majordomo .
Majordomo 1.x, Majordomo2.
, , .
Majordomo2 (-)
, Majordomo 1.9.5 --
.

Majordomo
Majordomo
Majordomo ( ).
majordomo-1.94.5.tgz
INSTALL. ,
, Majordomo.
make; make install --
, make installwrapper.
cd /usr/local/majordomo-1.94.5; ./wrapper config-test
(make install ).
Majordomo Makefile, /
majordomo.cf.
sample.cf. Makefile,
, ,
, W_GROUP. gid
Majordomo, "daemon". gid
daemon 1, , :

$ id daemon
uid=1(daemon) gid=1(daemon) groups=1(daemon)

MakefilePERL ,
W_HOME Majordomo.
majordomo.cf
make install. Perl,
. $whereami
$homedir, , .

Sendmail Majordomo
Sendmail Majordomo.
/etc/sendmail.cf :
OA/path/to/majordomo/majordomo.aliases

Sendmail
M4, :
define(`ALIAS_FILE',`/etc/aliases,/path/to/majordomo/majordomo.aliases')

majordomo.aliases :
1. majordomo.aliases
majordomo: "|/usr/test/majordomo-1.94.5/wrapper majordomo"
majordomo-owner: you
owner-majordomo: you
test:
"|/usr/test/majordomo-1.94.5/wrapper resend -l test testlist"
test-list:
:include:/usr/test/majordomo-1.94.5/lists/test
owner-test:
you
test-owner:
you
test-request:
you

, ,
. "you" (
).

Majordomo
, "test"
"test-owner", "test-request" , .
, , , .
, , :

1. $listdir, majordomo.cf.
2. my-list-name my-list-name.info (
); chmod,
664. .
3. majordomo.aliases,
"test" -- , "foo-owner", "foo", "foo-request"
.
4. subscribe, unsubscribe, signoff, ,
.
5. , $filedir
$filedir_suffix.
6. [digest subdirectory] $digest_work_dir.
[digest list] (: testdigest).
7. , majordomo,
majordomo, ( ,
664 775 ).
8. config <listname> <listname>admin
Majordomo.
, .

Sendmail
Sendmail?
Sendmail (Mail Transport Agent -- MTA).
,
.
, Sendmail " " Sendmail X
, , /
Sendmail 8.x; , Mailman Majordomo,
MTA Sendmail. MTA
Postfix, Qmail Exim . ,
Sendmail ( )
MTA Linux . 16 2005
Sendmail 8.13.5.
Sendmail
, UUCP, Simple Mail
Transport Protocol (SMTP -- ),
Extended [] SMTP (ESMTP)
MIME. ,
SMTP
.
(Mail User Agent -- MUA) , Sendmail (
MTA) ( ,
POP3 IMAP), Sendmail

. MUA SMTP (
Sendmail, ) ,
Sendmail . Sendmail
/var/spool/mqueue/.

Sendmail
, -- Sendmail sendmail.org
( ), , sendmail.8.13.5.tar.gz.
. , make;
make install, Sendmail sh Build.
, cd cf/cf/;
sendmail.mc *.mc; sendmail.mc;
sendmail.cf:
$ m4 ../m4/cf.m4 sendmail.mc > sendmail.cf

sh Build sendmail.cf.
,
Sendmail ,
M4. sendmail.cf, ,
ASCII,
.
, sendmail ,
( - obj.Linux.2.6.10-5-386.i686/sendmail/sendmail
, /usr/sbin/ (
, ), sendmail.cf
/etc/mail/sendmail.cf. cf/cf/ sh
Build install-cf.
su sudo,
.
Sendmail : makemap, mailstats . .
README
sh Build install .

sendmail.cf
Sendmail
sendmail.cf.
Sendmail, /
.
, --
genericstable virtusertable,
.
. :

2.
david
david.mertz@gmail.com
root
root@gnosis.cx
dqm@gnosis.lan
david.mertz@gmail.com

, :
3.
david@mail.gnosis.cx
david
david@smtp.gnosis.cx
david
david@otherdomain.net
david
@mail.gnosis.cx
%1@external-host.com
owner@list.gnosis.cx
owner%3
jax@bar.com
error:5.7.0:550 Address invalid

, makemap:
$ makemap dbm /etc/mail/virtusertable < inbound
$ makemap hash /etc/mail/genericstable < outbound


M4 sendmail.cf ( -
).
4. sendmail.cf
DOMAIN(gnosis.cx)dnl
FEATURE(`virtusertable', `dbm /etc/mail/virtusertable')dnl
FEATURE(`genericstable', `hash /etc/mail/genericstable')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl

. DOMAIN , ,
cf/domain/gnosis.cx.m4 . FEATURE
, virtusertable genericstable.
GENERICS_DOMAIN_FILE , ,
genericstable.
.
(sendmail -bt),
. , genericstable,
"david" david.mertz@gmail.com .
, localhost /etc/mail/generics-domains,
david@localhost .
david@mail.gnosis.cx
"david". Sendmail
, david@otherdomain.net
.
.
, mail.gnosis.cx,
,

external-host.com. . , %3
,
owner-foo@list.gnosis.cx owner-bar@list.gnosis.cx
"owner-foo" "owner-bar" .

.
,
.
-- ,
Sendmail, .
,
.

Sendmail
Sendmail .
-- ,
. , :
$ /usr/sbin/sendmail -bd -q10m

Sendmail
. Sendmail
, :
$ /usr/sbin/sendmail -q

, Sendmail
. ( Linux Network Administrators Guide;
):
5. Sendmail
$ /usr/sbin/sendmail -bt
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> 3,0 isaac@vstout.vbrew.com
rewrite: ruleset
3
input: isaac @ vstout . vbrew . com
rewrite: ruleset 96
input: isaac < @ vstout . vbrew . com
rewrite: ruleset 96 returns: isaac < @ vstout . vbrew . com
rewrite: ruleset
3 returns: isaac < @ vstout . vbrew . com
rewrite: ruleset
0
input: isaac < @ vstout . vbrew . com
rewrite: ruleset 199
input: isaac < @ vstout . vbrew . com
rewrite: ruleset 199 returns: isaac < @ vstout . vbrew . com
rewrite: ruleset 98
input: isaac < @ vstout . vbrew . com
rewrite: ruleset 98 returns: isaac < @ vstout . vbrew . com
rewrite: ruleset 198
input: isaac < @ vstout . vbrew . com
rewrite: ruleset 198 returns: $# local $: isaac
rewrite: ruleset
0 returns: $# local $: isaac

>
.
.
.
.
.
.
.
.

>
>
>
>
>
>
>
>


Procmail?
Procmail . , Sendmail
MTA ,
MUA inbox [].
; ; -
; - ; .
MUA ,
.
Procmail , ,
. ,
, ,
v
. ,
, ,


, -.

Procmail
Procmail Linux. ,
procmail.org (
). , 3.22.
Procmail ,
Linux (, Debian: apt-get install
procmail). : make install. ,
Procmail -- procmail
~/.procmailrc (, ,
/etc/procmailrc).
Procmail,
Procmail.
Procmail
.forward; .
~/.forward, :
|/usr/local/bin/procmail

Procmail. ,
Procmail -

MTA Procmail. Sendmail,


local_procmail, sendmail.mc
:
FEATURE(`local_procmail', `/usr/bin/procmail', `procmail -Y -a $h -d $u')

Procmail ~/.procmailrc, ,
. Procmail --
, ,
STDIN.

~/.procmailrc
Procmail -- ,
.
, .
, , (A) (E).
Procmail , ;
,
c . ,

,
.
(
, )
,
. :
:0 [flags] [ : [locallockfile] ]
<zero or more conditions (one per line)>
<exactly one action line>

H B
. , D
.
*,
egrep. , < >,
.
$ .
, ,
. - /dev/null .
" " (|) ,
digest-splitting, Procmail.
(!), ,
( ). :

6. ~/.procmailrc
:0:
* ^Subject:.*Digest
# split digests and save parts
* ^From:.*foo-digest
|formail +1 -ds cat >>mailing_lists_mailbox
:0:
* !(To|Cc).*mertz@gnosis.cx
* !(To|Cc).*david.mertz@gmail.com
* !From.*gnosis\.cx
* !From.*list.*@
* !From.*good-buddy
spam

#
#
#
#
#

my main account here


I get mail from here
I trust gnosis not to spam
don't trash mailing lists
sometimes Bcc's me mail

:0:
* ^Subject.*[MY-LIST]
# redistribute MY-LIST messages
! member@example.com, member2@example.net, member3@example.edu
:0:
* ^Cc.*joe@somewhere.org
{
:0 c
$DEFAULT

# save to both inbox and JOE mbox

:0
JOE
}

NNTP
InterNetNews?
NNTP
, . Usenet --
,
NNTP. , " ", NNTP
,
, .

Internet,
.
,
.
, , .

Usenet Internet,
"",
.
.

.
, ,
,
, (
). , NNTP

; NNTP ,
.
InterNetNews (INN) NNTP , 1992,
. INN 2.4.1.
INN (
).

INN
, INN
./configure; make; make install.
INN, Perl yacc ( bison).
, /usr/local/news/ (
, INN ).
innd ( "news"),
. ,
, ,
,
Usenet INN FreeBSD [Installing and Running a Usenet News Server with
INN and FreeBSD] ( ).
make,
.
, , -/usr/local/news/etc/storage.conf.

. ,
( , Usenet ). ,
storage.conf :
7. storage.conf
method cnfs {
newsgroups: alt.binaries.*
class: 1
size: 0,1000000

options: BINARIES

method cnfs {
newsgroups: *
class: 2
size: 0,100000
options: NOTBINRY
}

class .
innd
( ),
,
/usr/local/news/etc/innfeed.conf, /usr/local/news/etc/incoming.conf
/usr/local/news/etc/newsfeeds.