YANO's digital garage

Copyright ©YANO All rights reserved. https://www.bravotouring.com/~yano/

Last-modified: 2024-04-17 (水)


[一語一絵/IT系]

qmail spf 対応 / 2006-03-09 (木)

さぁ、次は受信側のSPF対応だというわけで、約1年ぶりに[External]qmailのbuildを実施。アップデートされたという話は聞いてないが、念の為ググってみると、最近は最低限のパッチをセットした[External]netqmailからbuildするのが主流なのだそうだ。

まず、netqmail-1.05.tar.gzを展開して./collate.shでパッチ適用した後、qmail-date-localtime、qmail-spf-rc5.patch、qmail-large-dns.patchを適用。手作業でマージする事もなく意外とすんなり片付いたなぁ、と思いつつsetupしたら外からのSMTPが接続できなかった。

でもログをみるとtcpserver的にはOKなので、SMTP認証の[External]qmail-vidaとの連携が怪しい。昔の[External]qmail-vida導入メモを読みなおすと、やはり[External]qmail-vida[External]qmail用のパッチがある事がわかった。

このパッチは3ファイル合わせて6ヶ所で適用に失敗したが、.rejファイルに吐出された分を手作業で適用。追加ファイルもコピーしたあとbuildしなおし、netqmail-1.05をsetupしたらOKだった。

[owner@host software]$ tar zxfv ~/archives/netqmail-1.05.tar.gz
netqmail-1.05/
netqmail-1.05/qmail-1.03.tar.gz
  - 一部省略 -
netqmail-1.05/COPYRIGHTS
netqmail-1.05/netqmail-1.05.patch
[owner@host software]$ cd netqmail-1.05
[owner@host netqmail-1.05]$ tar zxfv ~/archives/qmail-vida-0.53.tar.gz
  - 省略 -
[owner@host netqmail-1.05]$ ./collate.sh

You should see 7 lines of text below.  If you see anything
else, then something might be wrong.
[1] Extracting qmail-1.03...
tar: Read 1024 bytes from -
[2] Patching qmail-1.03 into netqmail-1.05.  Look for errors below:
24
[4] The previous line should say 24 if you used GNU patch.
[5] Renaming qmail-1.03 to netqmail-1.05...
[6] Continue installing qmail using the instructions found at:
[7] http://www.lifewithqmail.org/lwq.html#installation
[owner@host netqmail-1.05]$ cd netqmail-1.05
[owner@host netqmail-1.05]$ patch -p1 < ~/archives/qmail-date-localtime.patch
  - 省略 -
[owner@host netqmail-1.05]$ patch -p1 < ~/archives/qmail-spf-rc5.patch
  - 省略 -
[owner@host netqmail-1.05]$ patch -p0 < ~/archives/qmail-large-dns.patch
  - 省略 -
[owner@host netqmail-1.05]$ patch -p0 < ../qmail-vida-0.53/patch/qmail.patch
  - 一部省略 -
2 out of 14 hunks FAILED -- saving rejects to file Makefile.rej
2 out of 4 hunks FAILED -- saving rejects to file qmail-popup.c.rej
2 out of 14 hunks FAILED -- saving rejects to file qmail-smtpd.c.rej
[owner@host netqmail-1.05]$ ** 上記3ファイルは手作業でマージ **
[owner@host netqmail-1.05]$ cd ~/software/qmail-vida-0.53
[owner@host qmail-vida-0.53]$ vi Makefile
QMAILSRC = ../netqmail-1.05
  - 一部省略 -
[owner@host qmail-vida-0.53]$ make copy
  - 省略 -
[owner@host netqmail-1.05]$ cd ../netqmail-1.05
[owner@host netqmail-1.05]$ make
[owner@host netqmail-1.05]$ ~/bin/qmail-stop.sh
[owner@host netqmail-1.05]$ sudo make setup check
[owner@host netqmail-1.05]$ su
Password:
[owner@host netqmail-1.05]# echo 1 > /var/qmail/control/spfbehavior
[owner@host netqmail-1.05]# [Ctrl-D]
[owner@host netqmail-1.05]$ ~/bin/qmail-start.sh

【2006年12月3日追記】
[External]qmailでRCPT TOに%、!、複数の@を含む中継はリレーされてしまう件で、qmail-smtpd-relay-reject の適用を追加する。

[owner@host netqmail-1.05]$ patch -p1 < ~/archives/qmail-smtpd-relay-reject
missing header for unified diff at line 3 of patch
patching file qmail-smtpd.c
Hunk #1 succeeded at 57 (offset 4 lines).
Hunk #2 succeeded at 262 (offset 45 lines).
Hunk #3 succeeded at 278 with fuzz 2 (offset 12 lines).
[owner@host netqmail-1.05]$
【追記ここまで】

肝心なSPF認証の振舞いを決定する /var/qmail/control/spfbehavior は取り敢えず「1:SPFレコードを参照する。Received-SPFヘッダを付加するが拒否しない」にしたので、

Received-SPF: softfail (smtp.bravotouring.com: transitioning SPF record at docomo.ne.jp does not designate 219.101.***.*** as permitted sender)
な感じのHeaderが付く。この場合、219.101.***.***はdocomo.ne.jpでは認められていないと言われているだが、それもそのはずこっちが使ってるウィルスチェックGatewayなのだ。こういう場合は裏目に出てしまうのかぁ…。取り敢えず直接受けるように設定を変更して、暫く様子見かな。

【参照】
●SPF: Sender Policy Framework http://www.openspf.org/
●qmail http://www.qmail.jp/
●netqmail http://www.qmail.org/netqmail/
┗netqmail-1.05.tar.gz http://www.qmail.org/netqmail-1.05.tar.gz
●qmail-vida http://qmail-vida.sourceforge.jp/
●SPF implementation for qmail http://www.saout.de/misc/spf/
●qmail用のSPF実装 (和訳) http://fleur.hio.jp/translation/spf-qmail/
●RBL.JPプロジェクト http://www.rbl.jp/
┗第三者中継チェック http://www.rbl.jp/svcheck.php