カスタム検索
このエントリーをはてなブックマークに追加
tomo.gif (1144 ツバツイツト)line.gif (927 ツバツイツト)line.gif (927 ツバツイツト)To previous pageTo home pageMailing to me

Postfixの実験

Modified: 22 February 2004


パッケージのインストール
基本設定
起動設定

Postfixの小技


 パッケージのインストール

パッケージをインストール

"/stand/sysinstall" を起動し、パッケージをインストールします。

「Package Selection」で、「mail」 を選択し、「Postfix-2.0.15,1」をインストールしました。


 基本設定

"/usr/local/etc/postfix/main.cf"の基本設定

最低限、以下のように変更します。(変更箇所は、赤い色を付けています。)

最低限、以下の5つを指定します。
myhostname, mydomain, myorigin, inet_interfaces, mynetworks

# Global Postfix configuration file. This file lists only a subset
# of all 100+ parameters. See the sample-xxx.cf files for a full list.
#
# The general format is lines with parameter = value pairs. Lines
# that begin with whitespace continue the previous line. A value can
# contain references to other $names or ${name}s.
#
# NOTE - CHANGE NO MORE THAN 2-3 PARAMETERS AT A TIME, AND TEST IF
# POSTFIX STILL WORKS AFTER EVERY CHANGE.

   :
   :
   :

# INTERNET HOST AND DOMAIN NAMES
#
# The myhostname parameter specifies the internet hostname of this
# mail system. The default is to use the fully-qualified domain name
# from gethostname(). $myhostname is used as a default value for many
# other configuration parameters.
#
myhostname = fb49r-83-mail-postfix.tomo.ac

# The mydomain parameter specifies the local internet domain name.
# The default is to use $myhostname minus the first component.
# $mydomain is used as a default value for many other configuration
# parameters.
#
mydomain = tomo.ac

# SENDING MAIL
#
# The myorigin parameter specifies the domain that locally-posted
# mail appears to come from. The default is to append $myhostname,
# which is fine for small sites. If you run a domain with multiple
# machines, you should (1) change this to $mydomain and (2) set up
# a domain-wide alias database that aliases each user to
# user@that.users.mailhost.
#
#myorigin = $myhostname
myorigin = $mydomain

# RECEIVING MAIL

# The inet_interfaces parameter specifies the network interface
# addresses that this mail system receives mail on. By default,
# the software claims all active interfaces on the machine. The
# parameter also controls delivery of mail to user@[ip.address].
#
#inet_interfaces = localhost
inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost

   :
   :
   :

# Specify a list of host or domain names, /file/name or type:table
# patterns, separated by commas and/or whitespace. A /file/name
# pattern is replaced by its contents; a type:table is matched when
# a name matches a lookup key. Continue long lines by starting the
# next line with whitespace.
#
mydestination = $myhostname, $mydomain
#mydestination = $myhostname, localhost.$mydomain $mydomain
#mydestination = $myhostname, localhost.$mydomain, $mydomain,
# mail.$mydomain, www.$mydomain, ftp.$mydomain

   :
   :
   :

# Alternatively, you can specify the mynetworks list by hand, in
# which case Postfix ignores the mynetworks_style setting.
#
# Specify an explicit list of network/netmask patterns, where the
# mask specifies the number of bits in the network part of a host
# address.
#
# You can also specify the absolute pathname of a pattern file instead
# of listing the patterns here. Specify type:table for table-based lookups
# (the value on the table right-hand side is not used).
#
#mynetworks = 168.100.189.0/28, 127.0.0.0/8
#mynetworks = $config_directory/mynetworks
#mynetworks = hash:/etc/postfix/network_table
mynetworks = 192.168.0.0/24, 127.0.0.1/8

   :
   :
   :

# readme_directory: The location of the Postfix README files.
#
readme_directory = /etc/postfix/README_FILES
alias_database = hash:/etc/postfix/aliases

"inet_interfaces = all"を指定しないと、postfixをインストールしているPCしか利用できません。つまり、他のPCから利用できません。
(つまり、"inet_interfaces = all"を指定しないと、ポート25が開きません。)

設定の確認

以下のコマンドで設定の確認をします。

# /usr/local/sbin/postfix check
#

何も出ず、プロンプトが帰ってきたら設定はOKです。


"/etc/rc.conf"の設定

     :

sendmail_enable="NONE"

     :


"/etc/mail/mailer.conf" の設定vi 

"/etc/mail/mailer.conf" を、Postfix用に設定します。

# $FreeBSD: src/etc/mail/mailer.conf,v 1.2.2.1 2002/04/09 02:00:56 gshapiro Exp
$
#
# Execute the "real" sendmail program, named /usr/libexec/sendmail/sendmail
#
#sendmail       /usr/libexec/sendmail/sendmail
#send-mail      /usr/libexec/sendmail/sendmail
#mailq          /usr/libexec/sendmail/sendmail
#newaliases     /usr/libexec/sendmail/sendmail
#hoststat       /usr/libexec/sendmail/sendmail
#purgestat      /usr/libexec/sendmail/sendmailv

sendmail        /usr/local/sbin/sendmail
send-mail       /usr/local/sbin/sendmail
mailq           /usr/local/sbin/sendmail
newaliases      /usr/local/sbin/sendmail
hoststat        /usr/local/sbin/sendmail
purgestat       /usr/local/sbin/sendmail

 起動設定

起動設定

"/etc/rc.local" に、以下の内容のスクリプトファイルを、"postfix" のファイル名でを作成します。

#!/bin/sh

# postfix
/usr/local/sbin/postfix start

初期化します。

# newaliases

これを実行しないと、うまく起動できません。


動作確認telnet localhost 25

 

# telnet localhost 25
Trying ::1...
telnet: connect to address ::1: Connection refused
Trying 127.0.0.1...
Connected to localhost.tomo.ac.
Escape character is '^]'.
220 fb49r-83-mail.tomo.ac ESMTP Postfix
QUIT
221 Bye
Connection closed by foreign host.
#

To previous pageTo home pageMailing to meJump to Top of pageline.gif (927 ツバツイツト)tomo.gif (1144 ツバツイツト)
カスタム検索



このエントリーをはてなブックマークに追加