up

前へ| 次へ

sendmail 設定 その1

sendmail は 新規インストール

sendmail に関しては なーんも 残っておらんのです! では設定ということ で( /etc/mail/access は 常用の サーバー から頂くものとします 本機は 予 備ですので。)まあ メールということで

# ls /var/log/packages/ | grep send
# ls /var/log/packages/ | grep post
postfix

個猫は 良いといわれている postfix ですが お勉強の為に sendmail で 練 習をしています。 そこで postfix は 削除しておきます。 後で簡単に 導入は 出来るでしょう という 大甘な考えです。

postfix 削除

良いこの みなさまは こんなばかげた事は しないように

# pkgtool
[X] postfix             メール配送プログラム postfix-2.2.5 
... /*  省略  */
 

ユーザー と グループ の 追加

存在の確認と追加

# grep 25 /etc/group
# grep 25 /etc/passwd
# grep smmsp /etc/passwd
# grep smmsp /etc/group 
# groupadd -g 25 smmsp
# useradd -g smmsp -d /dokonimo/nai/directory -s /bin/false -u 25 smmsp
# grep smmsp /etc/passwd
smmsp:x:25:25::/dokonimo/nai/directory:/bin/false

sendmail の インストール

色々設定項目が 必要なので 元のものを 入手しましょう 本当は新しいもの を入手すべきなのでしょうが

$ scp sendmail.8.14.1.tar.gz fdopstm@192.168.24.9:/home/fdopstm/
Password: 
sendmail.8.14.1.tar.gz                        100% 2014KB   2.0MB/s   00:01 

とりあえず 入手してあるもので対応します、 単に pgp の 検証を 省けるだ け?

# cd /usr/local/src/
# mkdir 004_sendmail
# cd 004_sendmail/
# mv /home/fdopstm/sendmail.8.14.1.tar.gz .

作成と インストール

# tar zxvf sendmail.8.14.1.tar.gz 
# cd sendmail-8.14.1/
# sh Build 
# sh Build install
# cd cf/cf/
# cp generic-linux.mc sendmail.mc
# vi sendmail.mc 

これで進めてゆくのですが 今回は 外の項目も 取り入れるので 少し 異る方法になります。

/var/spool/mqueue

”/var/spool/mqueue”が 無いので作成しておきます

# mkdir -p /var/spool/mqueue

ここで 一度 パーミション 関連を 設定します。

# chmod go-w / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue
# chown root / /etc /etc/mail /usr /var /var/spool /var/spool/mqueue
# chmod 0640 /etc/mail/aliases /etc/mail/aliases.{db,pag,dir}
chmod: getting attributes of `/etc/mail/aliases': No such file or directory
chmod: getting attributes of `/etc/mail/aliases.db': No such file or directory
chmod: getting attributes of `/etc/mail/aliases.pag': No such file or directory
chmod: getting attributes of `/etc/mail/aliases.dir': No such file or directory

/sendmail-8.14.1/README の DIRECTORY PERMISSIONS sections や FILE AND # MAP PERMISSIONS に 有る処理を 行いましょう、 未作成の ファイルは無いの で 当然の結果です 後で作成が 必要です。全てでは有りませんが

cyrus-sasl-2.1.22.tar.gz

唐突ですが ”cyrus-sasl-2.1.22.tar.gz” というものが有るようです、 今 の状態は ”sendmail.mc”を 作成した時点で 後の処理は していません なん でこんなものが ということですが ”Outbound Port25 Blocking”というのを 現在 対応しているということが 判明しています、 このまま 作成しても こ の処理を プロバイダが 行っているので このままでは メールを 送る事は出 来ません、そこでその手当をしてから ということに なります。例の如く入手 します。

$ scp cyrus-sasl-2.1.22.tar.gz fdopstm@192.168.24.9:/home/fdopstm/
Password: 
cyrus-sasl-2.1.22.tar.gz                      100% 1572KB   1.5MB/s   00:00  

へて インストールします

# cd /usr/local/src/
# mkdir 101_cyrus
# cd 101_cyruscd/
# mv /home/fdopstm/cyrus-sasl-2.1.22.tar.gz .
# tar zxvf cyrus-sasl-2.1.22.tar.gz
# cd cyrus-sasl-2.1.22
# ./configure
# make 
# make install
...
********************************************************
* WARNING:
* Plugins are being installed into /usr/local/lib/sasl2,
* but the library will look for them in /usr/lib/sasl2.
* You need to make sure that the plugins will eventually
* be in /usr/lib/sasl2 -- the easiest way is to make a
* symbolic link from /usr/lib/sasl2 to /usr/local/lib/sasl2,
* but this may not be appropriate for your site, so this
* installation procedure won't do it for you.
*
* If you don't want to do this for some reason, you can
* set the location where the library will look for plugins
* by setting the environment variable SASL_PATH to the path
* the library should use.
********************************************************
...

へて

# ln -s /usr/local/lib/sasl2 /usr/lib/sasl2
# ls -l /usr/lib/sasl2lrwxrwxrwx 1 \
root root  20 Jan 20 16:19 /usr/lib/sasl2 -> /usr/local/lib/sasl2/

さて話を 戻して

# cd /usr/local/src/004_sendmail/sendmail-8.14.1/
# ls devtools/Site/
README  site.config.m4.sample
# cd devtools/Site/
# cp site.config.m4.sample site.config.m4       
# vi site.config.m4
# sed -e '/^dnl/d' site.config.m4| uniq

APPENDDEF(`confENVDEF', `-DSASL=2')
APPENDDEF(`conf_sendmail_LIBS', `-lsasl2')
APPENDDEF(`confLIBDIRS', `-L/usr/local/lib')
APPENDDEF(`confINCDIRS', `-I/usr/local/include/')

# cd ../../

さて話を 戻して 再度変ですが 条件を 追加した場合 今回の様な場合は”sh Build -c”という オプション ” -c” を つけて 再度 ”Build”する 必要が 有ります。

# sh Build -c
# sh Build install 

”SASLv2”が 組み込まれているか?

# /usr/sbin/sendmail -d0.1 -bp
/usr/sbin/sendmail: error while loading shared libraries: \
libsasl2.so.2: cannot open shared object file: No such file or directory
# ldconfig 
# /usr/sbin/sendmail -d0.1 -bp
Version 8.14.1
 Compiled with: DNSMAP LOG MATCHGECOS MILTER MIME7TO8 MIME8TO7
                NAMED_BIND NETINET NETUNIX NEWDB PIPELINING SASLv2 SCANF USERDB
                XDEBUG
/etc/mail/sendmail.cf: line 0: cannot open: No such file or directory

”sendmail.cf” は未だです ということです。

sendmail.cf

”sendmail.mc”から ”sendmail.cf”を 作成します

# cd cf/cf/
# vi sendmail.mc /* 何処まで作成してたか 忘れました  */
# sed -e '/^dnl/d' sendmail.mc | sed -e '/^#/d' | uniq
divert(-1)

divert(0)dnl
VERSIONID(`$Id: generic-linux.mc,v 8.1 1999/09/24 22:48:05 gshapiro Exp $')
OSTYPE(linux)dnl
DOMAIN(generic)dnl
FEATURE(relay_hosts_only)dnl
FEATURE(`no_default_msa')dnl
FEATURE(`access_db',`hash -o -T<TMPF> /etc/mail/access')dnl 
FEATURE(`use_cw_file',`/etc/mail/local-host-names')dnl
define(`confPRIVACY_FLAGS',`goaway')dnl
define(`SMART_HOST',`esmtp:[XXX.YYYY.GGGG.TTTT]')dnl /* 各 プロバイダのもの  */
define(`confAUTH_MECHANISMS', `LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl
TRUST_AUTH_MECH(`LOGIN PLAIN DIGEST-MD5 CRAM-MD5')dnl
FEATURE(`authinfo', `hash -o /etc/mail/authinfo')dnl
FEATURE(`greet_pause', `5000')  dnl 5 seconds
define(`LUSER_RELAY',`local:bad01')dnl
MAILER(local)dnl
MAILER(smtp)dnl

さて 今度は最後まで

# sh Build sendmail.cf
# sh Build install-cf

残りの設定ファイルに 取り掛かりましょう。

にゃんたろう 拝!

2009年 1月19日 (月) 21:25:12 JST 作成


前へ| 次へ

up

Copyright © 2004.-2009. nyantarou All Rights Reserved.