# /etc/rc.d/init.d/sendmail stop sm-client を停止中: [ OK ] sendmail を停止中: [ OK ] # /sbin/chkconfig sendmail off # /sbin/chkconfig --list sendmail sendmail 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# yum -y install postfix
# alternatives --config mta 2 プログラムがあり 'mta' を提供します。 選択 コマンド ----------------------------------------------- *+ 1 /usr/sbin/sendmail.sendmail 2 /usr/sbin/sendmail.postfix Enter を押して現在の選択 [+] を保持するか、選択番号を入力します:2
# ls -la /etc/alternatives/ | grep mta lrwxrwxrwx. 1 root root 26 2010-07-07 18:10 mta -> /usr/sbin/sendmail.postfix lrwxrwxrwx. 1 root root 40 2010-07-07 18:10 mta-aliasesman -> /usr/share/man/man5/aliases.postfix.5.gz lrwxrwxrwx. 1 root root 22 2010-07-07 18:10 mta-mailq -> /usr/bin/mailq.postfix lrwxrwxrwx. 1 root root 38 2010-07-07 18:10 mta-mailqman -> /usr/share/man/man1/mailq.postfix.1.gz lrwxrwxrwx. 1 root root 27 2010-07-07 18:10 mta-newaliases -> /usr/bin/newaliases.postfix lrwxrwxrwx. 1 root root 43 2010-07-07 18:10 mta-newaliasesman -> /usr/share/man/man1/newaliases.postfix.1.gz lrwxrwxrwx. 1 root root 23 2010-07-07 18:10 mta-pam -> /etc/pam.d/smtp.postfix lrwxrwxrwx. 1 root root 22 2010-07-07 18:10 mta-rmail -> /usr/bin/rmail.postfix lrwxrwxrwx. 1 root root 25 2010-07-07 18:10 mta-sendmail -> /usr/lib/sendmail.postfix lrwxrwxrwx. 1 root root 41 2010-07-07 18:10 mta-sendmailman -> /usr/share/man/man1/sendmail.postfix.1.gz
# /sbin/chkconfig --level 35 postfix on # /sbin/chkconfig --list | grep postfix postfix 0:off 1:off 2:off 3:on 4:off 5:on 6:off
$ sudo /usr/bin/system-config-firewall
# diff -u main.cf.original main.cf --- main.cf.original 2010-07-07 22:29:21.647280593 +0900 +++ main.cf 2010-07-07 22:43:23.115277889 +0900
@@ -74,6 +74,7 @@ # #myhostname = host.domain.tld #myhostname = virtual.domain.tld +myhostname = orange.hondou.homedns.org # The mydomain parameter specifies the local internet domain name. # The default is to use $myhostname minus the first component.
@@ -81,6 +82,7 @@ # parameters. # #mydomain = domain.tld +mydomain = hondou.homedns.org # SENDING MAIL #
@@ -96,7 +98,7 @@ # to recipient addresses that have no @domain part. # #myorigin = $myhostname -#myorigin = $mydomain +myorigin = $mydomain # RECEIVING MAIL
@@ -110,10 +112,10 @@ # # Note: you need to stop/start Postfix when this parameter changes. # -#inet_interfaces = all +inet_interfaces = all #inet_interfaces = $myhostname #inet_interfaces = $myhostname, localhost -inet_interfaces = localhost +#inet_interfaces = localhost # Enable IPv4, and IPv6 if supported inet_protocols = all
@@ -161,8 +163,8 @@ # # See also below, section "REJECTING MAIL FOR UNKNOWN LOCAL USERS". # -mydestination = $myhostname, localhost.$mydomain, localhost -#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain +#mydestination = $myhostname, localhost.$mydomain, localhost +mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain #mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain, # mail.$mydomain, www.$mydomain, ftp.$mydomain
@@ -264,6 +266,7 @@ #mynetworks = 168.100.189.0/28, 127.0.0.0/8 #mynetworks = $config_directory/mynetworks #mynetworks = hash:/etc/postfix/network_table +mynetworks = 192.168.1.0/24, 127.0.0.0/8, [::1]/128IPv6 のアドレスを加えなきゃいけなくなった。時代はちょっとずつ進んでるんですな
# The relay_domains parameter restricts what destinations this system will # relay mail to. See the smtpd_recipient_restrictions description in @@ -416,7 +419,7 @@ # "Maildir/" for qmail-style delivery (the / is required). # #home_mailbox = Mailbox -#home_mailbox = Maildir/ +home_mailbox = Maildir/ # The mail_spool_directory parameter specifies the directory where # UNIX-style mailboxes are kept. The default setting depends on the
@@ -674,3 +677,17 @@ # readme_directory: The location of the Postfix README files. # readme_directory = /usr/share/doc/postfix-2.7.0/README_FILES + +# Size Limit (1GB / 100MB) +mailbox_size_limit = 1073741824 +message_size_limit = 104857600
+ +# OP25B(Outbound Port 25 Blocking) +relayhost = [msagw.biglobe.ne.jp] +smtp_sasl_type = cyrus +smtp_sasl_auth_enable = yes +smtp_sasl_password_maps = hash:/etc/postfix/sasl_password +smtp_sasl_security_options = noanonymous +smtp_sasl_mechanism_filter = cram_md5,plain,login
+# Reject any mail clients which has not host name. (Perhaps, they are SPAMer. ) +smtpd_client_restrictions = permit_mynetworks,reject_unauth_destination,reject_unknown_client,permit
# cd /etc/postfix/ # vi sasl_password msagw.biglobe.ne.jp ※ユーザ名※:※パスワード※ # chmod 700 sasl_password # postmap sasl_password # ls | grep sasl sasl_password sasl_password.db
postfix からは sasl_password.db が使われる。
なお、SASL につかう cyrus は、既にインストールされていた
# yum list installed | grep cyrus cyrus-sasl.i686 2.1.23-11.fc13 @released/$releasever cyrus-sasl-gssapi.i686 2.1.23-11.fc13 @released/$releasever cyrus-sasl-lib.i686 2.1.23-11.fc13 @released/$releasever cyrus-sasl-md5.i686 2.1.23-11.fc13 @released/$releasever cyrus-sasl-plain.i686 2.1.23-11.fc13 @released/$releasever
# cat mkmailbox.sh #!/bin/bash for user in `ls /home/` do if [ $user != "lost+found" ] then HOMEDIR=/home/$user mkdir -p $HOMEDIR/Maildir/new mkdir -p $HOMEDIR/Maildir/cur mkdir -p $HOMEDIR/Maildir/tmp chown $user:$user -R $HOMEDIR/Maildir chmod -R 700 $HOMEDIR/Maildir fi done
# mkdir -p /etc/skel/Maildir/new # mkdir -p /etc/skel/Maildir/cur # mkdir -p /etc/skel/Maildir/tmp # chmod -R 700 /etc/skel/Maildir/
# useradd -s /sbin/nologin ※ユーザ名※ # passwd ※ユーザ名※
# /etc/init.d/postfix start postfix を起動中: [ OK ]
# mail kagyuu Subject: TEST MAIL TEST EOT
$ cat ~/Maildir/new/1278523187.Vfd02Ie80165M31567.orange.homelan Return-Path: <root@hondou.homedns.org> X-Original-To: kagyuu Delivered-To: kagyuu@hondou.homedns.org Received: by orange.hondou.homedns.org (Postfix, from userid 0) id B0F17415F3; Thu, 8 Jul 2010 02:08:26 +0900 (JST) Date: Thu, 08 Jul 2010 02:08:26 +0900 To: kagyuu@hondou.homedns.org Subject: TEST User-Agent: Heirloom mailx 12.4 7/29/08 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <20100707170858.B0F17415F3@orange.hondou.homedns.org> From: root@hondou.homedns.org (root) MAIL TEST