ポプラ nano ( BTOスリムタワーPC ) オリジナル ベアボーン Intel Celeron G530 Windows7 Professional (64bit) 搭載モデル 新品価格 |
PCワンズBTOパソコンG-spirit i73770K GX670-ZDA 新品価格 |
インテル Celeron G540 2.50GHz 2M LGA1155 SandyBridge BX80623G540 新品価格 |
インテル Celeron G530 2.40GHz 2M LGA1155 SandyBridge BX80623G530 新品価格 |
インテル Atom Onboardマザーボード BOXDN2800MT 【Mini-ITX】 新品価格 |
インテル Atom Onboardマザーボード BOXD2700DC 【Mini-ITX】 新品価格 |
インテル Atom Onboardマザーボード BOXD2500HN 【Mini-ITX】 新品価格 |
ECS Mini-ITXマザーボード Atom D2700搭載 CDC-I 日本正規代理店品 (MB1848) CDC-I 新品価格 |
ASRock H61 Micro-ATX SATA3 USB3 HDMI DVI H61M/U3S3 新品価格 |
ASRock Intel H61チップセット搭載 LGA1155対応microATXマザーボード H61M-HVS 新品価格 |
GIGABYTE microATX Intel H61 GA-H61M-DS2 REV2.X 新品価格 |
ASRock マザーボード H61 Mini-ITX H61M-ITX 新品価格 |
ANTEC デザインと冷却性に優れた小型Mini-ITXケース ISK-100 新品価格 |
GIGABYTE intel H61 micro-ATX LGA1155 GA-H61M-DS2H 新品価格 |
SSL有効,AuthはCRAM-MD5(or PLAIN),OP25B対策適用で運用とする。
[root@centos ~]# yum -y install postfix |
[root@centos ~]# vi /etc/postfix/main.cf myhostname = mail.cent-os.jp # 追加(自FQDN名を指定) mydomain = cent-os.jp # 追加(自ドメイン名を指定) myorigin = $mydomain # 追加(ローカルからメール送信時メールアドレス@以降にドメイン名を付加) inet_interfaces = all # 変更(外部からのメール受信を許可) mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain home_mailbox = Maildir/ # 追加(メールボックス形式をMaildir形式にする) smtpd_banner = $myhostname ESMTP unknown # 追加(メールサーバーソフト名の隠蔽化) relayhost = [プロバイダのSMTPサーバー名]:587 # プロバイダのSMTPサーバーを指定(OP25B対策) 以下を最終行へ追加(SMTP-Auth設定) smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = $myhostname smtpd_recipient_restrictions = permit_mynetworks permit_sasl_authenticated reject_unauth_destination 以下を最終行へ追加(受信メールサイズ制限) message_size_limit = 10485760 # 追加(受信メールサイズを10MB=10*1024*1024に制限) 以下を最終行へ追加 smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/authinfo smtp_sasl_security_options = noanonymous smtp_sasl_mechanism_filter = 認証方式 ← telnetで確認する(SMTP認証情報設定参照) 認証方式・・・プロバイダのSMTPサーバーが対応している認証方式(例:LOGIN, CRAM-MD5, PLAIN) |
[root@centos ~]# echo [SMTPサーバー名]:587 ユーザー名:パスワード > /etc/postfix/authinfo |
postmapコマンドでデータベース作成して登録する。
[root@centos ~]# chmod 640 /etc/postfix/authinfo ← root以外参照できないようにパーミッション変更 [root@centos ~]# postmap /etc/postfix/authinfo ← authinfo.db作成 |
[root@centos ~]# vi /etc/dovecot/conf.d/10-mail.conf mail_location = maildir:~/Maildir # 追加(メールボックス形式をMaildir形式とする) valid_chroot_dirs = /home # 追加※OpenSSH+Chrootを導入している場合のみ |
[root@centos ~]# /etc/rc.d/init.d/saslauthd start # saslauthd起動 saslauthd を起動中: [ OK ] [root@centos ~]# chkconfig saslauthd on # saslauthd自動起動設定 |
デフォルトで起動しているSMTPサーバーであるsendmailを停止する
[root@centos ~]# /etc/rc.d/init.d/sendmail stop # sendmail停止 sendmailを停止中: [ OK ] sm-clientを停止中: [ OK ] [root@centos ~]# chkconfig sendmail off # sendmail自動起動設定解除 |
[root@centos ~]# alternatives --config mta # メールサーバー切替え 2 プログラムがあり 'mta'を提供します。 選択 コマンド ----------------------------------------------- *+ 1 /usr/sbin/sendmail.sendmail 2 /usr/sbin/sendmail.postfix Enterを押して現在の選択[+]を保持するか、選択番号を入力します:2 # 2を応答 |
Postfix起動
[root@centos ~]# /etc/rc.d/init.d/postfix start # Postfix起動 Starting postfix: [ OK ] [root@centos ~]# chkconfig postfix on # Postfix自動起動設定 |
mkdir -p /home/centos/Maildir mkdir -p /home/centos/Maildir/cur mkdir -p /home/centos/Maildir/new mkdir -p /home/centos/Maildir/tmp chmod -R 700 /home/centos/Maildir chown -R centos:centos /home/centos/Maildir mkdir -p /Maildir mkdir -p /Maildir/cur mkdir -p /Maildir/new mkdir -p /Maildir/tmp chmod -R 700 /Maildir chown -R centos:centos /Maildir |
[root@centos ~]# yum install telnet |
telnetで接続するクライアント端末がOP25Bの対象か確認する
[ OP25Bの対象になっている場合 ]
[root@centos ~]# telnet alt1.gmail-smtp-in.l.google.com 25 Trying 74.125.113.27... telnet: Unable to connect to remote host: Connection timed out [root@centos ~]# |
[root@centos ~]# telnet alt1.gmail-smtp-in.l.google.com 25 Trying 74.125.113.27... Connected to alt1.gmail-smtp-in.l.google.com. Escape character is '^]'. 220 mx.google.com ESMTP Service ready QUIT 221 Service closing transmission channel Connection closed by foreign host. [root@centos ~]# |
SMTP-AUTH(認証)が必ず必要なことをチェックしてみます。
[root@centos ~]# telnet プロバイダのSMTPサーバー 587 Trying プロバイダのSMTPサーバー... Connected to プロバイダのSMTPサーバー. Escape character is '^]'. 220 host.example.com ESMTP Sendmail 8.13.8/8.13.8; Thu, 13 Oct 2011 14:44:27 +0900 mail from:hoge@example.com ← 自分のメールアドレスをセット 530 5.7.0 Authentication required rcpt to:test-user@yahoo.co.jp ← 宛先のメールアドレスをセット 503 5.0.0 Need MAIL before RCPT QUIT 221 2.0.0 host.example.com closing connection Connection closed by foreign host. [root@centos ~]# |
[root@centos ~]# telnet プロバイダのSMTPサーバー 587 Trying プロバイダのSMTPサーバー... Connected to プロバイダのSMTPサーバー. Escape character is '^]'. 220 host.example.com ESMTP Sendmail 8.13.8/8.13.8; Thu, 13 Oct 2011 14:44:27 +0900 AUTH LOGIN ← Auth認証のログインを実行 334 VXNlcm5hbWU6(Base64でデコードすると「Username:」になる) aG9nZUBleGFtcGxlLmNvbQ== ← Base64でエンコードされたメールアドレスをセット 334 UGFzc3dvcmQ6(Base64でデコードすると「Password:」になる) cHBwd3d3 ← Base64でエンコードされたパスワードをセット 235 2.0.0 OK Authenticated mail from:hoge@example.com 250 2.1.0 hoge@example.com... Sender ok rcpt to:test-user@yahoo.co.jp 250 2.1.5 test-user@yahoo.co.jp... Recipient ok data 354 Enter mail, end with "." on a line by itself TEST Relay 587 . 250 2.0.0 p9D5iRKZ015644 Message accepted for delivery QUIT 221 2.0.0 host.example.com closing connection Connection closed by foreign host. [root@centos ~]# |
[root@centos ~]# perl -MMIME::Base64 -e 'print encode_base64("hoge@example.com");' |
プロバイダのSMTPサーバーが対応している認証方式を調査する
[root@centos ~]# telnet プロバイダのSMTPサーバー名 25または587 ← プロバイダのSMTPサーバーへ接続 Trying XXX.XXX.XXX.XXX... Connected to プロバイダのSMTPサーバー名 (XXX.XXX.XXX.XXX). Escape character is '^]'. 220 プロバイダのSMTPサーバー名 ESMTP ehlo localhost ← ehlo localhost応答 250-プロバイダのSMTPサーバー名 250-AUTH LOGIN CRAM-MD5 PLAIN ← プロバイダのSMTPサーバーが対応している認証方式 250-AUTH=LOGIN CRAM-MD5 PLAIN 250-PIPELINING 250 8BITMIME quit ← quit応答 221 プロバイダのSMTPサーバー名 Connection closed by foreign host. |