Prev / Next

2009-06-24 / milter manager を CentOS にインストール

Momonga への milter manager のインストールがうまくいかないので,
おとなしくドキュメントに従って CentOS にインストールしてみる.

http://milter-manager.sourceforge.net/reference/ja/install-to-centos.html




必要なパッケージのインストール

 sudo yum install -y libtool intltool gcc glib2-devel ruby ruby-devel
sudo yum --enablerepo=rpmforge install -y spamass-milter clamav-milter milter-greylist
sudo yum --enablerepo=rpmforge install -y ruby-rrdtool
wget -nd http://ruby.gfd-dennou.org/products/rpm/RPMS/CentOS/5/x86_64/ruby-glib2-0.16.0-1dc.x86_64.rpm
sudo rpm -Uvh ruby-glib2-0.16.0-1dc.x86_64.rpm
wget http://downloads.sourceforge.net/milter-manager/milter-manager-1.0.0-0.x86_64.rpm
sudo rpm -Uvh milter-manager-1.0.0-0.x86_64.rpm




spamass-milter の設定

spam 判定されたメールの subject に "[SPAM]" を付けたくないので
/etc/mail/spamassassin/local.cf の

rewrite_header Subject [SPAM]


をコメントアウト.

ソケットの設定

/etc/sysconfig/spamass-milter に

SOCKET="inet:[email protected][127.0.0.1]"


を追記.



clamav-milter の設定

ソケットの設定

/etc/sysconfig/clamav-milter に以下を追記.

SOCKET_ADDRESS="inet:[email protected][127.0.0.1]"
CLAMAV_FLAGS="$CLAMAV_FLAGS --no-check-cf"


clamav-milter の起動

sudo /etc/init.d/clamav-milter start
Starting Clamav Milter Daemon: clamav-milter: unrecognized option `--no-check-cf'
ERROR: Unknown option passed
ERROR: Can't parse command line options


と怒られるので,CLAMAV_FLAGS から "--no-check-cf" を外す
(clamav-milter のバージョンは 0.95.2-4.el5.rf).
で,再度 clamav-milter の起動.

sudo /etc/init.d/clamav-milter start
Starting Clamav Milter Daemon: WARNING: Ignoring option inet:[email protected][127.0.0.1]


/etc/sysconfig/clamav-milter に追記した設定を削除し,
/etc/clamav-milter.conf に以下を追記

MilterSocket inet:[email protected][127.0.0.1]




milter-greylist の設定

これも
http://milter-manager.sourceforge.net/reference/ja/install-to-centos.html
と少しかわっている(milter-greylist-3.0-2.el5.rf).

/etc/mail/greylist.conf を編集.

# acl whitelist default
acl greylist default


/etc/sysconfig/milter-manager を以下の内容で作成.

OPTIONS="$OPTIONS -p inet:[email protected][127.0.0.1]"




milter-manager の設定

$ /usr/sbin/milter-manager --show-config


で,以下の milter が検出された.

define_milter("clamav-milter") do |milter|
  milter.connection_spec = nil
  milter.description = "clamav-milter is a daemon which hooks into sendmail and
  routes email messages to clamav."
  milter.enabled = false
  milter.fallback_status = "accept"
  milter.applicable_conditions = []
  milter.command = "/etc/init.d/clamav-milter"
  milter.command_options = "start"
  milter.user_name = nil
  milter.connection_timeout = 300.0
  milter.writing_timeout = 10.0
  milter.reading_timeout = 10.0
  milter.end_of_message_timeout = 300.0
end

define_milter("spamass-milter") do |milter|
  milter.connection_spec = "inet:[email protected][127.0.0.1]"
  milter.description = "spamass-milter is a daemon which hooks into sendmail and
  routes email messages to spamassassin"
  milter.enabled = true
  milter.fallback_status = "accept"
  milter.applicable_conditions = ["Remote Network", "Unauthenticated"]
  milter.command = "/etc/init.d/spamass-milter"
  milter.command_options = "start"
  milter.user_name = nil
  milter.connection_timeout = 300.0
  milter.writing_timeout = 10.0
  milter.reading_timeout = 10.0
  milter.end_of_message_timeout = 300.0
end

define_milter("milter-greylist") do |milter|
  milter.connection_spec = "inet:[email protected][127.0.0.1]"
  milter.description = "Milter Greylist Daemon"
  milter.enabled = true
  milter.fallback_status = "accept"
  milter.applicable_conditions = ["Sendmail Compatible", "Remote Network", "S25R", "Unauthenticated"]
  milter.command = "/etc/init.d/milter-greylist"
  milter.command_options = "start"
  milter.user_name = nil
  milter.connection_timeout = 300.0
  milter.writing_timeout = 10.0
  milter.reading_timeout = 10.0
  milter.end_of_message_timeout = 300.0
end


clamav-milter の設定がとれていないけど,
たぶんバージョンが 0.95.2-4.el5.rf なため.

milter-manager を起動し,milter-test-server で確認.

$ sudo -u milter-manager milter-test-server -s unix:/var/run/milter-manager/milter-manager.sock
status: accept
elapsed-time: 0.086994 seconds




Postfix の設定

/etc/postfix/main.cf に以下を追記.

milter_default_action = accept
smtpd_milters = unix:/var/run/milter-manager/milter-manager.sock




テスト

メールを送ってみると /var/log/maillog に以下のようなログが.

Jun 24 06:23:19 fog postfix/smtpd[11672]: warning: connect to Milter service unix:/var/run/milter-manager/milter-manager.sock: Permission denied


permission を確認すると

$ ls -l /var/run/milter-manager/milter-manager.sock
srw-rw---- 1 milter-manager milter-manager 0  6月 24 06:12 /var/run/milter-manager/milter-manager.sock


となっていたので,とりあえず以下のように.

$ sudo chmod 666 /var/run/milter-manager/milter-manager.sock
$ ls -l /var/run/milter-manager/milter-manager.sock
srw-rw-rw- 1 milter-manager milter-manager 0  6月 24 06:12 /var/run/milter-manager/milter-manager.sock


で,再度メールを送ってみると,以下のような感じで動作している
(spamd の設定をきちんとする必要があるっぽい).

Jun 24 06:26:18 fog postfix/smtpd[11661]: connect from mail-pz0-f184.google.com[209.85.222.184]
Jun 24 06:26:18 fog milter-manager[9032]: [statistics] [session][start](0x69618c0)
Jun 24 06:26:18 fog milter-manager[9032]: [statistics] [milter][start](0x68e32b0): spamass-milter
Jun 24 06:26:18 fog milter-manager[9032]: [statistics] [milter][start](0x68e33e0): milter-greylist
Jun 24 06:26:18 fog milter-manager[9032]: [statistics] [reply][negotiate][continue]
Jun 24 06:26:18 fog milter-manager[9032]: [statistics] [reply][connect][continue]
Jun 24 06:26:18 fog milter-manager[9032]: [statistics] [reply][helo][continue]
Jun 24 06:26:18 fog spamass-milter[26304]: Could not retrieve sendmail macro "i"!.  Please add it to confMILTER_MACROS_ENVFROM for better spamassassin results
Jun 24 06:26:18 fog milter-manager[9032]: [statistics] [reply][envelope-from][continue]
Jun 24 06:26:18 fog milter-greylist: dummy-id: addr mail-pz0-f184.google.com[209.85.222.184] from <[email protected]> to <[email protected]> delayed for 00:30:00 (ACL 105)
Jun 24 06:26:18 fog milter-manager[9032]: [statistics] [reply][envelope-recipient][temporary-failure]
Jun 24 06:26:18 fog postfix/smtpd[11661]: NOQUEUE: milter-reject: RCPT from mail-pz0-f184.google.com[209.85.222.184]: 451 4.7.1 Greylisting in action, please come back later; from=<[email protected]> proto=ES
MTP helo=<mail-pz0-f184.google.com>
Jun 24 06:26:18 fog postfix/smtpd[11661]: disconnect from mail-pz0-f184.google.com[209.85.222.184]
Jun 24 06:26:18 fog milter-manager[9032]: [statistics] [session][end][0.486962](0x69618c0)
Jun 24 06:26:18 fog milter-manager[9032]: [statistics] [milter][end][0.483176](0x68e32b0): spamass-milter
Jun 24 06:26:18 fog milter-manager[9032]: [statistics] [milter][end][0.48276](0x68e33e0): milter-greylist
Jun 24 06:27:07 fog postfix/smtpd[11672]: connect from wf-out-1314.google.com[209.85.200.175]
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [session][start](0x6961970)
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [milter][start](0x68e3510): spamass-milter
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [milter][start](0x68e3640): milter-greylist
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [reply][negotiate][continue]
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [stop][connect]: milter-greylist
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [milter][end][0.002732](0x68e3640): milter-greylist
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [reply][connect][continue]
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [reply][helo][continue]
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [reply][envelope-from][continue]
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [reply][envelope-recipient][continue]
Jun 24 06:27:07 fog postfix/smtpd[11672]: 6213213F0205: client=wf-out-1314.google.com[209.85.200.175]
Jun 24 06:27:07 fog postfix/cleanup[11666]: 6213213F0205: message-id=<[email protected]>
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [reply][header][continue]
Jun 24 06:27:07 fog last message repeated 11 times
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [reply][end-of-header][continue]
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [reply][body][continue]
Jun 24 06:27:07 fog milter-manager[9032]: [statistics] [milter][end][0.615393](0x68e3510): spamass-milter
Jun 24 06:27:07 fog spamd[25990]: spamd: connection from localhost.localdomain [127.0.0.1] at port 36147
Jun 24 06:27:07 fog spamd[25990]: spamd: setuid to root succeeded
Jun 24 06:27:07 fog spamd[25990]: spamd: creating default_prefs: /root/.spamassassin/user_prefs
Jun 24 06:27:07 fog postfix/qmgr[10487]: 6213213F0205: from=<[email protected]>, size=1700, nrcpt=1 (queue active)
Jun 24 06:27:07 fog spamd[25990]: config: created user preferences file: /root/.spamassassin/user_prefs
Jun 24 06:27:07 fog spamd[25990]: spamd: still running as root: user not specified with -u, not found, or set to root, falling back to nobody
Jun 24 06:27:07 fog spamd[25990]: spamd: processing message <2003a4df09062314[email protected]> for root:99
Jun 24 06:27:08 fog postfix/local[11667]: 6213213F0205: to=<[email protected]>, relay=local, delay=0.95, delays=0.47/0.02/0/0.46, dsn=2.0.0, status=sent (delivered to command: IFS=' ' && exec /usr/bin/procmail -f- |
| exit 75 #fumi)
Jun 24 06:27:08 fog postfix/qmgr[10487]: 6213213F0205: removed


- milterを使った効果的な迷惑メール対策 - milter manager
  http://milter-manager.sourceforge.net/index.html.ja

- milter manager 1.1.0 を試す [2009-06-23-3]
- milter manager を install しようとしてみた(失敗編) [2009-06-17-1]

Referrer (Inside):
[2009-09-30-1] milter manager の評価モード
[2009-07-04-2] milter manager 1.1.1
[2009-07-01-3] 囮アドレス
[2009-06-25-2] milter manager が Momonga Linux でも動くように
[2009-06-24-2] milter-manager-log-analyzer の設定
comments powered by Disqus