Sendmailの設定
TurboLinux Advanced Server 6の場合
初期状態では、sendmailで使用する /etc/aliases ファイルが無いので
/etc/mail/aliasesファイルを、/etc にコピーします。

root権限で、(su スーパーユーザー)
# cd /etc/mail
# cp aliases /etc/
# newaliases

sendmail.defの設定
簡単に設定できる sendmail.def を使用し、設定ファイル sendmaile.cf を作成します。
TurboLinux WS6.0の場合、設定ファイル sendmail.def は以下のディレクトリにあります。
/usr/src/CF-3.7Wp12/sendmail.def の設定

### Standard sendmail.cf for sendmail 8.9 or later ###
CF_TYPE=R8V8
VERSION=3.7W
VERSION_SEPARATOR='-'
LOCAL_VERSION='MailExchanger'
OS_TYPE=linux-redhat
MX_SENDMAIL=yes
MY_DOMAIN=hosoyama.dyn.to
MY_NAME=mail
OFFICIAL_NAME='$w.$m'
FROM_ADDRESS='$j'
FROM_ADDRESS='$m'
RECIPIENT_GENERIC=yes
REWRITE_GENERIC_FROM=lower
REWRITE_GENERIC_TO=no
CANON=one
ACCEPT_ADDRS='$m'
ACCEPT_ADDRS='mail.hosoyama.dyn.to hosoyama.dyn.to '
ACCEPT_LOWER=yes
LOCAL_MAILER_PATH='/usr/bin/procmail'
LOCAL_MAILER_FLAG_BASE='lsDFMAw5:/|@qSPfhn9'
PROG_MAILER_PATH='/usr/libexec/smrsh'
LOCALDELIVER_PROCMAIL=yes
PROCMAIL_MAILER_PATH=/usr/bin/procmail
PROCMAIL_MAILER_ARGS='procmail -Y -m $h $f $u'
PMLOCAL_MAILER_ARGS='procmail -Y -a $h -d $u'
PROCMAIL_MAILER_FLAG='DFMSPhnu9'
PMLOCAL_MAILER_FLAG='lDFMAw5:/|@SPqfhn9'
BITNET=auto
REJECT_JUNET=yes
DIRECT_DELIVER_DOMAINS=hosoyama.dyn.to
DEFAULT_RELAY='smtp:mail.asahi-net.or.jp '
HELP_FILE_PATH='/etc/mail/sendmail.hf'
FORWARD_FILE_PATH='$z/.forward.$w:$z/.forward'
STAT_FILE_PATH='/var/log/sendmail.st'
MAIL_RELAY_RESTRICTION=yes

DEFAULT_RELAYは、
プロバイダーの送信(SMTP)サーバー名にしました。

sendmail.cf の作成
# cd /usr/src/CF-3.7Wp12
# make sendmail.cf

sendmail.cf の編集(IPマスカレードクライアントの追加)
2002年5月にIPマスカレード導入により、マスカレードクライアントから
メール発信できなくなったため追加

/usr/src/CF-3.7Wp12/sendmail.cfの編集


################################
# SMTP processing restrictions #
################################

##
## upon SMTP authentication
##

# CONFIG: clients to be allowed to connect this server
C{HostAllow} 127.0.0.1
#C{HostAllow} 12.34.56
#F{HostAllow} -o /etc/mail/allow
# CONFIG: clients to be rejected to connect this server
#C{HostDeny} 23.45.67
#F{HostDeny} -o /etc/mail/deny
# CONFIG: acceptable (no further checking) clients
C{LocalIP} 127.0.0.1
C{LocalIP} 192.168.0

C{LocalIP} 192.168.1 ----追加(IPマスカレードクライアント)

C{LocalDom} localhost

上記の一行の追加により、IPマスカレードクライアントからメール発信可能になりました

sendmail.cf を /etc にコピー
# cp sendmail.cf /etc/

# /usr/sbin/turboservice ------turboserviceの起動
sendmail を選択(カーソル↓)
s ------sキー入力で、sendmailデーモンがスタート
escで終了

sendmail.cf の確認
# sendmail -v -d0 < /dev/null
# sendmail -v ken < /dev/null
内部ユーザーに向けてテストメール発信
# sendmail -v ken@hosoyama.dyn.to < /dev/null
  インターネット経由で内部ユーザーに発信
 以上でエラーが出なければ、設定終了

ipop3dの設定
# /etc/inetd.confの設定

#
# inetd.conf This file describes the services that will be available
# through the INETD TCP/IP super server. To re-configure
# the running INETD process, edit this file, then send the
# INETD process a SIGHUP signal.
#
# Version: @(#)/etc/inetd.conf 3.10 05/27/93
#
# Authors: Original taken from BSD UNIX 4.3/TAHOE.
# Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
#
# Modified for Debian Linux by Ian A. Murdock <imurdock@shell.portal.com>
#
# Modified for RHS Linux by Marc Ewing <marc@redhat.com>
# Modified for TurboLinux/TurboLinux Server by Scott Stone
# <sstone@turbolinux.com>
#
# <service_name> <sock_type> <proto> <flags> <user> <server_path> <args>
#
# Echo, discard, daytime, and chargen are used primarily for testing.
#
# To re-read this file after changes, just do a 'killall -HUP inetd'
#
echo stream tcp nowait root internal
echo dgram udp wait root internal
discard stream tcp nowait root internal
discard dgram udp wait root internal
daytime stream tcp nowait root internal
daytime dgram udp wait root internal
chargen stream tcp nowait root internal
chargen dgram udp wait root internal
#
# These are standard services.
#
#ftp stream tcp nowait root /usr/sbin/tcpd in.ftpd -l -a
#telnet stream tcp nowait root /usr/sbin/tcpd in.telnetd -h
#gopher stream tcp nowait root /usr/sbin/tcpd gn

# do not uncomment smtp unless you *really* know what you are doing.
# smtp is handled by the sendmail daemon now, not smtpd. It does NOT
# run from here, it is started at boot time from /etc/rc.d/rc#.d.
#smtp stream tcp nowait root /usr/bin/smtpd smtpd
#nntp stream tcp nowait root /usr/sbin/tcpd in.nntpd
#
# Shell, login, exec and talk are BSD protocols.
#
#shell stream tcp nowait root /usr/sbin/tcpd in.rshd
#login stream tcp nowait root /usr/sbin/tcpd in.rlogind
#exec stream tcp nowait root /usr/sbin/tcpd in.rexecd
#talk dgram udp wait root /usr/sbin/tcpd in.talkd
#ntalk dgram udp wait root /usr/sbin/tcpd in.ntalkd
#dtalk stream tcp wait nobody /usr/sbin/tcpd in.dtalkd
#
# Pop and imap mail services et al
#
#pop-2 stream tcp nowait root /usr/sbin/tcpd ipop2d
pop-3 stream tcp nowait root /usr/sbin/tcpd ipop3d
#imap stream tcp nowait root /usr/sbin/tcpd imapd
#
# The Internet UUCP service.
#
#uucp stream tcp nowait uucp /usr/sbin/tcpd /usr/lib/uucp/uucico -l
#
# Tftp service is provided primarily for booting. Most sites
# run this only on machines acting as "boot servers." Do not uncomment
# this unless you *need* it.
#
#tftp dgram udp wait root /usr/sbin/tcpd in.tftpd
#bootps dgram udp wait root /usr/sbin/tcpd bootpd
#
# Finger, systat and netstat give out user information which may be
# valuable to potential "system crackers." Many sites choose to disable
# some or all of these services to improve security.
#
# cfinger is for GNU finger, which is currently not in use in RHS Linux
#
#finger stream tcp nowait root /usr/sbin/tcpd in.fingerd
#cfinger stream tcp nowait root /usr/sbin/tcpd in.cfingerd
#systat stream tcp nowait guest /usr/sbin/tcpd /bin/ps -auwwx
#netstat stream tcp nowait guest /usr/sbin/tcpd /bin/netstat -f inet
#
# Time service is used for clock syncronization.
#
#time stream tcp nowait nobody /usr/sbin/tcpd in.timed
#time dgram udp wait nobody /usr/sbin/tcpd in.timed
#
# Authentication
#
#auth stream tcp nowait nobody /usr/sbin/in.identd in.identd -l -e -o
#
# End of inetd.conf

#swat stream tcp nowait.400 root /usr/sbin/tcpd /usr/sbin/swat

pop3のコメントアウト(#)を外し、保存する。

/etc/hosts.denyの設定

#
# hosts.deny This file describes the names of the hosts which are
# *not* allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# See man hosts_access(5) for more information.

ALL: ALL:

とりあえず、すべてのアクセスを禁止し保存する。(ディフォルトのままでよかった)

/etc/hosts.allowの設定

#
# hosts.allow This file describes the names of the hosts which are
# allowed to use the local INET services, as decided
# by the '/usr/sbin/tcpd' server.
#
# See man hosts_access(5) for more information

ALL : 127.0.0.1:allow

sshd : 192.168.0.0/255.255.255.0 :allow
sshd : 192.168.1.0/255.255.255.0 :allow ----(注)IPマスカレードするクライアントアドレス
ipop3d: 192.168.0.0/255.255.255.0 :allow
ipop3d: 192.168.1.0/255.255.255.0 :allow ----(注)IPマスカレードするクライアントアドレス

(注)IPマスカレードするクライアントを追加

pop3とsshのアクセスを内部ネットワークからのみ許可し保存する。

smtpは、sendmail自身に機能があるので、設定しない。

# ps -aux | grep inet
inetdのプロセス番号を確認
# kill -HUP プロセス番号
inetdを再起動

メールクライアントの設定
受信メールサーバー(POP)名  サーバーマシン名(ドメイン部はいらない)
送信メールサーバー(SMTP)名 同上

以上で、LAN内のマシンからインターネットメールの送受信が可能になります。

TOP