nyan:/etc# cp aliases 001_aliases_og
既存の postfix を 削除の 後
nyan:/etc# cat /etc/group | grep smmsp
nyan:/etc# cat /etc/passwd | grep smmsp
nyan:/etc# groupadd -g 25 smmsp
nyan:/etc# cat /etc/group | grep smmsp
smmsp:x:25:
nyan:/etc# useradd -g smmsp -d /var/spool/clientmqueue -s /bin/false -u 25 smmsp
nyan:/etc# cat /etc/passwd | grep smmsp
smmsp:x:25:25::/var/spool/clientmqueue:/bin/false
へてから
nyan:/etc# cd
nyan:~# ls /var/spool/ | grep mqueue
nyan:~# mkdir /var/spool/mqueue
nyan:~# ls /var/spool/ | grep mqueue
mqueue/
nyan:~# cd /usr/local/src/
nyan:/usr/local/src# tar zxvf sendmail.8.12.11.tar.gz
nyan:/usr/local/src# cd sendmail-8.12.11/
nyan:/usr/local/src/sendmail-8.12.11# sh Build
nyan:/usr/local/src/sendmail-8.12.11# sh Build install
mm@nyan:~$ cp /usr/local/src/sendmail-8.12.11/cf/cf/generic-linux.mc .
mm@nyan:~$ diff -s generic-linux.mc sendmail.mc
25a26,30
> FEATURE(relay_hosts_only)dnl
> FEATURE(`no_default_msa')dnl
> FEATURE(`access_db',`DATABASE_MAP_TYPE -T /etc/mail/access')dnl
> FEATURE(`use_cw_file',`/etc/mail/local-host-names')dnl
> define(`confPRIVACY_FLAGS',`goaway')dnl
27a33
>
=================================================
nyan:/usr/local/src/sendmail-8.12.11# cd cf/cf/
nyan:/usr/local/src/sendmail-8.12.11/cf/cf# cp /home/mm/sendmail.mc .
nyan:/usr/local/src/sendmail-8.12.11/cf/cf# sh Build sendmail.cf
Using M4=/usr/bin/m4
rm -f sendmail.cf
/usr/bin/m4 ../m4/cf.m4 sendmail.mc > sendmail.cf || ( rm -f sendmail.cf && exit 1 )
*** WARNING: missing -T in argument of FEATURE(`access_db', DATABASE_MAP_TYPE -T /etc/mail/access)
chmod 444 sendmail.cf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nyan:/usr/local/src/sendmail-8.12.11/cf/cf# sh Build install-cf
Using M4=/usr/bin/m4
rm -f sendmail.cf
/usr/bin/m4 ../m4/cf.m4 sendmail.mc > sendmail.cf || ( rm -f sendmail.cf && exit 1 )
*** WARNING: missing -T in argument of FEATURE(`access_db', DATABASE_MAP_TYPE -T /etc/mail/access)
chmod 444 sendmail.cf
nyan:/usr/local/src/sendmail-8.12.11/cf/cf# sh Build install-cf
Using M4=/usr/bin/m4
../../devtools/bin/install.sh -c -o root -g bin -m 0444 sendmail.cf /etc/mail/sendmail.cf
../../devtools/bin/install.sh -c -o root -g bin -m 0444 submit.cf /etc/mail/submit.cf
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nyan:/usr/local/src/sendmail-8.12.11/cf/cf# cd /etc/mail/
nyan:/etc/mail# ls -l
total 108
-r--r--r-- 1 bin bin 5588 Feb 25 13:54 helpfile
-r--r--r-- 1 root bin 54065 Feb 25 14:02 sendmail.cf
-rw------- 1 root bin 0 Feb 25 13:54 statistics
-r--r--r-- 1 root bin 38944 Feb 25 14:02 submit.cf
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
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nyan:/etc/mail# cp ../001_aliases_og aliases
nyan:/etc/mail# ls -lt
total 120
-rw-r--r-- 1 root root 842 Feb 25 14:05 aliases
-rw-r--r-- 1 root root 34 Feb 25 14:05 access
-rw-r--r-- 1 root root 12 Feb 25 14:04 local-host-names
-r--r--r-- 1 root bin 38944 Feb 25 14:02 submit.cf
-r--r--r-- 1 root bin 54065 Feb 25 14:02 sendmail.cf
-r--r--r-- 1 bin bin 5588 Feb 25 13:54 helpfile
-rw------- 1 root bin 0 Feb 25 13:54 statistics
nyan:/etc/mail# makemap hash /etc/mail/access < /etc/mail/access
nyan:/etc/mail# ls -lt
total 128
-rw-r----- 1 root root 12288 Feb 25 14:06 access.db
-rw-r--r-- 1 root root 842 Feb 25 14:05 aliases
-rw-r--r-- 1 root root 34 Feb 25 14:05 access
-rw-r--r-- 1 root root 12 Feb 25 14:04 local-host-names
-r--r--r-- 1 root bin 38944 Feb 25 14:02 submit.cf
-r--r--r-- 1 root bin 54065 Feb 25 14:02 sendmail.cf
-r--r--r-- 1 bin bin 5588 Feb 25 13:54 helpfile
-rw------- 1 root bin 0 Feb 25 13:54 statistics
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 Feb 25 14:07 aliases.db
-rw-r----- 1 root root 12288 Feb 25 14:06 access.db
-rw-r--r-- 1 root root 842 Feb 25 14:05 aliases
-rw-r--r-- 1 root root 34 Feb 25 14:05 access
-rw-r--r-- 1 root root 12 Feb 25 14:04 local-host-names
-r--r--r-- 1 root bin 38944 Feb 25 14:02 submit.cf
-r--r--r-- 1 root bin 54065 Feb 25 14:02 sendmail.cf
-r--r--r-- 1 bin bin 5588 Feb 25 13:54 helpfile
-rw------- 1 root bin 0 Feb 25 13:54 statistics
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
内部での やり取り
nyan:/etc/mail# /usr/sbin/sendmail -bt -C /etc/mail/sendmail.cf
ADDRESS TEST MODE (ruleset 3 NOT automatically invoked)
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
続いて 外部というより 他の計算機とのやり取り
> /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
> /quit
nyan:/etc/mail#
====================================
modefy rc.M now!
nyan:/etc/rc.d# cp rc.M 001_rc.M_og
nyan:/etc/rc.d# vi rc.M
nyan:/etc/rc.d# diff -s rc.M 001_rc.M_og
nyan:/etc/rc.d# diff -s rc.M 001_rc.M_og
75,78c75,78
< if [ -x /usr/sbin/sendmail ]; then
< echo "Starting sendmail daemon (/usr/sbin/sendmail -bd -q15m)..."
< /usr/sbin/sendmail -bd -q15m
< fi
---
> #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 538903 Feb 25 13:54 sendmail*
nyan:/etc/rc.d# shutdown -r now
再起動の後
mm@nyan:~$ su -
Password:
nyan:~# ps ax | grep send
142 ? S 0:00 sendmail: accepting connections
342 pts/1 S 0:00 grep send
後適当に 試験する。
にゃんたろう 拝!