メールサーバ構築sendmailの確認
sendmailは、Linuxインストール時に自動的にインストールされていますが、なるべくならセキュリティのために最新版にアップデートしておきます。 $ rpm -qa | grep sendmail sendmail-devel-8.12.11-4.RHEL3.1 sendmail-cf-8.12.11-4.RHEL3.1 sendmail-8.12.11-4.RHEL3.1 sendmailの設定ファイル/etc/mail/access
標準ではローカルドメインとローカルホストにのみメールリレーを許可しています。プライベートネットワークからのリレーを許可します。 # Check the /usr/share/doc/sendmail/README.cf file for a description # of the format of this file. (search for access_db in that file) # The /usr/share/doc/sendmail/README.cf is part of the sendmail-doc # package. # # by default we allow relaying from localhost... localhost.localdomain RELAY localhost RELAY 127.0.0.1 RELAY 192.168.0 RELAY <-- プライベートネットワークからのリレーを許可 spam@hoge.co.jp REJECT <-- 特定のメールアドレスを拒否 /etc/mail/sendmail.mcsendmail.mcはsendmail本体の設定ファイルである、sendmail.cfを生成するための設定ファイルです。 標準はローカルホストからしか受け付けないように設定されているため、下記をコメント(dnlを挿入)にします。 DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl ↓ dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl このサーバー上のユーザーから送られた場合の受信メールのFrom : のホスト名を指定します。 Cwpowerdee.com
マスカレードはアドレスのホスト名の部分を書き換えます。 dnl MASQUERADE_AS(`mydomain.com')dnl ↓ MASQUERADE_AS(`powerdee.com')dnl dnl FEATURE(masquerade_envelope)dnl ↓ FEATURE(masquerade_envelope)dnl sendmail.cfの作成# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf 設定ファイルのDBM化/etc/mail/sendmail.mcファイルを除いて、makeコマンドで変更した設定ファイルをDBMに変換しておく必要があります。 # cd /etc/mail # make # /etc/init.d/sendmail restart sendmailを停止中: [ OK ] sm-clientを停止中: [ OK ] sendmailを起動中: [ OK ] sm-clientを起動中: [ OK ] POPサーバの起動popサーバはipop3を起動するように設定します。/etc/xinetd.d/ipop3を編集します。
# default: off
# description: The POP3 service allows remote users to access their mail \
# using an POP3 client such as Netscape Communicator, mutt, \
# or fetchmail.
service pop3
{
socket_type = stream
wait = no
user = root
server = /usr/sbin/ipop3d
log_on_success += HOST DURATION
log_on_failure += HOST
disable = no <-- yes を noに変更
}
xinetdを再起動します。 # /etc/init.d/xinetd restart xinetdを停止中: [ OK ] xinetdを起動中: [ OK ] 配信テストtelnetでsmtpサーバ(25番ポート)に接続して配信テストをします。結果をメールクライアントから受信できればOKです。 # telnet localhost 25 Trying 127.0.0.1... Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. 220 host.powerdee.com ESMTP Sendmail 8.12.11/8.12.11; Sun, 20 Feb 2005 17:45:02 +0900 helo powerdee.com 250 host.powerdee.com Hello localhost.localdomain [127.0.0.1], pleased to meet you mail from:<root@powerdee.com> 250 2.1.0 <root@powerdee.com>... Sender ok rcpt to:<webmaster@powerdee.com> 250 2.1.5 <webmaster@powerdee.com>... Recipient ok data 354 Enter mail, end with "." on a line by itself Subject: test mail this is a test . 250 2.0.0 j1K8j2wr003471 Message accepted for delivery quit 221 2.0.0 host.powerdee.com closing connection Connection closed by foreign host. おすすめ書籍
|