DAY1 : 必要最小限の設定 (mail)

Linux Basic/Master で行った内容の復習となります。
特に指定しない限り、MTA は sendmail がインストールされています。 Postfix がない人はインストールから行ってください。

前準備

  1. Postfix インストール
    # yum install postfix
    Loaded plugins: fastestmirror
    Loading mirror speeds from cached hostfile
     * addons: www.ftp.ne.jp
     * base: www.ftp.ne.jp
     * extras: www.ftp.ne.jp
     * updates: www.ftp.ne.jp
    Setting up Install Process
    Resolving Dependencies
    --> Running transaction check
    ---> Package postfix.i386 2:2.3.3-2.1.el5_2 set to be updated
    --> Finished Dependency Resolution
    
    Dependencies Resolved
    
    ================================================================================
     Package          Arch          Version                     Repository     Size
    ================================================================================
    Installing:
     postfix          i386          2:2.3.3-2.1.el5_2           base          3.6 M
    
    Transaction Summary
    ================================================================================
    Install       1 Package(s)
    Upgrade       0 Package(s)
    
    Total download size: 3.6 M
    Is this ok [y/N]: y
    Downloading Packages:
    postfix-2.3.3-2.1.el5_2.i386.rpm                         | 3.6 MB     00:20     
    Running rpm_check_debug
    Running Transaction Test
    Finished Transaction Test
    Transaction Test Succeeded
    Running Transaction
      Installing     : postfix                                                  1/1 
    
    Installed:
      postfix.i386 2:2.3.3-2.1.el5_2                                                
    
    Complete!
    
    同様に system-switch-mail もインストールしておきます。

  2. MTAの切り替え
    system-switch-mail により、MTA を sendmail から Postfix に変更します。
    矢印キーと、タブで当該部分を選択し、[ OK ]で [Enter]を押せば変更できます。

設定変更抜粋 (/etc/postfix/mail.cf)

main.cf のうち、変更点を抜粋して掲載
  1. myhostname
    # 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 = host.domain.tld
    #myhostname = virtual.domain.tld
    # ycos 2010/12/26
    myhostname = smtp.t033030.la.net
    

  2. mydomain
    # 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 = domain.tld
    # ycos 2010/12/26
    mydomain = t033030.la.net
    

  3. myorigin
    # 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.
    #
    # For the sake of consistency between sender and recipient addresses,
    # myorigin also specifies the default domain name that is appended
    # to recipient addresses that have no @domain part.
    #
    #myorigin = $myhostname
    # ycos 2010/12/26
    myorigin = $mydomain

  4. inet_interfaces
    # 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].
    #
    # See also the proxy_interfaces parameter, for network addresses that
    # are forwarded to us via a proxy or network address translator.
    #
    # Note: you need to stop/start Postfix when this parameter changes.
    #
    #inet_interfaces = all
    #inet_interfaces = $myhostname
    #inet_interfaces = $myhostname, localhost
    #inet_interfaces = localhost
    # ycos 2010/12/26
    inet_interfaces = all  

  5. mydestination
    # 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, $mydomain,
    #	mail.$mydomain, www.$mydomain, ftp.$mydomain
    # ycos 2010/12/26
    mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain

  6. mynetworks
    # 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
    # ycos 2010/12/26
    mynetworks = 10.20.0.0/16, 127.0.0.0/8 

動作確認