<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>clicktx::Tech::Memo &#187; メールサーバ</title>
	<atom:link href="http://perl.no-tubo.net/category/%e3%82%b5%e3%83%bc%e3%83%90%e7%ae%a1%e7%90%86/%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90/feed/" rel="self" type="application/rss+xml" />
	<link>http://perl.no-tubo.net</link>
	<description>perl、 MySQL、オープンソース系、ウェブ系ネタ。なぜか鯖管メモがほとんどを占めている...</description>
	<lastBuildDate>Wed, 08 Feb 2012 00:06:37 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://perl.no-tubo.net/category/%e3%82%b5%e3%83%bc%e3%83%90%e7%ae%a1%e7%90%86/%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90/feed/" />
		<item>
		<title>smtpサーバが迷惑メールサーバと思われないようにする</title>
		<link>http://perl.no-tubo.net/2011/06/30/smtp%e3%82%b5%e3%83%bc%e3%83%90%e3%81%8c%e8%bf%b7%e6%83%91%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e3%81%a8%e6%80%9d%e3%82%8f%e3%82%8c%e3%81%aa%e3%81%84%e3%82%88%e3%81%86%e3%81%ab/</link>
		<comments>http://perl.no-tubo.net/2011/06/30/smtp%e3%82%b5%e3%83%bc%e3%83%90%e3%81%8c%e8%bf%b7%e6%83%91%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e3%81%a8%e6%80%9d%e3%82%8f%e3%82%8c%e3%81%aa%e3%81%84%e3%82%88%e3%81%86%e3%81%ab/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 04:47:56 +0000</pubDate>
		<dc:creator>clicktx</dc:creator>
				<category><![CDATA[postfix]]></category>
		<category><![CDATA[メールサーバ]]></category>
		<category><![CDATA[迷惑メール対策]]></category>

		<guid isPermaLink="false">http://perl.no-tubo.net/?p=1805</guid>
		<description><![CDATA[DNSの逆引き設定
今まで逆引き設定していなかったメールサーバから送ったメールには
Received: from sv.domain.com (sv.domain.com [127.0.0.1])
	by mail.do [...]]]></description>
			<content:encoded><![CDATA[<h3>DNSの逆引き設定</h3>
<p>今まで逆引き設定していなかったメールサーバから送ったメールには</p>
<pre>Received: from sv.domain.com (sv.domain.com [127.0.0.1])
	by mail.domain.com (Postfix) with SMTP id…</pre>
<p>のようなヘッダとなっていて、localhost(127.0.0.1)から送られたものだとされていた。</p>
<p>これが迷惑メールとされる一因なので、mail.domain.com はちゃんとしたサーバですよー、と知らせるためにグローバルなIPアドレスをあててあげる。</p>
<p>DNSの逆引きはドメインの管理とは関係ないので、回線業者が提供するサイトなりツールから設定。メールサーバのドメインが mail.domain.com、IPアドレスが111.222.33.4 の場合。<br />
111.222.33.4にmail.domain.comを割り当てる。</p>
<p>逆引きを設定すると</p>
<pre>Received: from 111.222.33.4  (EHLO maildomain.com) (111.222.33.4)
  by mta...</pre>
<p>のようなヘッダとなる。</p>
<p>Gmailではこれだけで迷惑メールと判断されなくなった。</p>
<h3>Yahooメールでの対策</h3>
<p>上記対応をして一時的に改善しても、１日程度経つと再び迷惑メールに振り分けられる場合がある。この場合はメールヘッダに X-YahooFilteredBulk: 111.222.33.4 等と入っている可能性があるので、Yahooに問い合わせる必要がある。</p>
<h4>オープンリレーを許可していないか確認する。</h4>
<p><a href="http://www.rbl.jp/svcheck.php">第三者中継チェック RBL.JP</a></p>
<p>全てが青い文字で no relays accepted. となればおｋ．</p>
<h4>Yahooに問い合わせ</h4>
<p><a href="http://help.yahoo.co.jp/help/jp/ymail/anti-spam/anti-spam-11.html">Yahoo!メール（ベータ版） ヘルプ &#8211; [迷惑メール]フォルダに振り分けられたくないメールがある</a><br />
へ行き、一番下の「解決しましたか？」でいいえを選択すると問い合わせフォームになるのでそこから問い合わせる。</p>
<p>きちんとすれば、予想以上に早い対応をしてもらえる。<br />
対応後にはこんなメールを頂ける。</p>
<pre>◯◯◯◯　◯◯様

Yahoo!メールカスタマーサービス◯◯です。
このたびは、調査および調整に必要な情報をご提供くださいまして、
誠にありがとうございました。

お問い合わせの「Yahoo!メール・迷惑メールフォルダへのメール振り分け」に
ついてご案内いたします。

お知らせいただいた情報をもとに調査を行い、ご利用のメールサーバーに
問題がないことを確認しましたので、弊社にて調整を実施いたしました。
・・・以下（ｒｙ</pre>
<p>まさに <a href="http://d.hatena.ne.jp/rx7/20100319/p1">Amazon EC2のサーバからメール送信をするまでにやるべきこと (スパムメール扱いを回避する！) &#8211; RX-7乗りの適当な日々</a> の</p>
<blockquote><p>DNS逆引き設定<br />
SPFの設定<br />
SPAMメールのブラックリストに対する解除申請</p></blockquote>
<p>のまんまですが。</p>
<h3>SPFについて</h3>
<p>とりあえず逆引き設定で迷惑メールに振り分けられる問題は改善したのだけど、SPF(Sender Policy Framework)を設定しておくともっとよさそう。</p>
<p>SPFは 送信者(from) が taro@domain.com なら domain.com が評価対象となる。メールサーバは関係ないようだ。fromのFQDN部分が使われる様子。</p>
<p>DNSの設定でTXTレコードを設定する。</p>
<p>Yahooでパスしたメールには</p>
<pre>Received-SPF: pass (mail.domain.com: domain of info@domain.com designates 27.....</pre>
<p>のようなヘッダが追記されていた（当然受信側のメールサーバがSPFに対応していることが前提）</p>
<p>チェックするにはこのようなツールも。</p>
<p>Sendmail &#8211; SPFレコードチェック<br />
<a href="http://www.sendmail.co.jp/sa/spfcheck.html">http://www.sendmail.co.jp/sa/spfcheck.html</a></p>
<p>参考：</p>
<li><a href="http://d.hatena.ne.jp/rx7/20100319/p1">Amazon EC2のサーバからメール送信をするまでにやるべきこと (スパムメール扱いを回避する！) &#8211; RX-7乗りの適当な日々</a></li>
<li><a href="http://ms2.seesaa.net/article/210240459.html">サービスから送るメールがスパム扱いされないために。</a></li>
<li><a href="http://www.drk7.jp/MT/archives/001327.html">メール送信者認証技術 SPF/Sender ID についてお勉強 :: drk7jp</a></li>
<li><a href="http://www.atmarkit.co.jp/fsecurity/special/82senderid/sender102.html">Sender ID：送信者側の設定作業 － ＠IT</a></li>
<li><a href="http://salt.iajapan.org/wpmu/anti_spam/admin/operation/information/spf_i01/">間違いから学ぶSPFレコードの正しい書き方 : 迷惑メール対策委員会</a></li>
]]></content:encoded>
			<wfw:commentRss>http://perl.no-tubo.net/2011/06/30/smtp%e3%82%b5%e3%83%bc%e3%83%90%e3%81%8c%e8%bf%b7%e6%83%91%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e3%81%a8%e6%80%9d%e3%82%8f%e3%82%8c%e3%81%aa%e3%81%84%e3%82%88%e3%81%86%e3%81%ab/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://perl.no-tubo.net/2011/06/30/smtp%e3%82%b5%e3%83%bc%e3%83%90%e3%81%8c%e8%bf%b7%e6%83%91%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e3%81%a8%e6%80%9d%e3%82%8f%e3%82%8c%e3%81%aa%e3%81%84%e3%82%88%e3%81%86%e3%81%ab/" />
	</item>
		<item>
		<title>メールサーバ構築のまとめ（複数のバーチャルドメイン+Postfix+MySQL+Dovecot+procmail+Clam AntiVirus+spamassassin+postfixadmin）</title>
		<link>http://perl.no-tubo.net/2011/01/06/%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%ef%bc%88%e8%a4%87%e6%95%b0%e3%81%ae%e3%83%90%e3%83%bc%e3%83%81%e3%83%a3%e3%83%ab%e3%83%89/</link>
		<comments>http://perl.no-tubo.net/2011/01/06/%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%ef%bc%88%e8%a4%87%e6%95%b0%e3%81%ae%e3%83%90%e3%83%bc%e3%83%81%e3%83%a3%e3%83%ab%e3%83%89/#comments</comments>
		<pubDate>Thu, 06 Jan 2011 02:22:18 +0000</pubDate>
		<dc:creator>clicktx</dc:creator>
				<category><![CDATA[postfix]]></category>
		<category><![CDATA[インストールメモ]]></category>
		<category><![CDATA[postfixadmin]]></category>
		<category><![CDATA[procmail]]></category>
		<category><![CDATA[メールサーバ]]></category>

		<guid isPermaLink="false">http://perl.no-tubo.net/?p=1132</guid>
		<description><![CDATA[設定項目などはほぼコピペ。自分用のメモ。
記事中の各リンク先の通り設定したのではなかなか実現できないので多少アレンジしています。
ローカルのUNIXユーザーはMairdir/方式でメールを使いたい。
バーチャルドメイン複 [...]]]></description>
			<content:encoded><![CDATA[<p>設定項目などはほぼコピペ。自分用のメモ。<br />
記事中の各リンク先の通り設定したのではなかなか実現できないので多少アレンジしています。</p>
<p>ローカルのUNIXユーザーはMairdir/方式でメールを使いたい。<br />
バーチャルドメイン複数の運用、かつ、Web GUIでメールアカウントを管理したい。<br />
スパムメールとウィルスもチェックしたい。</p>
<p>このような要望のもと、メールサーバを立て直した際に以前書いた記事をまとめてみた。<br />
さすがに長文になったので続きを読むにした。</p>
<ul>
<li>CentOS5.5 i386とする</li>
<li> ローカルのUNIXユーザはMaildir方式でメールを利用する。<br />
メールボックスは ~/home/user/Mairdir</li>
<li>複数のドメインをバーチャルドメインで扱う。<br />
メールボックスは /mail/domain.tld/user@domain.tld</li>
<li>PostfixをMTAとしてバーチャルドメインでのメールアカウントはMySQLで管理する。</li>
<li>Clam AntiVirusでウィルスチェックを行う。</li>
<li>SpamAssassinでスパムチェックを行う。このため配送（transport）はprocmailで行う。</li>
</ul>
<p><span id="more-1132"></span></p>
<h2>MySQL対応版Postfixのインストール</h2>
<p>MySQLとPostgreSQLはインストール済みとする。<br />
MySQL対応版のPostfixをRPMでインストールする。</p>
<p><a href="http://perl.no-tubo.net/2009/10/02/centos5-3-postfixをmysql対応にする/">CentOS5.3 PostfixをMySQL対応にする</a>でSRPMを使ってRPMをビルドしてインストールしたが、RPMも提供されている模様。なので、これを使ってインストールしてみる。</p>
<p>MySQLとPostgreSQLに依存しているので両方インストールの必要がある（と思う）</p>
<ul>
<li>32bit(i386)用<br />
http://ftp.riken.jp/Linux/centos/5/centosplus/i386/RPMS/postfix-2.3.3-2.1.centos.mysql_pgsql.i386.rpm</li>
<li>64bit(x86_64)用<br />
http://ftp.riken.jp/Linux/centos/5/centosplus/x86_64/RPMS/postfix-pflogsumm-2.3.3-2.1.centos.mysql_pgsql.x86_64.rpm</li>
</ul>
<h4>yumでインストールされていたらアンインストール</h4>
<pre># yum erase postfix</pre>
<h4>RPMをダウンロードしてインストール</h4>
<pre># wget http://ftp.riken.jp/Linux/centos/5/centosplus/i386/RPMS/postfix-2.3.3-2.1.centos.mysql_pgsql.i386.rpm
# rpm -ivh postfix-2.3.3-2.1.centos.mysql_pgsql.i386.rpm
# rm -f postfix-2.3.3-2.1.centos.mysql_pgsql.i386.rpm        <span style="color: #ffcc00;">←ファイルを削除</span></pre>
<h4>yumの自動アップデートから外す</h4>
<p>yum update で postfix* なパッケージがアップデートされなくなる。これをしないとyumの自動アップデート時にMySQL非対応版に置き換わってしまう。</p>
<pre>vi /etc/yum.conf
exclude=postfix*　<span style="color: #ffcc00;">←最終業に追記</span></pre>
<h4>追記</h4>
<p><a href="http://satospo.sakura.ne.jp/blog_archives/tech/centos/postfix_rpm.html">RPM版Postfixの対応状況 &#8211; satospo</a>によると</p>
<blockquote><p>MySQLとPostgreSQLをCentOS5のRPM以外からインストールしている場合（例えば、ソースからビルドしているなど）は、この手法は使えない。SPECファイルにMySQL対応などを記述してリビルドするべし。</p></blockquote>
<p>とあるので、MySQLをソースからインストールしている場合などは<a href="http://perl.no-tubo.net/2009/10/02/centos5-3-postfixをmysql対応にする/">CentOS5.3 PostfixをMySQL対応にする</a>の方法でないとインストール出来ないかも。</p>
<h2>postfixadmin</h2>
<p>バーチャルドメインでのメールアカウントの管理はブラウザGUIから管理できるPostfixAdminを利用する。</p>
<p>内容はほぼ<a href="http://centos.bungu-do.jp/2008/11/postfix_2_mysqlpostfixadmin.html">Postfixによるメールサーバ構築 その2 (MySQLの設定とpostfixadminのインストール) | CentOSサーバ構築術 文具堂</a> さんのコピペです。</p>
<h3>postfixadminのインストール</h3>
<p>最新版をチェック<br />
<a href="http://sourceforge.net/projects/postfixadmin/">http://sourceforge.net/projects/postfixadmin/</a></p>
<pre># wget http://nchc.dl.sourceforge.net/sourceforge/postfixadmin/postfixadmin-2.3.2.tar.gz
# tar zxvf postfixadmin-2.3.2.tar.gz
# mv postfixadmin-2.3.2/ /var/www/postfixadmin</pre>
<h3>postfixadminの設定</h3>
<pre># cd /var/www/postfixadmin
# cp config.inc.php config.inc.php.copy
# vi config.inc.php

/*****************************************************************
 *  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 * You have to set $CONF['configured'] = true; before the
 * application will run!
 * Doing this implies you have changed this file as required.
 * i.e. configuring database etc; specifying setup.php password etc.
 */
<span style="color: #ff9900;">//$CONF['configured'] = false;
$CONF['configured'] = true;       ←修正 </span>

// In order to setup Postfixadmin, you MUST specify a hashed password here.
// To create the hash, visit setup.php in a browser and type a password into the
 field,
// on submission it will be echoed out to you as a hashed value.
$CONF['setup_password'] = 'changeme';

// Postfix Admin Path
// Set the location of your Postfix Admin installation here.
// YOU MUST ENTER THE COMPLETE URL e.g. http://domain.tld/postfixadmin
$CONF['postfix_admin_url'] = '';

// shouldn't need changing.
$CONF['postfix_admin_path'] = dirname(__FILE__);

// Language config
// Language files are located in './languages', change as required..
<span style="color: #ff9900;">//$CONF['default_language'] = 'en';
$CONF['default_language'] = 'ja';       ←修正</span>
// Database Config
// mysql = MySQL 3.23 and 4.0, 4.1 or 5
// mysqli = MySQL 4.1+
// pgsql = PostgreSQL
<span style="color: #ff9900;">↓適時修正
$CONF['database_type'] = 'mysql';
$CONF['database_host'] = 'localhost';
$CONF['database_user'] = 'postfix';
$CONF['database_password'] = 'pass';
$CONF['database_name'] = 'postfix';
$CONF['database_prefix'] = '';</span>

// Site Admin
// Define the Site Admins email address below.
// This will be used to send emails from to create mailboxes.
<span style="color: #ff9900;">//$CONF['admin_email'] = 'postmaster@change-this-to-your.domain.tld';
$CONF['admin_email'] = 'postmaster@hoge.jp';       ←修正</span>

// Encrypt
// In what way do you want the passwords to be crypted?
// md5crypt = internal postfix admin md5
// md5 = md5 sum of the password
// system = whatever you have set as your PHP system default
// cleartext = clear text passwords (ouch!)
// mysql_encrypt = useful for PAM integration
// authlib = support for courier-authlib style passwords
// dovecot:CRYPT-METHOD = use dovecotpw -s 'CRYPT-METHOD'. Example: dovecot:CRAM-MD5
<span style="color: #ff9900;">//$CONF['encrypt'] = 'md5crypt';
$CONF['encrypt'] = 'cleartext';       ←修正</span>

// Page Size
// Set the number of entries that you would like to see
// in one page.
<span style="color: #ff9900;">//$CONF['page_size'] = '10';
$CONF['page_size'] = '100';       ←修正</span>

// Mailboxes
// If you want to store the mailboxes per domain set this to 'YES'.
// Examples:
//   YES: /usr/local/virtual/domain.tld/username@domain.tld
//   NO:  /usr/local/virtual/username@domain.tld
<span style="color: #ff9900;">$CONF['domain_path'] = 'YES';       ←修正</span>

// Default Domain Values
// Specify your default values below. Quota in MB.
<span style="color: #ff9900;">//$CONF['aliases'] = '10';
//$CONF['mailboxes'] = '10';
//$CONF['maxquota'] = '10';
$CONF['aliases'] = '100';       ←修正
$CONF['mailboxes'] = '100';
$CONF['maxquota'] = '300';</span>

// Quota
// When you want to enforce quota for your mailbox users set this to 'YES'.
<span style="color: #ff9900;">$CONF['quota'] = 'YES';       ←修正</span>

// Backup
// If you don't want backup tab set this to 'NO';
<span style="color: #ff9900;">$CONF['backup'] = 'YES';
$CONF['backup'] = 'NO'       ←修正</span>;

// Send Mail
// If you don't want sendmail tab set this to 'NO';
<span style="color: #ff9900;">//$CONF['sendmail'] = 'YES';
$CONF['sendmail'] = 'NO';       ←修正</span>

// Fetchmail
// If you don't want fetchmail tab set this to 'NO';
<span style="color: #ff9900;">//$CONF['fetchmail'] = 'YES';
$CONF['fetchmail'] = 'NO';       ←修正</span></pre>
<h3>apacheの設定</h3>
<p>必要に応じてIP制限、Basic認証などを行う。</p>
<pre>postfixadmin用コンフィグを新規作成
# vi /etc/httpd/conf.d/postfixadmin.conf

Alias /postfixadmin "/var/www/postfixadmin"

&lt;Directory "/var/www/postfixadmin"&gt;
    Order allow,deny
    Allow from all
&lt;/Directory&gt;</pre>
<h3>postfixadminのセットアップスクリプト実行</h3>
<p>http://hogehoge/postfixadmin/setup.php<br />
へアクセスして下部のフォームにて、セットアップパスワードを設定する。</p>
<blockquote><p>If you want to use the password you entered as setup password, edit config.inc.php and set<br />
$CONF['setup_password'] = &#8216;<span style="color: #ff0000;">xxxxxd9ae95306513xxxxxxxxx:71d063841 xxxx38xxxxxdxx06bcexxxx</span>&#8216;;</p></blockquote>
<p>のコメントが表示されるので、postfixadminのconfig.inc.phpに作成されたsetup_passwordを適用する</p>
<pre>// In order to setup Postfixadmin, you MUST specify a hashed password here.
// To create the hash, visit setup.php in a browser and type a password into the field,
// on submission it will be echoed out to you as a hashed value.
<span style="color: #ff9900;">//$CONF['setup_password'] = 'changeme';
$CONF['setup_password'] = 'xxxxxd9ae95306513xxxxxxxxx:71d063841xxxx38xxxxxdxx06bcexxxx';    ←ここを修正</span></pre>
<h3>postfixadmin管理ユーザーの追加</h3>
<p>先ほど設定したセットアップパスワードを使って管理ユーザーを設定する。<br />
ログインを確認できたらセットアップスクリプトを削除する</p>
<pre># rm -f /var/www/postfixadmin/setup.php
# rm -f /var/www/postfixadmin/motd*</pre>
<h2>MySQLを使うためのPostfixの設定</h2>
<h3>メール保存用ルートディレクトリ</h3>
<p>/mail をメール専用アカウントの保存用ルートディレクトリとする。<br />
各ユーザーのメールボックスは /mail/domain.jp/user@domain.jp となる。</p>
<pre><span style="color: #ff9900;">バーチャルドメインで処理するユーザーの作成</span>
# groupadd -g 10000 vuser
# useradd -g vuser -u 10000 vuser

<span style="color: #ff9900;">メール保存用ルートディレクトリの作成</span>
# mkdir /mail
# chown vuser:vuser /mail
# chmod 771 /mail</pre>
<h3>postfix用の設定ファイル作成</h3>
<p>MySQLのユーザーとパスワードを適時変更すること<br />
（サンプルは ユーザー=postfix パスワード=pass）<br />
/etc/postfix/mysql_virtual_alias_maps.cf<br />
/etc/postfix/mysql_virtual_domains_maps.cf<br />
/etc/postfix/mysql_virtual_mailbox_maps.cf<br />
/etc/postfix/mysql_virtual_mailbox_limit_maps.cf</p>
<pre># vi /etc/postfix/mysql_virtual_alias_maps.cf
user = postfix
password = pass
hosts = localhost
dbname = postfix
table = alias
select_field = goto
where_field = address

# vi /etc/postfix/mysql_virtual_domains_maps.cf
user = postfix
password = pass
hosts = localhost
dbname = postfix
table = domain
select_field = domain
where_field = domain
additional_conditions = and active = '1'

# vi /etc/postfix/mysql_virtual_mailbox_maps.cf
user = postfix
password = pass
hosts = localhost
dbname = postfix
table = mailbox
select_field = maildir
where_field = username

# vi /etc/postfix/mysql_virtual_mailbox_limit_maps.cf
user = postfix
password = pass
hosts = localhost
dbname = postfix
table = mailbox
select_field = quota
where_field = username
#additional_conditions = and active = '1'</pre>
<h3>Postfix設定ファイルの編集</h3>
<p>元のファイルをコピーしてから編集する。</p>
<pre># cp /etc/postfix/main.cf /etc/postfix/main.cf.org
# vi /etc/postfix/main.cf

# 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
<span style="color: #ff9900;">myhostname = mail.example.com    ←追加(自FQDN名を指定)</span>

# 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
<span style="color: #ff9900;">mydomain = centossrv.com　←　追加(自ドメイン名を指定)</span>

# 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
#myorigin = $mydomain
<span style="color: #ff9900;">myorigin = $myhostname    ←　追加(ローカルからのメール送信時の送信元メールアドレス@以降にドメイン名を付加)</span>

#inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
#inet_interfaces = localhost
<span style="color: #ff9900;">inet_interfaces = all    ←変更(外部からのメール受信を許可)</span>

#mydestination = $myhostname, localhost.$mydomain, localhost
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain,
#       mail.$mydomain, www.$mydomain, ftp.$mydomain
<span style="color: #ff9900;">mydestination = $myhostname, localhost.$mydomain, localhost     ←修正</span>

# NOTE: Postfix will not automatically forward mail for domains that
# list this system as their primary or backup MX host. See the
# permit_mx_backup restriction description in postconf(5).
#
#relay_domains = $mydestination
<span style="color: #ff9900;">relay_domains = $mydestination     ←コメント削除
</span>

# DELIVERY TO MAILBOX
#
# The home_mailbox parameter specifies the optional pathname of a
# mailbox file relative to a user's home directory. The default
# mailbox file is /var/spool/mail/user or /var/mail/user.  Specify
# "Maildir/" for qmail-style delivery (the / is required).
#
#home_mailbox = Mailbox
#home_mailbox = Maildir/
<span style="color: #ff9900;">home_mailbox = Maildir/　←　追加(メールボックス形式をMaildir形式にする)</span>

# SHOW SOFTWARE VERSION OR NOT
#
# The smtpd_banner parameter specifies the text that follows the 220
# code in the SMTP server's greeting banner. Some people like to see
# the mail version advertised. By default, Postfix shows no version.
#
# You MUST specify $myhostname at the start of the text. That is an
# RFC requirement. Postfix itself does not care.
#
#smtpd_banner = $myhostname ESMTP $mail_name
#smtpd_banner = $myhostname ESMTP $mail_name ($mail_version)
<span style="color: #ff9900;">smtpd_banner = $myhostname ESMTP unknown　←　追加(メールサーバーソフト名の隠蔽化)</span>

<span style="color: #ff9900;">以下を最終行に追記
local_transport = local
virtual_transport = virtual
virtual_mailbox_base = /mail
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_alias_domains = $virtual_alias_maps
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 10000
virtual_uid_maps = static:10000
virtual_gid_maps = static:10000

maximal_backoff_time = 800s
minimal_backoff_time = 100s
bounce_queue_lifetime = 60m
maximal_queue_lifetime = 60m

#mailbox_size_limit = 1024000000
message_size_limit = 20480000

#virtual_mailbox_limit = 51200000
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_overquota_bounce = yes
virtual_mailbox_limit_inbox = yes

smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_local_domain = $myhostname
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
</span></pre>
<p>ローカルユーザーのメールが配信されない（root宛のメールなど）対策として、</p>
<pre>mydestination = $myhostname, localhost.$mydomain, localhost     <span style="color: #ff9900;">※ローカル配送の最終到達ドメイン。</span>

relay_domains = $mydestination

local_transport = local</pre>
<p>としている。<br />
他の対処法としては/etc/aliases に転送先を設定する方法などもある。</p>
<p>また、LAN(192.168.0.0/16)内の他サーバからのリレーのみ許可するので以下の設定も追加する。</p>
<pre># Specify "mynetworks_style = host" when Postfix should "trust"
# only the local machine.
#
#mynetworks_style = class
<span style="color: #ffcc00;">mynetworks_style = subnet</span>
#mynetworks_style = host

# 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
<span style="color: #ffcc00;">mynetworks = 192.168.0.0/16, 127.0.0.0/8</span></pre>
<h3>新規ローカルユーザー対策</h3>
<p>新規ユーザーが追加されたらホームディレクトリに Mairdir/ を自動で作成されるようにする。</p>
<pre># mkdir -p /etc/skel/Maildir/{new,cur,tmp}
# chmod -R 700 /etc/skel/Maildir/</pre>
<p>既に運用中で既存ユーザーの対策をする場合は<a href="http://centossrv.com/postfix.shtml">メールサーバー構築(Postfix+Dovecot) &#8211; CentOSで自宅サーバー構築</a>の「（３）Maildir形式メールボックス作成  メールデータ移行」を参考に対処する。</p>
<h3>サブミッションポート587番ポートを開く</h3>
<p>master.cfのsubmissionの行のコメントを外すだけ。</p>
<pre># vi /etc/postfix/master.cf
# ==========================================================================
# service type  private unpriv  chroot  wakeup  maxproc command + args
#               (yes)   (yes)   (yes)   (never) (100)
# ==========================================================================
smtp      inet  n       -       n       -       -       smtpd
#submission inet n       -       n       -       -       smtpd
<span style="color: #ff9900;">submission inet n       -       n       -       -       smtpd    ←コメント削除</span></pre>
<h2>Dovecotの設定</h2>
<h3>Dovecotのインストール</h3>
<pre># yum install dovecot</pre>
<h3>Dovecotの設定</h3>
<pre># cp /etc/dovecot.conf /etc/dovecot.conf.org
# vi /etc/dovecot.conf

# Protocols we want to be serving: imap imaps pop3 pop3s
# If you only want to use dovecot-auth, you can set this to "none".
#protocols = imap imaps pop3 pop3s
<span style="color: #ff9900;">protocols = imap imaps pop3 pop3s    ←コメント削除
</span>
#   mail_location = maildir:~/Maildir
#   mail_location = mbox:~/mail:INBOX=/var/mail/%u
#   mail_location = mbox:/var/mail/%d/%1n/%n:INDEX=/var/indexes/%d/%1n/%n
#
#
#
#mail_location =
<span style="color: #ff9900;">mail_location = maildir:/mail/%d/%u   ←追記
</span>
# Valid UID range for users, defaults to 500 and above. This is mostly
# to make sure that users can't log in as daemons or other system users.
# Note that denying root logins is hardcoded to dovecot binary and can't
# be done even if first_valid_uid is set to 0.
#first_valid_uid = 500
<span style="color: #ff9900;">first_valid_uid = 10000   ←追記
</span>
# Valid GID range for users, defaults to non-root/wheel. Users having
# non-valid GID as primary group ID aren't allowed to log in. If user
# belongs to supplementary groups with non-valid GIDs, those groups are
# not set.
#first_valid_gid = 1
<span style="color: #ff9900;">first_valid_gid = 10000   ←追記
</span>
<span style="color: #ff9900;">#passdb pam {    ←コメントアウト
</span>    # [blocking=yes] [session=yes] [setcred=yes]
    # [cache_key=] []
    #
    〜略〜
    # Some examples:
    #   args = session=yes *
    #   args = cache_key=%u dovecot
    #args = dovecot
<span style="color: #ff9900;">  #}    ←コメントアウト
</span>
  # SQL database
<span style="color: #ff9900;">  passdb sql {    ←コメント削除
</span>    # Path for SQL configuration file, see doc/dovecot-sql-example.conf
    #args =
<span style="color: #ff9900;">    args = /etc/dovecot-mysql.conf    ←追記
</span><span style="color: #ff9900;">  }    ←コメント削除
</span>
  # System users (NSS, /etc/passwd, or similiar). In many systems nowadays this
  # uses Name Service Switch, which is configured in /etc/nsswitch.conf.
  #
<span style="color: #ff9900;">  #userdb passwd {    ←コメントアウト
</span>    # [blocking=yes] - By default the lookups are done in the main dovecot-auth
    # process. This setting causes the lookups to be done in auth worker
    # proceses. Useful with remote NSS lookups that may block.
    # NOTE: Be sure to use this setting with nss_ldap or users might get
    # logged in as each others!
    #args =
<span style="color: #ff9900;"> # }    ←コメントアウト
</span>
  # SQL database
<span style="color: #ff9900;">  userdb sql {    ←コメント削除
</span>    # Path for SQL configuration file, see doc/dovecot-sql-example.conf
    #args =
<span style="color: #ff9900;">   args = /etc/dovecot-mysql.conf    ←追記
  }    ←コメント削除</span>

auth default {
  # Space separated list of wanted authentication mechanisms:
  #   plain login digest-md5 cram-md5 ntlm rpa apop anonymous gssapi
  # NOTE: See also disable_plaintext_auth setting.
  #mechanisms = plain
<span style="color: #ff9900;">  mechanisms = plain login digest-md5 cram-md5    ←追記
</span>
##
## POP3 specific settings
##

protocol pop3 {
  # Login executable location.
  #login_executable = /usr/libexec/dovecot/pop3-login
  〜略〜
<span style="color: #ff9900;">  #pop3_uidl_format = %08Xu%08Xv
  pop3_uidl_format = %08Xu%08Xv    ←コメント削除</span>
}

  # It's possible to export the authentication interface to other programs:
<span style="color: #ff9900;">  socket listen {    ←コメント削除
</span>    #master {
      # Master socket provides access to userdb information. It's typically
      # used to give Dovecot's local delivery agent access to userdb so it
      # can find mailbox locations.
      #path = /var/run/dovecot/auth-master
      #mode = 0600
      # Default user/group is the one who started dovecot-auth (root)
      #user =
      #group =
    #}
<span style="color: #ff9900;">    client {    ←コメント削除
</span>      # The client socket is generally safe to export to everyone. Typical use
      # is to export it to your SMTP server so it can do SMTP AUTH lookups
      # using it.
      #path = /var/run/dovecot/auth-client
      #mode = 0660
<span style="color: #ff9900;">      path = /var/spool/postfix/private/auth    ←追記
      mode = 0660
      user = postfix
      group = postfix</span>
<span style="color: #ff9900;">    }    ←コメント削除
</span><span style="color: #ff9900;">  }    ←コメント削除
</span>
<span style="color: #ff0000;">x86_64環境の場合は以下をコメント削除する。i386の場合は大丈夫。
</span># Set max. process size in megabytes. If you don't use
# login_process_per_connection you might need to grow this.
<span style="color: #ff9900;">login_process_size = 64    ←コメント削除</span></pre>
<h3>/etc/dovecot-mysql.conf を新規作成</h3>
<p>userやpasswordは適時変更すること</p>
<pre># vi /etc/dovecot-mysql.conf

driver = mysql
default_pass_scheme = PLAIN
connect = dbname=postfix user=<span style="color: #ffcc99;">postfix</span> host=/var/lib/mysql/mysql.sock password=<span style="color: #ffcc99;">pass</span>
password_query = SELECT password FROM mailbox WHERE username = '%u' AND active = '1'
user_query = SELECT concat('/mail/', maildir) as home, 10000 as uid, 10000 as gid FROM mailbox WHERE username = '%u' AND active = '1'</pre>
<p>認証用ライブラリをインストール</p>
<pre># yum install cyrus-sasl-plain cyrus-sasl-md5</pre>
<p>saslauthdは利用しないので念のため停止しておく。</p>
<pre># /etc/rc.d/init.d/saslauthd stop
# chkconfig saslauthd off</pre>
<h3>PostfixとDovecotを起動する</h3>
<p>/var/log/maillogにエラーなどがでていないか確認。<br />
なお、sendmail等他のMTAで運営していた場合は切り替えが必要。</p>
<pre><span style="color: #ff9900;">#sendmailから切り替える場合</span>
# /etc/rc.d/init.d/sendmail stop  <span style="color: #ff9900;">←sendmail停止</span>
sm-client を停止中:                                        [  OK  ]
sendmail を停止中:                                         [  OK  ]

# chkconfig sendmail off  <span style="color: #ff9900;">←sendmail自動起動off</span>
# chkconfig --list sendmail  <span style="color: #ff9900;">←自動起動off確認</span>
sendmail       	0:off	1:off	2:off	3:off	4:off	5:off	6:off

# alternatives --config mta  <span style="color: #ff9900;">←MTA切り替え</span>
2 プログラムがあり 'mta'を提供します。

  選択       コマンド
-----------------------------------------------
*+ 1           /usr/sbin/sendmail.sendmail
   2           /usr/sbin/sendmail.postfix

Enterを押して現在の選択[+]を保持するか、選択番号を入力します:<span style="color: #ff9900;">2 ←2を選択</span>
</pre>
<pre># /etc/init.d/dovecot start    <span style="color: #ff9900;">←dovecot起動</span>
chkconfig dovecot on    <span style="color: #ff9900;">←自動起動設定</span>
# /etc/init.d/postfix start    <span style="color: #ff9900;">←postfix起動</span>
chkconfig postfix on    <span style="color: #ff9900;">←自動起動設定</span></pre>
<h3>ルーターの設定</h3>
<p>ファイアウォールなどのフィルタがある場合、25番,110番(popの場合),143番(IMAPの場合),587番ポートを通すように設定する。<br />
25番は要らない？？</p>
<h3>クライアントのメーラーの設定</h3>
<p>クライアントのメーラーの設定でSMTP認証を使う必要がある。（postfixadminで作成したuser@domain.tldと設定したパスワード）<br />
また、smtpサーバ（メール送信サーバ）のポートを587に指定する必要がある。</p>
<p>ここまでで、とりあえずのメールサーバ運用はできる。</p>
<hr />
<h2>ウィルスとスパムメール対策</h2>
<p>つづいてウィルスチェックとスパムチェックを導入する。<br />
スパムチェックとしてSpamAssassinを導入するが、メール配送（local_transport や virtual_transport）をprocmailで行わないとスパムチェックが有効にならない。<br />
このため、procmailを導入する。<br />
バーチャルドメインでのメールアカウントが主に使用するものなので、virtual_transport のみprocmailにまかせ、あまり使わない local_transport はlocalで行う（SpamAssassinは無効）。</p>
<h3>ウィルス対策</h3>
<p><a href="http://centossrv.com/clamav.shtml">アンチウィルスソフト導入(Clam AntiVirus) – CentOSで自宅サーバー構築</a>を参考にClam AntiVirusをインストールする。</p>
<p>ウィルススキャンテストまで行い、ウィルススキャン定期自動実行設定は行わない（ウィルススキャン実行スクリプトも作成しない）<br />
下記スパムメール対策のリンク先にあるが、Clam AntiVirusとPostfixが連携するように設定が必要。</p>
<h3>ウィルス対策2・スパムメール対策</h3>
<p><a href="http://centossrv.com/postfix-clamav-spamassassin.shtml">メールサーバーでウィルス&amp;スパムチェック(Postfix+Clam AntiVirus+SpamAssassin) – CentOSで自宅サーバー構築</a>を参考にClam AntiVirusとPostfixの連携、及び、SpamAssassinの設定を行う。</p>
<h3>procmailの設定</h3>
<p>/etc/procmailrcを新規作成する。<br />
バーチャルドメインでのメールアカウント保存ディレクトリは<br />
/mail/domain.tld/user@domain.tld</p>
<pre># vi /etc/procmailrc

SHELL=/bin/bash
PATH=/usr/bin:/bin
DEFAULT=/mail/$DOMAIN/$USER\@$DOMAIN/
LOCKFILE=/mail/procmail.lock
LOGFILE=/mail/procmail.log   # ログ出力先
#VERBOSE=ON   # 詳細ログ出力

# SpamAssassinによるスパムチェック
:0fw
|/usr/bin/spamc</pre>
<p>ログの肥大化を防ぐため、ログローテーション設定ファイル新規作成する。</p>
<pre># vi /etc/logrotate.d/procmail

/mail/procmail.log {
    missingok
    nocreate
    notifempty
}</pre>
<h3>Postfixとprocmailを連携させる</h3>
<h5>main.cfの設定</h5>
<p>該当箇所のみ更新</p>
<pre># vi /etc/postfix/main.cf

<span style="color: #ff9900;"># virtual_transport = virtual  ←コメントアウト
virtual_transport = procmail  ←追記

content_filter=smtp-amavis:[127.0.0.1]:10024 ←最終行に追記
</span></pre>
<h5>master.cfの設定</h5>
<pre># vi /etc/postfix/master.cf

最終行に追記
<span style="color: #ff9900;">procmail unix - n n - - pipe
  flags=R user=vuser argv=/usr/bin/procmail -t -m USER=${user} DOMAIN=${nexthop} /etc/procmailrc</span></pre>
<p>Postfixを再起動して設定を有効化</p>
<pre>/etc/rc.d/init.d/postfix restart</pre>
<h3>テストする</h3>
<p>メールを配信してみてヘッダ情報を見る。<br />
spamasassinが有効なら</p>
<blockquote><p>X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on xxx.xxxx.jp<br />
X-Spam-Level:<br />
X-Spam-Status: No, score=-0.1 required=13.0 tests=AWL,CONTENT_TYPE_PRESENT, ISO2022JP_BODY,ISO2022JP_CHARSET,X_MAILER_PRESENT autolearn=ham version=3.2.5</p></blockquote>
<p>Clam AntiVirusが有効なら</p>
<blockquote><p>X-Virus-Scanned: amavisd-new at xxxx.jp</p></blockquote>
<p>がヘッダ情報に挿入されているはず。</p>
<h3>自動メールボックス作成</h3>
<p>PostfixAdminを使ってバーチャルドメインでメールサーバを運営する場合、procmailを使うと自動でメールボックスが作成されなくなってしまう。</p>
<p>以前書いた<a href="http://perl.no-tubo.net/2009/10/15/postfixadmin-procmailな環境でメールディレクトリの作成・削除/">postfixadmin +procmailな環境でメールディレクトリの作成・削除</a>でメールディレクトリの作成、及び、削除を自動化するスクリプトを作成する。</p>
]]></content:encoded>
			<wfw:commentRss>http://perl.no-tubo.net/2011/01/06/%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%ef%bc%88%e8%a4%87%e6%95%b0%e3%81%ae%e3%83%90%e3%83%bc%e3%83%81%e3%83%a3%e3%83%ab%e3%83%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://perl.no-tubo.net/2011/01/06/%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%e3%81%ae%e3%81%be%e3%81%a8%e3%82%81%ef%bc%88%e8%a4%87%e6%95%b0%e3%81%ae%e3%83%90%e3%83%bc%e3%83%81%e3%83%a3%e3%83%ab%e3%83%89/" />
	</item>
		<item>
		<title>postfixadmin +procmailな環境でメールディレクトリの自動作成・削除</title>
		<link>http://perl.no-tubo.net/2009/10/15/postfixadmin-procmail%e3%81%aa%e7%92%b0%e5%a2%83%e3%81%a7%e3%83%a1%e3%83%bc%e3%83%ab%e3%83%87%e3%82%a3%e3%83%ac%e3%82%af%e3%83%88%e3%83%aa%e3%81%ae%e4%bd%9c%e6%88%90%e3%83%bb%e5%89%8a%e9%99%a4/</link>
		<comments>http://perl.no-tubo.net/2009/10/15/postfixadmin-procmail%e3%81%aa%e7%92%b0%e5%a2%83%e3%81%a7%e3%83%a1%e3%83%bc%e3%83%ab%e3%83%87%e3%82%a3%e3%83%ac%e3%82%af%e3%83%88%e3%83%aa%e3%81%ae%e4%bd%9c%e6%88%90%e3%83%bb%e5%89%8a%e9%99%a4/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 02:03:16 +0000</pubDate>
		<dc:creator>clicktx</dc:creator>
				<category><![CDATA[CentOS5.x]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[postfixadmin]]></category>
		<category><![CDATA[メールサーバ]]></category>
		<category><![CDATA[procmail]]></category>

		<guid isPermaLink="false">http://perl.no-tubo.net/?p=223</guid>
		<description><![CDATA[構築環境

CentOS5.3
Postfix +MySQL
Dovecot
postfixadmin
procmail (spamassassin、Clam AntiVirus でスパムメールとウィルス対策)

pos [...]]]></description>
			<content:encoded><![CDATA[<h3>構築環境</h3>
<ul>
<li>CentOS5.3</li>
<li>Postfix +MySQL</li>
<li>Dovecot</li>
<li>postfixadmin</li>
<li>procmail (spamassassin、Clam AntiVirus でスパムメールとウィルス対策)</li>
</ul>
<p>postfixadminを使ってバーチャルドメインでメールサーバを構築するまではうまくいったのだけど、procmailを使うと自動でメールボックスが作成されない。</p>
<p>もともとメールアカウント削除してもメールボックスが自動で削除されないので付属のシェルスクリプト改で行ってみるテスト。</p>
<p>postfixadminは /var/www/postfixadmin に設置してあるとし、</p>
<p>メールは /mail 以下に保存される設定で。<br />
各ユーザーのメールボックスは /mail/hoge.com/user@hoge.com な感じ。</p>
<p>メールディレクトリ作成・削除スクリプトは/usr/local/bin/postfixadmin へ保存する。</p>
<blockquote><p>メールボックス作成用スクリプト<br />
/usr/local/bin/postfixadmin/postfixadmin-mailbox-postcreation.sh</p>
<p>メールボックス削除用スクリプト<br />
/usr/local/bin/postfixadmin/postfixadmin-mailbox-postdeletion.sh</p>
<p>ドメイン削除用スクリプト？<br />
/usr/local/bin/postfixadmin/postfixadmin-domain-postdeletion.sh</p></blockquote>
<h3>１）メールボックス作成・削除スクリプト準備</h3>
<p>保存用ディレクトリを作成し、postfixadmin/ADDITIONS 内にある、</p>
<p>postfixadmin-domain-postdeletion.sh<br />
postfixadmin-mailbox-postcreation.sh<br />
postfixadmin-mailbox-postdeletion.sh</p>
<p>を/usr/local/bin/postfixadmin 以下にコピーする。</p>
<pre># mkdir /usr/local/bin/postfixadmin
# cp /var/www/postfixadmin/ADDITIONS/postfixadmin-domain-postdeletion.sh /usr/local/bin/postfixadmin
# cp /var/www/postfixadmin/ADDITIONS/postfixadmin-mailbox-postcreation.sh /usr/local/bin/postfixadmin
# cp /var/www/postfixadmin/ADDITIONS/postfixadmin-mailbox-postdeletion.sh /usr/local/bin/postfixadmin</pre>
<h3>２）削除メールボックスの保存先</h3>
<p>削除したメールボックスは/mail/.deleted-maildirs 以下に保存されるようにする。</p>
<p>削除したメールボックスを保存するディレクトリ作成</p>
<pre># mkdir /mail/.deleted-maildirs
<del datetime="2011-01-14T04:29:42+00:00"># chmod 771 /mail/.deleted-maildirs</del>
# chmod 0700 /mail/.deleted-maildirs
# chown vuser:vuser /mail/.deleted-maildirs</pre>
<h3>３）スクリプトの編集</h3>
<h5>ユーザーメールボックス作成用スクリプトの編集</h5>
<pre># vi /usr/local/bin/postfixadmin/postfixadmin-mailbox-postcreation.sh

#!/bin/sh

# Example script for adding a Maildir to a Courier-IMAP virtual mail
# hierarchy.

# The script only looks at argument 3, assuming that it
# indicates the relative name of a maildir, such as
# "somedomain.com/peter/".

# This script should be run as the user which owns the maildirs. If
# the script is actually run by the apache user (e.g. through PHP),
# then you could use "sudo" to grant apache the rights to run
# this script as the relevant user.
# Assume this script has been saved as
# /usr/local/bin/postfixadmin-mailbox-postcreation.sh and has been
# made executable. Now, an example /etc/sudoers line:
# apache ALL=(courier) NOPASSWD: /usr/local/bin/postfixadmin-mailbox-postcreation.sh
# The line states that the apache user may run the script as the
# user "courier" without providing a password.

# Change this to where you keep your virtual mail users' maildirs.
<span style="color: #ff9900;">#basedir=/var/spool/maildirs ←コメントアウト
<span style="color: #33cccc;">basedir=/mail ←追記
</span></span><span style="color: #ccffff;">
</span><span style="color: #ccffff;">i</span>f [ ! -e "$basedir" ]; then
    echo "$0: basedir '$basedir' does not exist; bailing out."
    exit 1
fi

if [ `echo $3 | fgrep '..'` ]; then
    echo "$0: An argument contained a double-dot sequence; bailing out."
    exit 1
fi

maildir="${basedir}/$3"
parent=`dirname "$maildir"`
if [ ! -d "$parent" ]; then
    if [ -e "$parent" ]; then
        echo "$0: strange - directory '$parent' exists, but is not a directory; bailing out."
        exit 1
    else
        mkdir -p "${parent}"
        if [ $? -ne 0 ]; then
            echo "$0: mkdir -p '$parent' returned non-zero; bailing out."
            exit 1
        fi
    fi
fi

if [ -e "$maildir" ]; then
    echo "$0: Directory '$maildir' already exists! bailing out"
    exit 1
fi
<span style="color: #ff9900;">
#maildirmake "$maildir" ←コメントアウト
#if [ ! -d "$maildir" ]; then
#    echo "$0: maildirmake didn't produce a directory; bailing out."
#    exit 1
#fi</span>

<span style="color: #33cccc;">
# 以下を追記
mkdir "$maildir"
if [ ! -d "$maildir" ]; then
    echo "$0: mkdir didn't produce a directory; bailing out."
    exit 1
fi

mkdir "${maildir}cur"
if [ ! -d "${maildir}cur" ]; then
    echo "$0: mkdir didn't produce a directory; bailing out."
    exit 1
fi

mkdir "${maildir}new"
if [ ! -d "${maildir}new" ]; then
    echo "$0: mkdir didn't produce a directory; bailing out."
    exit 1
fi

mkdir "${maildir}tmp"
if [ ! -d "${maildir}tmp" ]; then
    echo "$0: mkdir didn't produce a directory; bailing out."
    exit 1
fi

chown -R vuser:vuser "$maildir"
chmod -R 700 "$maildir"</span>

exit 0</pre>
<h5>ユーザーメールボックス削除スクリプトの編集</h5>
<p>ユーザーメールボックスは、/mail/hoge.com/user@hoge.com の形式としています。</p>
<pre># vi /usr/local/bin/postfixadmin/postfixadmin-mailbox-postdeletion.sh

#!/bin/sh

# Example script for removing a Maildir from a Courier-IMAP virtual mail
# hierarchy.

# The script looks at arguments 1 and 2, assuming that they
# indicate username and domain, respectively.

# The script will not actually delete the maildir. I moves it
# to a special directory which may once in a while be cleaned up
# by the system administrator.

# This script should be run as the user which owns the maildirs. If
# the script is actually run by the apache user (e.g. through PHP),
# then you could use "sudo" to grant apache the rights to run
# this script as the relevant user.
# Assume this script has been saved as
# /usr/local/bin/postfixadmin-mailbox-postdeletion.sh and has been
# made executable. Now, an example /etc/sudoers line:
# apache ALL=(courier) NOPASSWD: /usr/local/bin/postfixadmin-mailbox-postdeletion.sh
# The line states that the apache user may run the script as the
# user "courier" without providing a password.

# Change this to where you keep your virtual mail users' maildirs.
<span style="color: #ff9900;">#basedir=/var/spool/maildirs ←コメントアウト
</span><span style="color: #33cccc;">basedir=/mail ←追記
</span>
# Change this to where you would like deleted maildirs to reside.
<span style="color: #ff9900;">#trashbase=/var/spool/deleted-maildirs ←コメントアウト
</span><span style="color: #33cccc;">trashbase=/mail/.deleted-maildirs ← 追記
</span>
if [ ! -e "$trashbase" ]; then
    echo "trashbase '$trashbase' does not exist; bailing out."
    exit 1
fi

if [ `echo $1 | fgrep '..'` ]; then
    echo "First argument contained a double-dot sequence; bailing out."
    exit 1
fi
if [ `echo $2 | fgrep '..'` ]; then
    echo "First argument contained a double-dot sequence; bailing out."
    exit 1
fi

<span style="color: #ff9900;">#subdir=`echo "$1" | sed 's/@.*//'` ←コメントアウト
</span><span style="color: #33cccc;">subdir=$1 ← 追記
</span>
maildir="${basedir}/$2/${subdir}"
trashdir="${trashbase}/$2/`date +%F_%T`_${subdir}"

parent=`dirname "$trashdir"`
if [ ! -d "$parent" ]; then
    if [ -e "$parent" ]; then
        echo "Strainge - directory '$parent' exists, but is not a directory."
        echo "Bailing out."
        exit 1
    else
        mkdir -p "$parent"
        if [ $? -ne 0 ]; then
            echo "mkdir -p '$parent' returned non-zero; bailing out."
            exit 1
        fi
    fi
fi

if [ ! -e "$maildir" ]; then
    echo "maildir '$maildir' does not exist; nothing to do."
    exit 1
fi
if [ -e "$trashdir" ]; then
    echo "trashdir '$trashdir' already exists; bailing out."
    exit 1
fi

mv $maildir $trashdir

exit $?</pre>
<p>ドメイン削除用スクリプトの編集</p>
<pre># vi /usr/local/bin/postfixadmin/postfixadmin-domain-postdeletion.sh

#!/bin/sh

# Example script for removing a Maildir domain top-level folder
# from a Courier-IMAP virtual mail hierarchy.

# The script only looks at argument 1, assuming that it
# indicates the relative name of a domain, such as
# "somedomain.com". If $basedir/somedomain.com exists, it will
# be removed.

# The script will not actually delete the directory. I moves it
# to a special directory which may once in a while be cleaned up
# by the system administrator.

# This script should be run as the user which owns the maildirs. If
# the script is actually run by the apache user (e.g. through PHP),
# then you could use "sudo" to grant apache the rights to run
# this script as the relevant user.
# Assume this script has been saved as
# /usr/local/bin/postfixadmin-domain-postdeletion.sh and has been
# made executable. Now, an example /etc/sudoers line:
# apache ALL=(courier) NOPASSWD: /usr/local/bin/postfixadmin-domain-postdeletion.sh
# The line states that the apache user may run the script as the
# user "courier" without providing a password.

# Change this to where you keep your virtual mail users' maildirs.
<span style="color: #ff9900;">#basedir=/var/spool/maildirs ←コメントアウト
</span><span style="color: #33cccc;">basedir=/mail ←追記
</span>
# Change this to where you would like deleted maildirs to reside.
<span style="color: #ff9900;">trashbase=/var/spool/deleted-maildirs ←コメントアウト
</span><span style="color: #33cccc;">trashbase=/mail/.deleted-maildirs ←追記
</span>
if [ `echo $1 | fgrep '..'` ]; then
    echo "First argument contained a double-dot sequence; bailing out."
    exit 1
fi

if [ ! -e "$trashbase" ]; then
    echo "trashbase '$trashbase' does not exist; bailing out."
    exit 1
fi

trashdir="${trashbase}/`date +%F_%T`_$1"
domaindir="${basedir}/$1"

if [ ! -e "$domaindir" ]; then
    echo "Directory '$domaindir' does not exits; nothing to do."
    exit 0;
fi
if [ ! -d "$domaindir" ]; then
    echo "'$domaindir' is not a directory; bailing out."
    exit 1
fi
if [ -e "$trashdir" ]; then
    echo "Directory '$trashdir' already exits; bailing out."
    exit 1;
fi

mv $domaindir $trashdir

exit $?</pre>
<p>実行権を与える</p>
<pre># chmod 0700 /usr/local/bin/postfixadmin/postfixadmin*</pre>
<h3>４）postfixadminの設定ファイルを修正</h3>
<pre># vi /var/www/postfixadmin/config.inc.php

// Optional:
// Script to run after creation of mailboxes.
// Note that this may fail if PHP is run in "safe mode", or if
// operating system features (such as SELinux) or limitations
// prevent the web-server from executing external scripts.
// $CONF['mailbox_postcreation_script']='sudo -u courier /usr/local/bin/postfixadmin-mailbox-postcreation.sh';
<span style="color: #33cccc;">$CONF['mailbox_postcreation_script']='sudo /usr/local/bin/postfixadmin/postfixadmin-mailbox-postcreation.sh'; ←追記
</span>
// Optional:
// Script to run after deletion of mailboxes.
// Note that this may fail if PHP is run in "safe mode", or if
// operating system features (such as SELinux) or limitations
// prevent the web-server from executing external scripts.
// $CONF['mailbox_postdeletion_script']='sudo -u courier /usr/local/bin/postfixadmin-mailbox-postdeletion.sh';
<span style="color: #33cccc;">$CONF['mailbox_postdeletion_script']='sudo /usr/local/bin/postfixadmin/postfixadmin-mailbox-postdeletion.sh'; ←追記
</span>
// Optional:
// Script to run after deletion of domains.
// Note that this may fail if PHP is run in "safe mode", or if
// operating system features (such as SELinux) or limitations
// prevent the web-server from executing external scripts.
// $CONF['domain_postdeletion_script']='sudo -u courier /usr/local/bin/postfixadmin-domain-postdeletion.sh';
<span style="color: #33cccc;">$CONF['domain_postdeletion_script']='sudo /usr/local/bin/postfixadmin/postfixadmin-domain-postdeletion.sh';</span></pre>
<h3>５）sudo を使用するので/etc/sudoers を編集する。</h3>
<p>どうやら最近のマシンではエラーが出るらしいので併せて対処。<br />
エラーログは<br />
/etc/httpd/logs/error_log や /var/log/httpd/ssl_error_log 等のapacheのログ</p>
<p>参考：<a href="http://blog.cles.jp/item/2919">sudoが「sudo: sorry, you must have a tty to run sudo」と文句を言うときは<br />
</a></p>
<p>webサーバ(apache)のhttpd.conf設定は<br />
User apache<br />
Group apache<br />
としています。</p>
<pre># visudo

#
# Disable "ssh hostname sudo ", because it will show the password in clear.
#         You have to run "ssh -t hostname sudo ".
#
<span style="color: #ff9900;">#Defaults    requiretty ←コメントアウト
</span>
Defaults    env_reset
Defaults    env_keep = "COLORS DISPLAY HOSTNAME HISTSIZE INPUTRC KDEDIR \
                        LS_COLORS MAIL PS1 PS2 QTDIR USERNAME \
                        LANG LC_ADDRESS LC_CTYPE LC_COLLATE LC_IDENTIFICATION \
                        LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC \
                        LC_PAPER LC_TELEPHONE LC_TIME LC_ALL LANGUAGE LINGUAS \
                        _XKB_CHARSET XAUTHORITY"

## Next comes the main part: which users can run what software on
## which machines (the sudoers file can be shared between multiple
## systems).
## Syntax:
##
##      user    MACHINE=COMMANDS
##
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
<span style="color: #33cccc;"># 以下を追記
apache ALL=(ALL) NOPASSWD: /usr/local/bin/postfixadmin/postfixadmin-mailbox-postcreation.sh
apache ALL=(ALL) NOPASSWD: /usr/local/bin/postfixadmin/postfixadmin-mailbox-postdeletion.sh
apache ALL=(ALL) NOPASSWD: /usr/local/bin/postfixadmin/postfixadmin-domain-postdeletion.sh</span></pre>
<h3>テスト</h3>
<p>postfixadminでメールアカウントの作成・削除を行って、該当のメールボックスの状況を確認する。</p>
<p>ドメイン追加・削除を行う場合は、ドメインの追加後メールユーザーを１つ以上追加する必要がある。（ドメイン追加のみだとディレクトリが作成されない為）</p>
<p><span style="text-decoration: line-through;"><br />
</span></p>
<h3>気になる事</h3>
<p>visudo でコメントアウトした</p>
<p>#Defaults    requiretty ←コメントアウト</p>
<p>が、セキュリティー面でどうなのか、と。</p>
<h5>2011-01-14追記</h5>
<p>apacheユーザーなど 非シェルログインユーザーがsudoを実行できるようにするのに必要らしい。<br />
phpからsudoする時なども同様のようだ。</p>
]]></content:encoded>
			<wfw:commentRss>http://perl.no-tubo.net/2009/10/15/postfixadmin-procmail%e3%81%aa%e7%92%b0%e5%a2%83%e3%81%a7%e3%83%a1%e3%83%bc%e3%83%ab%e3%83%87%e3%82%a3%e3%83%ac%e3%82%af%e3%83%88%e3%83%aa%e3%81%ae%e4%bd%9c%e6%88%90%e3%83%bb%e5%89%8a%e9%99%a4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://perl.no-tubo.net/2009/10/15/postfixadmin-procmail%e3%81%aa%e7%92%b0%e5%a2%83%e3%81%a7%e3%83%a1%e3%83%bc%e3%83%ab%e3%83%87%e3%82%a3%e3%83%ac%e3%82%af%e3%83%88%e3%83%aa%e3%81%ae%e4%bd%9c%e6%88%90%e3%83%bb%e5%89%8a%e9%99%a4/" />
	</item>
		<item>
		<title>メールサーバ構築（Postfix +MySQL +Dovecot +postfixadmin）</title>
		<link>http://perl.no-tubo.net/2009/10/14/%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%ef%bc%88postfix-mysql-dovecot-postfixadmin%ef%bc%89-2/</link>
		<comments>http://perl.no-tubo.net/2009/10/14/%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%ef%bc%88postfix-mysql-dovecot-postfixadmin%ef%bc%89-2/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 09:56:34 +0000</pubDate>
		<dc:creator>clicktx</dc:creator>
				<category><![CDATA[CentOS5.x]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[postfixadmin]]></category>
		<category><![CDATA[Dovecot]]></category>
		<category><![CDATA[メールサーバ]]></category>

		<guid isPermaLink="false">http://pet.no-tubo.net/?p=187</guid>
		<description><![CDATA[より新しい記事 2011-01-12
http://perl.no-tubo.net/2011/01/06/メールサーバ構築のまとめ（複数のバーチャルド/
CentOS5.3
いろいろ構築した結果、メールサーバは Pos [...]]]></description>
			<content:encoded><![CDATA[<p>より新しい記事 2011-01-12<br />
<a href="http://perl.no-tubo.net/2011/01/06/メールサーバ構築のまとめ（複数のバーチャルド/">http://perl.no-tubo.net/2011/01/06/メールサーバ構築のまとめ（複数のバーチャルド/</a></p>
<p>CentOS5.3</p>
<p>いろいろ構築した結果、メールサーバは Postfix +MySQL +Dovecot +postfixadmin で構成する事に決めた。<br />
postfixadminを使う利点は、</p>
<ul>
<li>複数のバーチャルドメインでの運用が可能＆管理が楽</li>
<li>ドメインの追加やメールアドレスの追加がブラウザからGUIで出来る</li>
</ul>
<p>さらに、procmailとspamassassin、Clam AntiVirusを使って、スパムメール対策とウィルス対策も行う。</p>
<p>バーチャルドメイン環境でprocmailとspamassassinを使うにコツがいる（らしい）</p>
<p>ネットでの情報が少ない（ヒットしない）のでメモ。</p>
<h3>メールサーバの構築</h3>
<p>メールサーバの構築は <a href="http://centossrv.com/postfix.shtml" target="_blank">メールサーバー構築(Postfix+Dovecot) &#8211; CentOSで自宅サーバー構築</a> を参考に行った。</p>
<p>おやじさんの<a href="http://www.aconus.com/~oyaji/mail2/smtp-redhat.htm">PostfixによるSMTPサーバの構築(RedHat標準版編)</a>も参考になる。</p>
<h3>ウィルス対策</h3>
<p>ウィルス対策は <a href="http://centossrv.com/clamav.shtml" target="_blank">アンチウィルスソフト導入(Clam AntiVirus) &#8211; CentOSで自宅サーバー構築</a> を参考に行った。</p>
<h3>スパムメール対策</h3>
<p>スパムメール対策は <a href="http://centossrv.com/postfix-clamav-spamassassin.shtml" target="_blank">メールサーバーでウィルス&amp;スパムチェック(Postfix+Clam AntiVirus+SpamAssassin) &#8211; CentOSで自宅サーバー構築</a> を参考に行った。</p>
<h3>postfixのMySQL対応化とpostfixadminの導入</h3>
<p><a href="http://centos.bungu-do.jp/2008/11/postfix_postfixmysqldovecotpos.html">Postfixによるメールサーバ構築 (Postfix+MySQL+Dovecot+postfixadmin)</a> を参考に行った。</p>
<p>MySQL対応は<a href="http://perl.no-tubo.net/2009/10/02/centos5-3-postfix%e3%82%92mysql%e5%af%be%e5%bf%9c%e3%81%ab%e3%81%99%e3%82%8b/"> CentOS5.3 PostfixをMySQL対応にする</a>で行った。</p>
<p>リンク先で作成した（cat となっているが vi 等で新規作成する事）</p>
<blockquote><p>/etc/postfix/mysql_virtual_alias_maps.cf<br />
/etc/postfix/mysql_virtual_domains_maps.cf<br />
/etc/postfix/mysql_virtual_mailbox_maps.cf<br />
/etc/postfix/mysql_virtual_mailbox_limit_maps.cf</p></blockquote>
<p>のファイルにはMySQLのパスワードが含まれているのでパーミッションの変更を行う事。</p>
<pre>chmod 640 /etc/postfix/mysql_*
chown root.postfix /etc/postfix/mysql_*</pre>
<p>メールの保存は/mail 以下となる。</p>
<p>だいたいうまくいくのだが、多少の変更が必要。</p>
<p>spamassassinを有効にするにはprocmailでメールボックスに配送しなければならない。</p>
<p>バーチャルドメインの場合procmailが使えないという記事が多かったので心配だったが、</p>
<p><a href="http://oshiete1.watch.impress.co.jp/qa3819766.html">postfixのバーチャルドメイン管理でのspamフィルタについて</a></p>
<p>を読むとどうやら使えるらしい。</p>
<h3>Postfixの設定</h3>
<h4>main.cfの設定。</h4>
<p><a href="http://centos.bungu-do.jp/2008/11/postfix_3_postfix.html"> http://centos.bungu-do.jp/2008/11/postfix_3_postfix.html</a> のmain.cf 設定を少々変更。</p>
<pre>cp /etc/postfix/main.cf /etc/postfix/main.cf.org
vi /etc/postfix/main.cf
-------------------------------------------------------------------------------
myhostname = <span style="color: #ff9900;">mail.example.com ←自メールサーバFQDN</span>
mydomain = <span style="color: #ff9900;">example.com ←自サーバドメイン</span>
#myorigin = $mydomain
myorigin = $myhostname

#inet_interfaces = localhost
inet_interfaces = all

#mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
mydestination =

#relay_domains = $mydestination
relay_domains = $mydestination

home_mailbox = Maildir/

# IF YOU USE THIS TO DELIVER MAIL SYSTEM-WIDE, YOU MUST SET UP AN
# ALIAS THAT FORWARDS MAIL FOR ROOT TO A REAL USER.
#
#mailbox_command = /some/where/procmail
#mailbox_command = /some/where/procmail -a "$EXTENSION"
<span style="color: #ff9900;"> mailbox_command = /usr/bin/procmail ←追記
</span>
smtpd_banner = $myhostname ESMTP unknown

local_transport = virtual
<span style="color: #ff9900;"># virtual_transport = virtual ←コメントアウト
virtual_transport = procmail ←追記</span>
virtual_mailbox_base = /mail
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_alias_domains = $virtual_alias_maps
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_minimum_uid = 10000
virtual_uid_maps = static:10000
virtual_gid_maps = static:10000

maximal_backoff_time = 800s
minimal_backoff_time = 100s
bounce_queue_lifetime = 60m
maximal_queue_lifetime = 60m

#mailbox_size_limit = 1024000000
message_size_limit = 20480000

#virtual_mailbox_limit = 51200000
virtual_mailbox_limit_maps = mysql:/etc/postfix/mysql_virtual_mailbox_limit_maps.cf
virtual_mailbox_limit_override = yes
virtual_overquota_bounce = yes
virtual_mailbox_limit_inbox = yes

smtpd_sasl_auth_enable = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_local_domain = $myhostname
smtpd_client_restrictions = reject_rbl_client bl.spamcop.net
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
-------------------------------------------------------------------------------</pre>
<h4>master.cfの設定。</h4>
<pre>vi /etc/postfix/master.cf

<span style="color: #ff9900;">最終行に追記
procmail unix - n n - - pipe
  flags=R user=vuser argv=/usr/bin/procmail -t -m USER=${user} DOMAIN=${nexthop} /etc/procmailrc</span></pre>
<h4>procmailのルール、/etc/procmailrcを新規作成する。</h4>
<pre>vi /etc/procmailrc

SHELL=/bin/bash
PATH=/usr/bin:/bin
DEFAULT=/mail/$DOMAIN/$USER\@$DOMAIN/
#LOGFILE=/mail/procmail.log
LOGFILE=${DEFAULT}.procmail.log
#LOCKFILE=/mail/procmail.lock
LOCKFILE=/mail/$USER\@$DOMAIN.procmail.lock
VERBOSE=ON

:0fw
|/usr/bin/spamc</pre>
<p>LOGFILEはテスト段階では/mail/procmail.logにしておくと楽。</p>
<p>VERBOSE=ON は詳細ログを記録する設定なので本格運用する際にはコメントアウトする。</p>
<p>また、LOCKFILEはユーザー数が増えた時の為に各ユーザーごとにロックファイルを使うようにしてみた。</p>
<h4>ログの肥大化を防ぐため、ログローテーション設定ファイル新規作成する。</h4>
<pre>vi /etc/logrotate.d/procmail

/mail/*/*/.procmail.log {
    missingok
    nocreate
    notifempty
}</pre>
<p>注意点として、バーチャルドメインでの運用の場合ローカルユーザーのメールボックスにメールが配信されない。root宛のメールも然り。</p>
<p>root宛のメールが普段使っているメールアドレス宛に配信されるようにしておく。</p>
<pre>vi /etc/aliases

# Person who should get root's mail
#root:          marc
<span style="color: #33cccc;">root:           myname@domain.com ←最終行に追加</span>

newaliases</pre>
<p>myname@domain.comにroot宛のメールが届くようになる。</p>
<h4>テスト</h4>
<p>メールを配信してみてヘッダ情報を見る。</p>
<p>spamasassinが適用されていれば</p>
<blockquote><p>X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on xxx.xxxx.jp<br />
X-Spam-Level:<br />
X-Spam-Status: No, score=-0.1 required=13.0 tests=AWL,CONTENT_TYPE_PRESENT, ISO2022JP_BODY,ISO2022JP_CHARSET,X_MAILER_PRESENT autolearn=ham version=3.2.5</p></blockquote>
<p>Clam AntiVirusが適用されていれば</p>
<blockquote><p>X-Virus-Scanned: amavisd-new at xxxx.jp</p></blockquote>
<p>がヘッダ情報に挿入されているはず。</p>
<p>その他のテスト方法は各リンクに掲載されていた通り。</p>
<h4>ユーザーメールディレクトリが作成されない</h4>
<p>・・・なぜかメールディレクトリが作成されない。</p>
<p>spamチェックのためメール配送をprocmailにするとディレクトリ作成されない事が判明。</p>
<p>メール用ディレクトリは /mail 以下で、ユーザーが vuser 、グループが vuser 、パーミッションは0771。</p>
<p>とりあえずユーザー postfix にセカンダリグループ vuserを追加してみたら既存のドメインには作成される。</p>
<p>新規にドメイン追加＞メールアドレス追加の場合は作成されない。</p>
<h4>この後したい事</h4>
<p>postfixadminでドメイン、メールユーザー等を削除した場合は各ディレクトリが削除されない。</p>
<p>postfixadminのconfig.inc.phpにオプション設定があるが、シェルスクリプトで各動作が行えるようだ。</p>
<p>シェルスクリプト・・・書けねぇ。。。</p>
<p><a href="http://local.lipwood.com/content/view/69/129/">postfixadminでメールボックスを削除する<br />
</a><a href="http://www.yanbe.net/blog/archives/000242.html"> PostfixAdminのイケてないところ</a></p>
<p>この辺に該当の対処が書かれている。</p>
<p>cronを使って削除する方法のようだ。</p>
<p>postfixadmin/ADDITIONS 内にある、</p>
<blockquote><p>postfixadmin-domain-postdeletion.sh<br />
postfixadmin-mailbox-postcreation.sh<br />
postfixadmin-mailbox-postdeletion.sh</p></blockquote>
<p>こいつらを使えば出来るかな？</p>
<p>以下は分かりにくいのでまとめてみた</p>
<h4><a href="http://perl.no-tubo.net/2009/10/15/postfixadmin-procmail%e3%81%aa%e7%92%b0%e5%a2%83%e3%81%a7%e3%83%a1%e3%83%bc%e3%83%ab%e3%83%87%e3%82%a3%e3%83%ac%e3%82%af%e3%83%88%e3%83%aa%e3%81%ae%e4%bd%9c%e6%88%90%e3%83%bb%e5%89%8a%e9%99%a4/"> postfixadmin +procmailな環境でメールディレクトリの作成・削除</a></h4>
<h3>自動メールボックス作成に挑戦</h3>
<p><span id="more-187"></span>/usr/local/bin/postfixadmin あたりにコピーする。</p>
<pre>mkdir /usr/local/bin/postfixadmin <span style="color: #ff9900;">←保存用ディレクトリ作成</span>
cd /var/www/postfixadmin/ADDITIONS
cp postfixadmin-domain-postdeletion.sh /usr/local/bin/postfixadmin
cp postfixadmin-mailbox-postcreation.sh /usr/local/bin/postfixadmin
cp postfixadmin-mailbox-postdeletion.sh /usr/local/bin/postfixadmin</pre>
<pre>cd /usr/local/bin/postfixadmin
vi postfixadmin-domain-postdeletion.sh

# Change this to where you keep your virtual mail users' maildirs.
<span style="color: #ff9900;">#basedir=/var/spool/maildirs ←コメントアウト
</span><span style="color: #ff9900;">basedir=/mail ←追記</span></pre>
<pre>vi postfixadmin-mailbox-postcreation.sh

# Change this to where you keep your virtual mail users' maildirs.
<span style="color: #ff9900;">#basedir=/var/spool/maildirs ←コメントアウト
</span><span style="color: #ff9900;">basedir=/mail ←追記
</span><span style="color: #ff9900;">
</span><span style="color: #ff9900;">コメントアウト
#maildirmake "$maildir"
#if [ ! -d "$maildir" ]; then
#    echo "$0: maildirmake didn't produce a directory; bailing out."
#    exit 1
#fi</span><span style="color: #ff9900;">

</span><span style="color: #ff9900;">追記
mkdir "$maildir"
if [ ! -d "$maildir" ]; then
echo "$0: mkdir didn't produce a directory; bailing out."
exit 1
fi

mkdir "${maildir}cur"
if [ ! -d "${maildir}cur" ]; then
echo "$0: mkdir didn't produce a directory; bailing out."
exit 1
fi

mkdir "${maildir}new"
if [ ! -d "${maildir}new" ]; then
echo "$0: mkdir didn't produce a directory; bailing out."
exit 1
fi

mkdir "${maildir}tmp"
if [ ! -d "${maildir}tmp" ]; then
echo "$0: mkdir didn't produce a directory; bailing out."
exit 1
fi

chown -R vuser:vuser "$maildir"
chmod -R 700 "$maildir"</span></pre>
<pre>vi postfixadmin-mailbox-postdeletion.sh

# Change this to where you keep your virtual mail users' maildirs.
<span style="color: #ff9900;">#basedir=/var/spool/maildirs ←コメントアウト
basedir=/mail ←追記</span></pre>
<p>実行権を与える</p>
<pre>chmod 700 /usr/local/bin/postfixadmin/postfixadmin*</pre>
<p>postfixadmin 設定ファイル修正</p>
<pre>vi /var/www/postfixadmin/config.inc.php

// Optional:
// Script to run after creation of mailboxes.
// Note that this may fail if PHP is run in "safe mode", or if
// operating system features (such as SELinux) or limitations
// prevent the web-server from executing external scripts.
<span style="color: #ff9900;">// $CONF['mailbox_postcreation_script']='sudo -u courier /usr/local/bin/postfixadmin-mailbox-postcreation.sh'; ←コメントアウト
$CONF['mailbox_postcreation_script']='sudo /usr/local/bin/postfixadmin/postfixadmin-mailbox-postcreation.sh'; ←追記</span></pre>
<p>sudo変更<br />
※ 終了するには esc の後に、大文字で ZZ</p>
<pre>visudo

#
# Disable "ssh hostname sudo ", because it will show the password in clear.
#         You have to run "ssh -t hostname sudo ".
#
<span style="color: #ff9900;">#Defaults    requiretty ←コメントアウト
</span>
## The COMMANDS section may have other options added to it.
##
## Allow root to run any commands anywhere
root    ALL=(ALL)       ALL
<span style="color: #ff9900;">apache ALL=(ALL) NOPASSWD: /usr/local/bin/postfixadmin/postfixadmin-mailbox-postcreation.sh ←追記</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://perl.no-tubo.net/2009/10/14/%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%ef%bc%88postfix-mysql-dovecot-postfixadmin%ef%bc%89-2/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://perl.no-tubo.net/2009/10/14/%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%ef%bc%88postfix-mysql-dovecot-postfixadmin%ef%bc%89-2/" />
	</item>
		<item>
		<title>CentOS5.3 PostfixをMySQL対応にする</title>
		<link>http://perl.no-tubo.net/2009/10/02/centos5-3-postfix%e3%82%92mysql%e5%af%be%e5%bf%9c%e3%81%ab%e3%81%99%e3%82%8b/</link>
		<comments>http://perl.no-tubo.net/2009/10/02/centos5-3-postfix%e3%82%92mysql%e5%af%be%e5%bf%9c%e3%81%ab%e3%81%99%e3%82%8b/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 09:40:04 +0000</pubDate>
		<dc:creator>clicktx</dc:creator>
				<category><![CDATA[CentOS5.x]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[メールサーバ]]></category>

		<guid isPermaLink="false">http://pet.no-tubo.net/?p=182</guid>
		<description><![CDATA[2010-12-04追記
どうやらCentOS5.5ではRPMが用意されている模様
64bit http://ftp.riken.jp/Linux/centos/5.5/centosplus/x86_64/RPMS/po [...]]]></description>
			<content:encoded><![CDATA[<blockquote><p>2010-12-04追記<br />
どうやらCentOS5.5ではRPMが用意されている模様<br />
64bit http://ftp.riken.jp/Linux/centos/5.5/centosplus/x86_64/RPMS/postfix-2.3.3-2.1.centos.mysql_pgsql.x86_64.rpm<br />
32bit http://ftp.riken.jp/Linux/centos/5.5/centosplus/i386/RPMS/postfix-2.3.3-2.1.centos.mysql_pgsql.i386.rpm<br />
あれ？前からあったのか？？</p></blockquote>
<p>yumでインストールされていたらアンインストール</p>
<pre>yum erase postfix</pre>
<h3>ダウンロード</h3>
<p><a href="http://ftp.riken.jp/Linux/centos/">最新版の確認</a>（/5.x/centosplus/SRPMS/より）</p>
<pre>rpm -ivh http://ftp.riken.jp/Linux/centos/5.4/centosplus/SRPMS/postfix-2.3.3-2.1.centos.mysql_pgsql.src.rpm</pre>
<h3>コンパイル前の下準備</h3>
<p>Postfix をMySQL対応にするためpostfix.specを編集。</p>
<pre>cd /usr/src/redhat/SPECS/
vi postfix.spec
..
%define MYSQL 1　<span style="color: #ff9900;">←確認（0なら1に修正）</span>
%define PGSQL 0　<span style="color: #ff9900;">←postgreSQLを使わないなら1から0に修正</span>
..</pre>
<h3>コンパイル</h3>
<p>srpmからrpmを作成する。</p>
<blockquote><p>エラー: ビルド依存性の失敗:<br />
pcre-devel は postfix-2.3.3-2.1.centos.mysql_pgsql.i386 に必要とされています</p></blockquote>
<p>などのエラーが出たら<br />
yum install pcre-devel<br />
でインストール後に再度実行。</p>
<pre>rpmbuild -bb postfix.spec</pre>
<h3>インストール</h3>
<p>出来上がったRPMをインストールする。</p>
<pre>cd /usr/src/redhat/RPMS/i386/
rpm -ivh postfix-2.3.3-2.1.centos.mysql_pgsql.i386.rpm</pre>
<h3>yumの自動アップデートから外す</h3>
<p>yum update で postfix* なパッケージがアップデートされなくなる。</p>
<p>これをしないとyumの自動アップデート時にMySQL非対応に戻ってしまう。</p>
<pre>vi /etc/yum.conf
exclude=postfix*　<span style="color: #ff9900;">←最終業に追記</span></pre>
<p>↑手動でもやりましたけど<br />
<a href="http://perl.no-tubo.net/2010/03/08/postfixをyumでアップデートしてしまった-orz/">Postfixをyumでアップデートしてしまった orz&#8230;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://perl.no-tubo.net/2009/10/02/centos5-3-postfix%e3%82%92mysql%e5%af%be%e5%bf%9c%e3%81%ab%e3%81%99%e3%82%8b/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://perl.no-tubo.net/2009/10/02/centos5-3-postfix%e3%82%92mysql%e5%af%be%e5%bf%9c%e3%81%ab%e3%81%99%e3%82%8b/" />
	</item>
		<item>
		<title>CentOS5.3 メールサーバ構築（Postfix +qmail +vpopmail +Dovecot）</title>
		<link>http://perl.no-tubo.net/2009/09/30/centos5-3-%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%ef%bc%88postfix-qmail-vpopmail-dovecot%ef%bc%89/</link>
		<comments>http://perl.no-tubo.net/2009/09/30/centos5-3-%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%ef%bc%88postfix-qmail-vpopmail-dovecot%ef%bc%89/#comments</comments>
		<pubDate>Wed, 30 Sep 2009 09:34:01 +0000</pubDate>
		<dc:creator>clicktx</dc:creator>
				<category><![CDATA[CentOS5.x]]></category>
		<category><![CDATA[メールサーバ]]></category>

		<guid isPermaLink="false">http://pet.no-tubo.net/?p=179</guid>
		<description><![CDATA[CentOSで自宅サーバー構築を参考に構築したが、途中でエラーが出たのでメモ。
19.独自のメールアドレスをつくる(Postfix編)メールサーバー構築(Postfix+Dovecot)CentOS4/CentOS5ht [...]]]></description>
			<content:encoded><![CDATA[<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">CentOSで自宅サーバー構築を参考に構築したが、途中でエラーが出たのでメモ。</p>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">19.独自のメールアドレスをつくる(Postfix編)<br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" />メールサーバー構築(Postfix+Dovecot)CentOS4/CentOS5<br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" /><a style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #333333; text-decoration: underline; padding: 0px; margin: 0px;" href="http://centossrv.com/postfix.shtml" target="_blank">http://centossrv.com/postfix.shtml</a><br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" />バーチャルドメイン設定(Postfix&amp;Dovecot+qmail&amp;vpopmail)CentOS5<br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" /><a style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #333333; text-decoration: underline; padding: 0px; margin: 0px;" href="http://centossrv.com/postfix-vpopmail.shtml" target="_blank">http://centossrv.com/postfix-vpopmail.shtml</a><br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" />vpopmail用メールアカウント&amp;メーリングリスト管理システム導入(Postfix+qmailadmin)CentOS5<br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" /><a style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #333333; text-decoration: underline; padding: 0px; margin: 0px;" href="http://centossrv.com/postfix-qmailadmin.shtml" target="_blank">http://centossrv.com/postfix-qmailadmin.shtml</a></p>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;"><br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" />エラーが出たのは、バーチャルドメイン設定（<a style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #333333; text-decoration: underline; padding: 0px; margin: 0px;" href="http://centossrv.com/postfix-vpopmail.shtml" target="_blank">http://centossrv.com/postfix-vpopmail.shtml</a>）のDovecotのRPM作成時。<br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" />使用したsrpmは dovecot-1.0.7-7.el5.src.rpm</p>
<blockquote>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">rpmbuild -bb &#8211;clean /usr/src/redhat/SPECS/dovecot.spec<br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" /></p>
</blockquote>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">で、どうしても途中でこける。</p>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">
<blockquote><p>Install prefix &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;. : /usr<br />
File offsets &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230; : 64bit<br />
I/O loop method &#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230; : poll<br />
File change notification method &#8230;.. : inotify<br />
Building with SSL support &#8230;&#8230;&#8230;.. : yes (OpenSSL)<br />
Building with IPv6 support &#8230;&#8230;&#8230;. : yes<br />
Building with pop3 server &#8230;&#8230;&#8230;.. : yes<br />
Building with mail delivery agent  .. : yes<br />
Building with GSSAPI support &#8230;&#8230;.. : no<br />
Building with user database modules . : static prefetch passwd passwd-file checkpassword vpopmail (modules)<br />
Building with password lookup modules : passwd passwd-file shadow pam checkpassword vpopmail (modules)<br />
Building with SQL drivers &#8230;&#8230;&#8230;&#8230;:<br />
+ &#8211;with-pgsql &#8211;with-mysql &#8211;with-ssl=openssl &#8211;with-ssldir=/etc/pki/dovecot &#8211;with-ldap &#8211;with-inotify &#8211;with-gssapi<br />
/var/tmp/rpm-tmp.53261: line 61: &#8211;with-pgsql: command not found<br />
エラー: /var/tmp/rpm-tmp.53261 の不正な終了ステータス (%build)</p>
<p>RPM ビルドエラー:<br />
/var/tmp/rpm-tmp.53261 の不正な終了ステータス (%build)</p></blockquote>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">ググっていたら<br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" /><a style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #333333; text-decoration: underline; padding: 0px; margin: 0px;" href="http://tkoshima.net/mt/2007/08/15/200708151413.php" target="_blank">http://tkoshima.net/mt/2007/08/15/200708151413.php</a><br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" />を発見。<br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" />とりあえずこちらの方法でRPMを作成したらうまくいった。<br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" />作成したRPMはそのまま使い、後の手順を引き続き行った。</p>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">・・・ただし、うまくメールが配送されない。</p>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">とりあえずqmailadminだとドメインの管理が面倒だという事に気がつく。</p>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">ということで、Qmail+ vpopmailはやめる事に。</p>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">Postfix+MySQL+Dovecot+postfixadminで管理する事に決定。</p>
]]></content:encoded>
			<wfw:commentRss>http://perl.no-tubo.net/2009/09/30/centos5-3-%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%ef%bc%88postfix-qmail-vpopmail-dovecot%ef%bc%89/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://perl.no-tubo.net/2009/09/30/centos5-3-%e3%83%a1%e3%83%bc%e3%83%ab%e3%82%b5%e3%83%bc%e3%83%90%e6%a7%8b%e7%af%89%ef%bc%88postfix-qmail-vpopmail-dovecot%ef%bc%89/" />
	</item>
		<item>
		<title>Postfixでのバーチャルドメインの設定</title>
		<link>http://perl.no-tubo.net/2008/01/12/postfix%e3%81%a7%e3%81%ae%e3%83%90%e3%83%bc%e3%83%81%e3%83%a3%e3%83%ab%e3%83%89%e3%83%a1%e3%82%a4%e3%83%b3%e3%81%ae%e8%a8%ad%e5%ae%9a/</link>
		<comments>http://perl.no-tubo.net/2008/01/12/postfix%e3%81%a7%e3%81%ae%e3%83%90%e3%83%bc%e3%83%81%e3%83%a3%e3%83%ab%e3%83%89%e3%83%a1%e3%82%a4%e3%83%b3%e3%81%ae%e8%a8%ad%e5%ae%9a/#comments</comments>
		<pubDate>Sat, 12 Jan 2008 05:58:18 +0000</pubDate>
		<dc:creator>clicktx</dc:creator>
				<category><![CDATA[メールサーバ]]></category>

		<guid isPermaLink="false">http://pet.no-tubo.net/?p=47</guid>
		<description><![CDATA[バーチャルドメインをPostfixで使う場合
/etc/postfix/virtual
の編集が必要となる
参考文献http://vine-linux.ddo.jp/linux/mail/virtual.php
]]></description>
			<content:encoded><![CDATA[<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">バーチャルドメインをPostfixで使う場合</p>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">/etc/postfix/virtual</p>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;">の編集が必要となる</p>
<p style="margin-top: 10px; margin-right: 12px; margin-bottom: 10px; margin-left: 12px; font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #444444; line-height: 1.4; padding: 0px;"><br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" />参考文献<br style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #111111; padding: 0px; margin: 0px;" /><a style="font-size: 13px; font-weight: normal; font-style: normal; font-family: Verdana, 'ヒラギノ角ゴ Pro W3', 'ＭＳ ゴシック', Osaka‐等幅; text-align: left; color: #333333; text-decoration: underline; padding: 0px; margin: 0px;" href="http://vine-linux.ddo.jp/linux/mail/virtual.php" target="_blank">http://vine-linux.ddo.jp/linux/mail/virtual.php</a></p>
]]></content:encoded>
			<wfw:commentRss>http://perl.no-tubo.net/2008/01/12/postfix%e3%81%a7%e3%81%ae%e3%83%90%e3%83%bc%e3%83%81%e3%83%a3%e3%83%ab%e3%83%89%e3%83%a1%e3%82%a4%e3%83%b3%e3%81%ae%e8%a8%ad%e5%ae%9a/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://perl.no-tubo.net/2008/01/12/postfix%e3%81%a7%e3%81%ae%e3%83%90%e3%83%bc%e3%83%81%e3%83%a3%e3%83%ab%e3%83%89%e3%83%a1%e3%82%a4%e3%83%b3%e3%81%ae%e8%a8%ad%e5%ae%9a/" />
	</item>
	</channel>
</rss>

