sendmail-8.12.11

/etc/mail 関連の設定と試験(telnet)

歓迎猫 歓迎猫

/etc/mail に 移動しよう、ここでの設定項目は ”local-host-names ”、 ”access”、”aliases”と”access”と ”aliases”のデーターベースの 作成:aliases:については最初退避していたものを使用しよう、吟味なし で使用して良いかどうかはさておき、

nyan:/usr/local/src/sendmail-8.12.11/cf/cf# cd /etc/
nyan:/etc# cd mail
nyan:/etc/mail# ls -l
total 108
-r--r--r--    1 bin      bin          5588 Sep  2 22:47 helpfile
-r--r--r--    1 root     bin         54057 Sep  4 11:55 sendmail.cf
-rw-------    1 root     bin             0 Sep  2 22:47 statistics
-r--r--r--    1 root     bin         38944 Sep  4 11:55 submit.cf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ファイルを作成 create local-host-names and access

nyan:/etc/mail# echo bcnet.ne.jp > local-host-names 
nyan:/etc/mail# echo "192.168.0 RELAY " > access
nyan:/etc/mail# echo "127.0.0.1 RELAY " >> access
nyan:/etc/mail# cat access 
192.168.0 RELAY 
127.0.0.1 RELAY 
nyan:/etc/mail# cat local-host-names 
bcnet.ne.jp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

aliases ファイルを退避先から持ってきて call aliases file here

nyan:/etc/mail# cp ../005_aliases aliases
nyan:/etc/mail# ls -lt
total 120
-rw-r--r--    1 root     root    842 Sep  4 15:22 aliases
-rw-r--r--    1 root     root     34 Sep  4 15:20 access
-rw-r--r--    1 root     root     12 Sep  4 15:19 local-host-names
-r--r--r--    1 root     bin   54057 Sep  4 11:55 sendmail.cf
-r--r--r--    1 root     bin   38944 Sep  4 11:55 submit.cf
-rw-------    1 root     bin       0 Sep  2 22:47 statistics
-r--r--r--    1 bin      bin    5588 Sep  2 22:47 helpfile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

データーベースにする。create access.db

nyan:/etc/mail# makemap hash /etc/mail/access < /etc/mail/access 
nyan:/etc/mail# ls -lt
total 128
-rw-r-----    1 root     root  12288 Sep  4 15:23 access.db
-rw-r--r--    1 root     root    842 Sep  4 15:22 aliases
-rw-r--r--    1 root     root     34 Sep  4 15:20 access
-rw-r--r--    1 root     root     12 Sep  4 15:19 local-host-names
-r--r--r--    1 root     bin   54057 Sep  4 11:55 sendmail.cf
-r--r--r--    1 root     bin   38944 Sep  4 11:55 submit.cf
-rw-------    1 root     bin       0 Sep  2 22:47 statistics
-r--r--r--    1 bin      bin    5588 Sep  2 22:47 helpfile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

データーベースにする。create aliases.db

nyan:/etc/mail# newaliases
/etc/mail/aliases: 15 aliases, longest 10 bytes, 162 bytes total
nyan:/etc/mail# ls -lt
total 140
-rw-r----- 1 root  smmsp  12288 Sep  4 15:24 aliases.db
-rw-r----- 1 root  root   12288 Sep  4 15:23 access.db
-rw-r--r-- 1 root  root     842 Sep  4 15:22 aliases
-rw-r--r-- 1 root  root      34 Sep  4 15:20 access
-rw-r--r-- 1 root  root      12 Sep  4 15:19 local-host-names
-r--r--r-- 1 root  bin    54057 Sep  4 11:55 sendmail.cf
-r--r--r-- 1 root  bin    38944 Sep  4 11:55 submit.cf
-rw------- 1 root  bin        0 Sep  2 22:47 statistics
-r--r--r-- 1 bin   bin     5588 Sep  2 22:47 helpfile
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

モードとオーナー を 変更 chmod and owner

nyan:/etc/mail# \
chmod go-w / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue
nyan:/etc/mail# \
chown root / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

取り敢えず最初の段階はこれで終了 試験をしてみよう、内部の場合である。 First step of sendmail install end. Now we test mail system 1st innner

nyan:/etc/mail# /usr/sbin/sendmail -bt -C /etc/mail/sendmail.cf
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
Enter <ruleset> <address>
> /parse mm@bcnet.ne.jp
Cracked address = $g
Parsing envelope recipient address
canonify           input: mm @ bcnet . ne . jp
Canonify2          input: mm < @ bcnet . ne . jp >
Canonify2        returns: mm < @ bcnet . ne . jp . >
canonify         returns: mm < @ bcnet . ne . jp . >
parse              input: mm < @ bcnet . ne . jp . >
Parse0             input: mm < @ bcnet . ne . jp . >
Parse0           returns: mm < @ bcnet . ne . jp . >
ParseLocal         input: mm < @ bcnet . ne . jp . >
ParseLocal       returns: mm < @ bcnet . ne . jp . >
Parse1             input: mm < @ bcnet . ne . jp . >
Parse1           returns: $# local $: mm
parse            returns: $# local $: mm
2                  input: mm
2                returns: mm
EnvToL             input: mm
EnvToL           returns: mm
final              input: mm
final            returns: mm
mailer local, user mm

試験をしてみよう、こんどは外部の場合である。~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~next outer

> /parse mm@nl.bcnet.ne.jp
Cracked address = $g
Parsing envelope recipient address
canonify           input: mm @ nl . bcnet . ne . jp
Canonify2          input: mm < @ nl . bcnet . ne . jp >
Canonify2        returns: mm < @ nl . bcnet . ne . jp . >
canonify         returns: mm < @ nl . bcnet . ne . jp . >
parse              input: mm < @ nl . bcnet . ne . jp . >
Parse0             input: mm < @ nl . bcnet . ne . jp . >
Parse0           returns: mm < @ nl . bcnet . ne . jp . >
ParseLocal         input: mm < @ nl . bcnet . ne . jp . >
ParseLocal       returns: mm < @ nl . bcnet . ne . jp . >
Parse1             input: mm < @ nl . bcnet . ne . jp . >
MailerToTriple     input: < > mm < @ nl . bcnet . ne . jp . >
MailerToTriple   returns: mm < @ nl . bcnet . ne . jp . >
Parse1           returns: $# esmtp $@ nl . bcnet . ne . \
jp . $: mm < @ nl bcnet . ne . jp . >
parse            returns: $# esmtp $@ nl . bcnet . ne . \
jp . $: mm < @ nl bcnet . ne . jp . >
2                  input: mm < @ nl . bcnet . ne . jp . >
2                returns: mm < @ nl . bcnet . ne . jp . >
EnvToSMTP          input: mm < @ nl . bcnet . ne . jp . >
PseudoToReal       input: mm < @ nl . bcnet . ne . jp . >
PseudoToReal     returns: mm < @ nl . bcnet . ne . jp . >
MasqSMTP           input: mm < @ nl . bcnet . ne . jp . >
MasqSMTP         returns: mm < @ nl . bcnet . ne . jp . >
EnvToSMTP        returns: mm < @ nl . bcnet . ne . jp . >
final              input: mm < @ nl . bcnet . ne . jp . >
final            returns: mm @ nl . bcnet . ne . jp
mailer esmtp, host nl.bcnet.ne.jp., user mm@nl.bcnet.ne.jp

試験を終わるには==== End of test =====================

> /quit
nyan:/etc/mail# 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

駄衛門様にお任せしよう now setup daemon of sendmail

nyan:/etc/mail# cd /etc/rc.d/

どれが起動の ファイルかな? find sendmail exciting file

nyan:/etc/rc.d# cat rc.S | grep sendmail
nyan:/etc/rc.d# cat rc.M | grep sendmail
# Start the sendmail daemon:
#if [ -x /usr/sbin/sendmail ]; then
#  echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -q15m)..."
#  /usr/sbin/sendmail -bd -q15m
~~~~~~~~~~~~~~~~~~~~~~~~~~

rc.M を 変更しよう OK modefy rc.M now!

mm@nyan:~/a_inst$ cp /etc/rc.d/rc.M .
mm@nyan:~/a_inst$ emacs rc.M &
nyan:/etc/rc.d# mv rc.M 001_rc.M_org
nyan:/etc/rc.d# cp /home/mm/a_inst/rc.M .
nyan:/etc/rc.d# diff -s rc.M 001_rc.M_org 
82,87c82,87
< # Sat Sep  4 JST 2004 Del # mark below 4 lines adn add this line.
<  Start the sendmail daemon:
< if [ -x /usr/sbin/sendmail ]; then
<   echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -q15m)..."
<   /usr/sbin/sendmail -bd -q15m
< fi
---
> 
> # Start the sendmail daemon:
> #if [ -x /usr/sbin/sendmail ]; then
> #  echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -q15m)..."
> #  /usr/sbin/sendmail -bd -q15m
> #fi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

確認しておこう もし無ければ起動しないので

nyan:/etc/rc.d# ls -l /usr/sbin/ | grep sendmail
-r-xr-sr-x    1 root     smmsp      574091 Sep  2 22:47 sendmail*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

再起動で確認 OK reboot and check it.

nyan:/etc/rc.d# shutdown -r now
nyan:~# cat -n /var/log/messages | grep sendmail
    54  Sep  4 15:56:18 nyan sendmail[79]: starting daemon (8.12.11): \
SMTP+queueing@00:15:00
nyan:~# wc -l /var/log/messages 
    117 /var/log/messages
nyan:~# cat -n /var/log/messages |tail -65 | head -3
    53  Sep  4 15:56:18 nyan named[60]: zone 0.0.127.in-addr.arpa/IN: \
loaded serial 20030121
    54  Sep  4 15:56:18 nyan sendmail[79]: starting daemon (8.12.11): \
SMTP+queueing@00:15:00
    55  Sep  4 15:56:18 nyan kernel: PCI: Found IRQ 9 for device 00:0c.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nyan:~# cat  /var/log/messages |tail -64 | head -1
Sep  4 15:56:18 nyan sendmail[79]: starting daemon (8.12.11): \
SMTP+queueing@00:15:00
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nyan:~# ps ax | grep send
   79 ?        S      0:00 sendmail: accepting connections
  585 pts/1    S      0:00 grep send
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nyan:~# cat /var/log/syslog 
Now it good !
nyan:~# kill 79
nyan:~# ps ax | grep send
  621 pts/1    S      0:00 grep send
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

再度試験をしよう So we test mail from here to mm@nl.bcnet.ne.jp via telnet

nyan:~# telnet 192.168.0.8 25
Trying 192.168.0.8...
Connected to 192.168.0.8.
Escape character is '^]'.
220 nl.bcnet.ne.jp ESMTP Sendmail 8.12.11/8.12.11; \
Sat, 4 Sep 2004 16:21:56 +0900
helo happy
250 nl.bcnet.ne.jp Hello root@nyan.bcnet.ne.jp\
 [192.168.0.5], pleased to meet you
mail from :mm@bcnet.ne.jp
250 2.1.0 mm@bcnet.ne.jp... Sender ok
rcpt to:mm@nl.bcnet.ne.jp
250 2.1.5 mm@nl.bcnet.ne.jp... Recipient ok
data                    
354 Enter mail, end with "." on a line by itself
subject:first mail
Here is nyan.bcnet 
Here is nyan.bcnet.ne.jp Ip address 192.168.0.5
.
250 2.0.0 i847LubS000934 Message accepted for delivery
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Connection closed by foreign host.

送信でけたみたい?Test of send OK

sendmail を 駄衛門モードで起動する。よそさまから メールをおくってもら うNext We receive letter from other user we start send mail back ground

nyan:/var/spool/mqueue# /usr/sbin/sendmail -bd -q15m
nyan:/var/spool/mqueue# ps ax | grep send
  342 ?        S      0:00 sendmail: accepting connections
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

オー!こんな 画面が root の 端末に 表示されたよ

New mail for mm@nyan has arrived:
----
Subject: test fro others
From: mm@nyanta.no-ip.info
I sent mail fro ip address 192.168.0.8 mm@bcnet.ne.jp
as mm@nl.bcnet.ne.jp
as mm@nyanta.no-ip.info
Please if you can read this letter.
sent back to me.
...more...
~~~~~~~~~~~~~~~~~~~~~~~~~~~

受け取ったはいいけど どこにあるのだ? OK! I received letter So where is it? I find it mail below.

nyan:~# cd /var/spool/mail/
nyan:/var/spool/mail# ls -l
total 20
-rw-------    1 mm       users         969 Sep  4 16:56 mm
-rw-rw----    1 root     mail         7111 Oct 23  1998 root
-rw-rw----    1 root     root         7111 Oct 23  1998 root.new

さて内容はと

nyan:/var/spool/mail# cat mm
From mm@nyanta.no-ip.info  Sat Sep  4 16:56:54 2004
Return-Path: <mm@nyanta.no-ip.info>
Received: from nl.bcnet.ne.jp (root@nl.bcnet.ne.jp [192.168.0.8])
        by nyan.bcnet.ne.jp (8.12.11/8.12.11) \
with ESMTP id i847uq2T000440
        for <mm@nyan.bcnet.ne.jp>; Sat, 4 Sep 2004 16:56:54 +0900
Received: from localhost (mm@nl.bcnet.ne.jp [192.168.0.8])
        by nl.bcnet.ne.jp (8.12.11/8.12.11) \
with ESMTP id i847uRrt000998
        for <mm@nyan.bcnet.ne.jp>; Sat, 4 Sep 2004 16:56:27 +0900
Date: Sat, 04 Sep 2004 16:56:27 +0900 (JST)
Message-Id: <20040904.165627.74749826.mm@nyanta.no-ip.info>
To: mm@nyan.bcnet.ne.jp
Subject: test from others
From: mm@nyanta.no-ip.info
X-Mailer: Mew version 3.3 on Emacs 21.3 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I sent mail fro ip address 192.168.0.8 mm@bcnet.ne.jp
as mm@nl.bcnet.ne.jp
as mm@nyanta.no-ip.info
Please if you can read this letter.
sent back to me.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

OK! OK! OK! しかし このままでは 少し 不便でないかい?


前へ
前へ
次へ
次へ
UP
sendmail-8.12.11
Copyright © 2004.-2007. nyantarou All Rights Reserved.