- 追加された行はこのように表示されます。
- 削除された行は
このように表示されます。
!!!Postfix メールサーバの構築
!!インストール
::sendmailが動いているか確認
# ps -ef | grep sendmail
root 1550 1 0 08:51 ? 00:00:00 sendmail: accepting connections
smmsp 1558 1 0 08:51 ? 00:00:00 sendmail: Queue runner@01:00:00 for /var/spool/clientmqueue
::postfixのインストールとアップデート
# yum install postfix
# yum update postfix
::MTAの切り替え
# /usr/sbin/alternatives --config mta
2 プログラムがあり 'mta' を提供します。
選択 コマンド
-----------------------------------------------
*+ 1 /usr/sbin/sendmail.sendmail
2 /usr/sbin/sendmail.postfix
Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:2
# /etc/init.d/sendmail stop
sm-client を停止中: [ OK ]
sendmail を停止中: [ OK ]
# /etc/init.d/postfix start
postfix を起動中: [ OK ]
::[ファイアウォールの設定|Fedora Core 6 ファイヤーウォールの設定]
{{ref_image postfix-01.JPG}}
!設定
/etc/postfix/main.cf ファイルを編集する
::ローカル配送用ユーザ
コメント解除
default_privs = nobody
::ホスト名
myhostname = garuda.typea.info
::ドメイン
mydomain = typea.info
::送信元
コメント解除
myorigin = $myhostname
::受信設定
コメント解除
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
::配送設定
ユーザーのホームディレクトリにメールを配送
*dovecotのmail_location(旧default_mail_env)にあわせる
**mail_location = maildir:~/Mailbox
*末尾の/必要
home_mailbox = Mailbox/
::中継設定
ローカルネットワークのメールのみ中継
mynetworks_style = subnet
!再起動と読み込み
# /sbin/service postfix restart
# /sbin/service postfix reload
::新規追加するユーザのホームディレクトリにMailboxファイル(/home/ユーザ名/Mailbox)が自動で作成されるようにする
# cd /etc/skel
# mkdir Mailbox
# chmod 700 -R Mailbox
!動作確認
# telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1).
Escape character is '^]'.
220 garuda.typea.info ESMTP Postfix
helo typea.info
250 garuda.typea.info
ai^H
502 5.5.2 Error: command not recognized
mail from:piroto
250 2.1.0 Ok
rcpt to:piroto@a-net.email.ne.jp
250 2.1.5 Ok
data
354 End data with <CR><LF>.<CR><LF>
subject:test
this is test.
.
250 2.0.0 Ok: queued as 8AFD072803B
quit
221 2.0.0 Bye
Connection closed by foreign host.
!サブミッションポート
/etc/postfix/master.cf
submission inet n - n - - smtpd
-o smtpd_enforce_tls=yes
-o smtpd_client_restrictions=reject
-o smtpd_sasl_auth_enable=yes
-o smtpd_client_restrictions=permit_sasl_authenticated,reject