SpamAssassinを経由させてメールを受信する
(CentOS3.5)Modified: 1 August 2005
SpamAssassinのインストールを確認します。
# rpm -q spamassassin spamassassin-2.55-3.4 #
CentOS3.5では、すでに起動していますので、それを確認するだけです。
# service spamassassin restart # chkconfig spamassassin on"/etc/postfix/master.cf"を以下のように、2行を追加します。
# # Postfix master process configuration file. Each logical line # describes how a Postfix daemon program should be run. # # A logical line starts with non-whitespace, non-comment text. # Empty lines and whitespace-only lines are ignored, as are comment # lines whose first non-whitespace character is a `#'. # A line that starts with whitespace continues a logical line. # # The fields that make up each line are described below. A "-" field # value requests that a default value be used for that field. # # Service: any name that is valid for the specified transport type # (the next field). With INET transports, a service is specified as # host:port. The host part (and colon) may be omitted. Either host # or port may be given in symbolic form or in numeric form. Examples # for the SMTP server: localhost:smtp receives mail via the loopback # interface only; 10025 receives mail on port 10025. # # Transport type: "inet" for Internet sockets, "unix" for UNIX-domain # sockets, "fifo" for named pipes. # # Private: whether or not access is restricted to the mail system. # Default is private service. Internet (inet) sockets can't be private. # # Unprivileged: whether the service runs with root privileges or as # the owner of the Postfix system (the owner name is controlled by the # mail_owner configuration variable in the main.cf file). Only the # pipe, virtual and local delivery daemons require privileges. # # Chroot: whether or not the service runs chrooted to the mail queue # directory (pathname is controlled by the queue_directory configuration # variable in the main.cf file). Presently, all Postfix daemons can run # chrooted, except for the pipe, virtual and local delivery daemons. # The proxymap server can run chrooted, but doing so defeats most of # the purpose of having that service in the first place. # The files in the examples/chroot-setup subdirectory describe how # to set up a Postfix chroot environment for your type of machine. # # Wakeup time: automatically wake up the named service after the # specified number of seconds. A ? at the end of the wakeup time # field requests that wake up events be sent only to services that # are actually being used. Specify 0 for no wakeup. Presently, only # the pickup, queue manager and flush daemons need a wakeup timer. # # Max procs: the maximum number of processes that may execute this # service simultaneously. Default is to use a globally configurable # limit (the default_process_limit configuration parameter in main.cf). # Specify 0 for no process count limit. # # Command + args: the command to be executed. The command name is # relative to the Postfix program directory (pathname is controlled by # the daemon_directory configuration variable). Adding one or more # -v options turns on verbose logging for that service; adding a -D # option enables symbolic debugging (see the debugger_command variable # in the main.cf configuration file). See individual command man pages # for specific command-line options, if any. # # In order to use the "uucp" message tranport below, set up entries # in the transport table. # # In order to use the "cyrus" message transport below, configure it # in main.cf as the mailbox_transport. # # SPECIFY ONLY PROGRAMS THAT ARE WRITTEN TO RUN AS POSTFIX DAEMONS. # ALL DAEMONS SPECIFIED HERE MUST SPEAK A POSTFIX-INTERNAL PROTOCOL. # # DO NOT SHARE THE POSTFIX QUEUE BETWEEN MULTIPLE POSTFIX INSTANCES. # # ========================================================================== # service type private unpriv chroot wakeup maxproc command + args # (yes) (yes) (yes) (never) (100) # ========================================================================== #smtp inet n - n - - smtpd smtp inet n - n - - smtpd -o content_filter=spamassassin #smtps inet n - n - - smtpd # -o smtpd_tls_wrappermode=yes -o smtpd_sasl_auth_enable=yes #submission inet n - n - - smtpd # -o smtpd_enforce_tls=yes -o smtpd_sasl_auth_enable=yes #628 inet n - n - - qmqpd pickup fifo n - n 60 1 pickup cleanup unix n - n - 0 cleanup #qmgr fifo n - n 300 1 qmgr qmgr fifo n - n 300 1 nqmgr #tlsmgr fifo - - n 300 1 tlsmgr rewrite unix - - n - - trivial-rewrite bounce unix - - n - 0 bounce defer unix - - n - 0 bounce flush unix n - n 1000? 0 flush proxymap unix - - n - - proxymap smtp unix - - n - - smtp relay unix - - n - - smtp # -o smtp_helo_timeout=5 -o smtp_connect_timeout=5 showq unix n - n - - showq error unix - - n - - error local unix - n n - - local virtual unix - n n - - virtual lmtp unix - - n - - lmtp # # Interfaces to non-Postfix software. Be sure to examine the manual # pages of the non-Postfix software to find out what options it wants. # # maildrop. See the Postfix MAILDROP_README file for details. # maildrop unix - n n - - pipe flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient} # # The Cyrus deliver program has changed incompatibly, multiple times. # old-cyrus unix - n n - - pipe flags=R user=cyrus argv=/cyrus/bin/deliver -e -m ${extension} ${user} # Cyrus 2.1.5 (Amos Gouaux) cyrus unix - n n - - pipe user=cyrus argv=/cyrus/bin/deliver -e -r ${sender} -m ${extension} ${user} uucp unix - n n - - pipe flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient) ifmail unix - n n - - pipe flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient) bsmtp unix - n n - - pipe flags=Fq. user=foo argv=/usr/local/sbin/bsmtp -f $sender $nexthop $recipient # SpamAssassin spamassassin unix - n n - - pipe user=tomo argv=/usr/bin/spamc -f -e /usr/sbin/sendmail.postfix -oi -f ${sender} ${recipient}外部からメールを送信し、ログを見てみます。エラーがなく、spamdが起動していることが確認できました。
postfix/smtpd[10084]: connect from web2902.mail.bbt.yahoo.co.jp[202.93.80.167] postfix/smtpd[10084]: 6778633A6C: client=web2902.mail.bbt.yahoo.co.jp[202.93.80.167] postfix/cleanup[10086]: 6778633A6C: message-id=<20050731082648.30628.qmail@web2902.mail.bbt.yahoo.co.jp> postfix/nqmgr[10081]: 6778633A6C: from=<tomoac@yahoo.co.jp>, size=1094, nrcpt=1 (queue active) postfix/smtpd[10084]: disconnect from web2902.mail.bbt.yahoo.co.jp[202.93.80.167] spamd[8179]: connection from localhost [127.0.0.1] at port 32852 spamd[10089]: info: setuid to tomo succeeded spamd[10089]: processing message <20050731082648.30628.qmail@web2902.mail.bbt.yahoo.co.jp> for tomo:500. spamd[10089]: clean message (0.0/5.0) for tomo:500 in 1.4 seconds, 1068 bytes. postfix/pickup[10080]: 565CD33A70: uid=500 from=<tomoac@yahoo.co.jp> postfix/cleanup[10086]: 565CD33A70: message-id=<20050731082648.30628.qmail@web2902.mail.bbt.yahoo.co.jp> postfix/pipe[10087]: 6778633A6C: to=<tomo@tomo.ac>, relay=spamassassin, delay=2, status=sent (dsetcmail.tomo.ac) postfix/nqmgr[10081]: 565CD33A70: from=<tomoac@yahoo.co.jp>, size=1383, nrcpt=1 (queue active) postfix/local[10083]: 565CD33A70: to=<tomo@tomo.ac>, relay=local, delay=0, status=sent (mailbox)受信したメールヘッダーに以下のようなヘッダーが見えます。
これが、ApamAssassinが付加したヘッダーです。
X-Spam-Status: No, hits=0.0 required=5.0 tests=IN_REP_TO,RCVD_IN_ORBS version=2.55 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.55 (1.174.2.19-2003-05-19-exp)