rspamd と rmilter をアップデート

ここ 2 年半ぐらい、rspamd を使い続けているサーバ、動作上特に不満があるわけでもなかったのだけど、

以前、インストールメモをエントリーとしてあげていた、 rspamdrmilter の組み合わせ、なかなか調子良く動作してくれている。

[From rspamd + rmiter の組み合わせに、ClamAV を連携させてみた - Soukaku's HENA-CHOKO Blog]

2週間ほど前から、そのサーバが受信・配送したメールに Spam がチラホラ紛れ込んでくるようになったので、「こりゃ自前でフィルタ書かんと駄目かな~」と思いつつ、公式サイトをチェックしてしてみたら…。

Rspamd is also available in some versions of Debian and Ubuntu. However, we are looking for an active maintainer for rspamd in these ‘official’ repos, as now rspamd is terribly outdated there.

Please DO NOT use those packages, as they are no longer supported.

[From Downloads]

「パッケージ、アップデートされねぇなぁ、 sid なのに…」とは感じてたんですけどね、「メンテナ探してるんだけど、 Debian/Ubuntu の公式サイトで配布してるのは古いんで使わないでね。」という状況だったはつゆ知らず…。

ということでフィルタを書く前に、公式サイトに書いてある手順を元に、最新バージョンの rspamd / rmilter にアップデートしてみた。

ということで、以下作業手順とログ

まず、現時点で、インストール済みのバージョンは、以下の通り。

  1. root@vps2:~# dpkg -l rspamd rmilter
  2. Desired=Unknown/Install/Remove/Purge/Hold
  3. | Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
  4. |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
  5. ||/ Name Version Architecture Description
  6. +++-==================-==============-==============-=========================================
  7. hi rmilter 1.6.3 amd64 Another sendmail milter for different mai
  8. hi rspamd 0.9.9+b1 amd64 Rapid spam filtering system

公式サイトで見ると、 rspamd は 1.4.4 、rmilter は 1.10 が最新のようなので、随分とバージョンが上がってますね…。


アップデートの手順自体は、公式サイトの Downloads にある Debian/Ubuntu の手順に従って、 rspamd をダウンロードするための apt ラインを設定すればいいわけですが、自分のところの場合、この状態で "aptitude update" を実行するとエラーが出てパッケージDBの更新ができない。

  1. rroot@vps2:~# wget -O- https://rspamd.com/apt-stable/gpg.key | apt-key add -
  2. --2017-02-27 21:05:47-- https://rspamd.com/apt-stable/gpg.key
  3. Resolving rspamd.com (rspamd.com)... 5.9.155.182
  4. Connecting to rspamd.com (rspamd.com)|5.9.155.182|:443... connected.
  5. HTTP request sent, awaiting response... 200 OK
  6. Length: 3140 (3.1K) [text/plain]
  7. Saving to: 'STDOUT'

  8. - 100%[===============================>] 3.07K --.-KB/s in 0s

  9. 2017-02-27 21:05:48 (84.1 MB/s) - written to stdout [3140/3140]

  10. OK
  11. root@vps2:~# echo "deb http://rspamd.com/apt-stable/ $CODENAME main" > /etc/apt/sources.list.d/rspamd.list
  12. root@vps2:~# echo "deb-src http://rspamd.com/apt-stable/ $CODENAME main" >> /etc/apt/sources.list.d/rspamd.list
  13. root@vps2:~# aptitude update
  14. Hit http://debian-mirror.sakura.ne.jp/debian sid InRelease
  15. Ign http://debian-mirror.sakura.ne.jp/debian stable InRelease
  16. Hit http://debian-mirror.sakura.ne.jp/debian experimental InRelease
  17. Hit http://debian-mirror.sakura.ne.jp/debian stable Release
  18. Ign http://download.webmin.com/download/repository sarge InRelease
  19. Ign http://rspamd.com/apt-stable stretch InRelease
  20. Ign http://download.owncloud.org/download/repositories/stable/Debian_8.0 InRelease
  21. Hit http://download.webmin.com/download/repository sarge Release
  22. Err http://rspamd.com/apt-stable stretch Release
  23. 404 Not Found
  24. Hit http://download.owncloud.org/download/repositories/stable/Debian_8.0 Release
  25. Hit https://packagecloud.io/grafana/stable/debian jessie InRelease
  26. E: The repository 'http://rspamd.com/apt-stable stretch Release' does not have a Release file.
  27. E: Failed to download some files
  28. W: Failed to fetch http://rspamd.com/apt-stable/dists/stretch/Release: 404 Not Found
  29. E: Some index files failed to download. They have been ignored, or old ones used instead.

エラーをよく見てみると "http://rspamd.com/apt-stable/dists/stretch/Release: 404 Not Found" とあるので、この辺りが違ってそう、ということでサイト側を確認してみたところ、 stretch がない。

https://rspamd.com/apt-stable/dists/ 以下のディレクトリ構成

うちの場合は sid を使っているので "/etc/apt/sources.list.d/rspamd.list" の中の stretch を sid に置き換えてあげれば OK。

  1. root@vps2:~# diff -u /etc/apt/sources.list.d/rspamd.list~ /etc/apt/sources.list.d/rspamd.list
  2. --- /etc/apt/sources.list.d/rspamd.list~ 2017-02-27 21:05:50.590960052 +0900
  3. +++ /etc/apt/sources.list.d/rspamd.list 2017-02-27 21:19:01.790854483 +0900
  4. @@ -1,2 +1,2 @@
  5. -deb http://rspamd.com/apt-stable/ stretch main
  6. -deb-src http://rspamd.com/apt-stable/ stretch main
  7. +deb http://rspamd.com/apt-stable/ sid main
  8. +deb-src http://rspamd.com/apt-stable/ sid main

この状態で、パッケージDBのアップデートをしてから、おもむろに rspamd と rmilter のパッケージアップデートを実行。

  1. root@vps2:~# aptitude safe-upgrade rspamd rmilter
  2. Resolving dependencies...
  3. The following NEW packages will be installed:
  4. libfann2{a} libopendkim11{a}
  5. The following packages will be REMOVED:
  6. libspf2-2{u}
  7. The following packages will be upgraded:
  8. rmilter rspamd
  9. 2 packages upgraded, 2 newly installed, 1 to remove and 10 not upgraded.
  10. Need to get 3826 kB of archives. After unpacking 21.3 MB will be used.
  11. Do you want to continue? [Y/n/?] y
  12. Get: 1 http://debian-mirror.sakura.ne.jp/debian sid/main amd64 libopendkim11 amd64 2.11.0~alpha-9 [91.1 kB]
  13. Get: 2 http://debian-mirror.sakura.ne.jp/debian sid/main amd64 libfann2 amd64 2.2.0+ds-3 [66.1 kB]
  14. Get: 3 http://rspamd.com/apt-stable sid/main amd64 rmilter amd64 1.10.0-2~sid [243 kB]
  15. Get: 4 http://rspamd.com/apt-stable sid/main amd64 rspamd amd64 1.4.4-2~sid [3426 kB]
  16. Fetched 3826 kB in 3s (977 kB/s)
  17. Reading changelogs... Done
  18. Selecting previously unselected package libopendkim11.
  19. (Reading database ... 153577 files and directories currently installed.)
  20. Preparing to unpack .../libopendkim11_2.11.0~alpha-9_amd64.deb ...
  21. Unpacking libopendkim11 (2.11.0~alpha-9) ...
  22. Preparing to unpack .../rmilter_1.10.0-2~sid_amd64.deb ...
  23. No rmilter found running; none killed.
  24. Unpacking rmilter (1.10.0-2~sid) over (1.6.3) ...
  25. (Reading database ... 153579 files and directories currently installed.)
  26. Removing libspf2-2 (1.2.10-7+b1) ...
  27. Selecting previously unselected package libfann2:amd64.
  28. (Reading database ... 153575 files and directories currently installed.)
  29. Preparing to unpack .../libfann2_2.2.0+ds-3_amd64.deb ...
  30. Unpacking libfann2:amd64 (2.2.0+ds-3) ...
  31. Preparing to unpack .../rspamd_1.4.4-2~sid_amd64.deb ...
  32. Unpacking rspamd (1.4.4-2~sid) over (0.9.9+b1) ...
  33. dpkg: warning: unable to delete old directory '/etc/rspamd/lua/regexp': Directory not empty
  34. dpkg: warning: unable to delete old directory '/etc/rspamd/lua': Directory not empty
  35. Setting up libopendkim11 (2.11.0~alpha-9) ...
  36. Setting up rmilter (1.10.0-2~sid) ...
  37. Installing new version of config file /etc/init.d/rmilter ...

  38. Configuration file '/etc/rmilter.conf'
  39. ==> Modified (by you or by a script) since installation.
  40. ==> Package distributor has shipped an updated version.
  41. What would you like to do about it ? Your options are:
  42. Y or I : install the package maintainer's version
  43. N or O : keep your currently-installed version
  44. D : show the differences between the versions
  45. Z : start a shell to examine the situation
  46. The default action is to keep your current version.
  47. *** rmilter.conf (Y/I/N/O/D/Z) [default=N] ?

  48. Configuration file '/etc/rmilter.conf.common'
  49. ==> Modified (by you or by a script) since installation.
  50. ==> Package distributor has shipped an updated version.
  51. What would you like to do about it ? Your options are:
  52. Y or I : install the package maintainer's version
  53. N or O : keep your currently-installed version
  54. D : show the differences between the versions
  55. Z : start a shell to examine the situation
  56. The default action is to keep your current version.
  57. *** rmilter.conf.common (Y/I/N/O/D/Z) [default=N] ?

  58. Configuration file '/etc/rmilter.conf.sysvinit'
  59. ==> Modified (by you or by a script) since installation.
  60. ==> Package distributor has shipped an updated version.
  61. What would you like to do about it ? Your options are:
  62. Y or I : install the package maintainer's version
  63. N or O : keep your currently-installed version
  64. D : show the differences between the versions
  65. Z : start a shell to examine the situation
  66. The default action is to keep your current version.
  67. *** rmilter.conf.sysvinit (Y/I/N/O/D/Z) [default=N] ?
  68. process already running.
  69. Created symlink /etc/systemd/system/multi-user.target.wants/rmilter.service -> /lib/systemd/system/rmilter.service.
  70. process already running.
  71. Setting up libfann2:amd64 (2.2.0+ds-3) ...
  72. Processing triggers for libc-bin (2.24-9) ...
  73. Processing triggers for systemd (232-18) ...
  74. Processing triggers for man-db (2.7.6.1-2) ...
  75. Setting up rspamd (1.4.4-2~sid) ...
  76. Installing new version of config file /etc/init.d/rspamd ...
  77. Installing new version of config file /etc/rspamd/2tld.inc ...
  78. Installing new version of config file /etc/rspamd/common.conf ...
  79. Installing new version of config file /etc/rspamd/composites.conf ...
  80. Installing new version of config file /etc/rspamd/logging.inc ...
  81. Installing new version of config file /etc/rspamd/metrics.conf ...
  82. Installing new version of config file /etc/rspamd/modules.conf ...
  83. Installing new version of config file /etc/rspamd/options.inc ...
  84. Installing new version of config file /etc/rspamd/rspamd.conf ...
  85. Installing new version of config file /etc/rspamd/rspamd.sysvinit.conf ...
  86. Installing new version of config file /etc/rspamd/statistic.conf ...

  87. Configuration file '/etc/rspamd/surbl-whitelist.inc'
  88. ==> Modified (by you or by a script) since installation.
  89. ==> Package distributor has shipped an updated version.
  90. What would you like to do about it ? Your options are:
  91. Y or I : install the package maintainer's version
  92. N or O : keep your currently-installed version
  93. D : show the differences between the versions
  94. Z : start a shell to examine the situation
  95. The default action is to keep your current version.
  96. *** surbl-whitelist.inc (Y/I/N/O/D/Z) [default=N] ?
  97. Installing new version of config file /etc/rspamd/worker-normal.inc ...
  98. Created symlink /etc/systemd/system/multi-user.target.wants/rspamd.service -> /lib/systemd/system/rspamd.service.
  99. Processing triggers for systemd (232-18) ...

  100. Current status: 10 (-2) upgradable.

途中、4 回ほど変更した設定ファイルをそのまま使うかどうか確認されるので、そこは全部 N (いいえ)と答えておけば、既存設定がそのまま適用されて、daemon の再起動までが完了〜。あとは、eicar のテストシグネチャをメールで送信しようとして、検知されれば、動作も問題なし、と。

  1. root@vps2:~# swaks -f root@downtown.jp -t soukaku@downtown.jp -s 127.0.0.1 -d /var/www/eicar/eicar.com.txt
  2. === Trying 127.0.0.1:25...
  3. === Connected to 127.0.0.1.
  4. <- 220 vps2.downtown.jp ESMTP Postfix (Debian/GNU)
  5. -> EHLO vps2.downtown.jp
  6. <- 250-vps2.downtown.jp
  7. <- 250-PIPELINING
  8. <- 250-SIZE 10240000
  9. <- 250-VRFY
  10. <- 250-ETRN
  11. <- 250-STARTTLS
  12. <- 250-ENHANCEDSTATUSCODES
  13. <- 250-8BITMIME
  14. <- 250-DSN
  15. <- 250 SMTPUTF8
  16. -> MAIL FROM:<root@downtown.jp>
  17. <- 250 2.1.0 Ok
  18. -> RCPT TO:<soukaku@downtown.jp>
  19. <- 250 2.1.5 Ok
  20. -> DATA
  21. <- 354 End data with <CR><LF>.<CR><LF>
  22. -> X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*
  23. -> .
  24. <** 554 5.7.1 Infected: Eicar-Test-Signature(5f873d9dd8da2114f6dceffb05b27069:368)
  25. -> QUIT
  26. <- 221 2.0.0 Bye
  27. === Connection closed with remote host.

ということで、アップデート完了。

上手く行ったと思ったら…

無事終わったかと思ったのだけど、念のためログのチェックしていたら、rmilter がバージョン上がったことで spf をサポートしなくなったらしく、再起動に失敗しているログを発見。

  1. Feb 27 22:21:17 vps2 rmilter[14010]: config file parse warning! line: 173, text: downtown.jp, reason: spf support is removed from rmilter
  2. Feb 27 22:21:17 vps2 rmilter[14010]: config file </etc/rmilter.conf.common> parse error! line: 211, text: beanstalk, reason: syntax error
  3. Feb 27 22:21:17 vps2 rmilter[14010]: yyparse: cannot parse config file, 1 error

エラーメッセージの指示通り、 /etc/rmilter.conf.common の 173 行目と 211行目からの1ブロックをコメント化して〜、とかやったのだけど、結構変更点が多いようなので、新しいバージョンに対応した /etc/rmilter.conf.common.dpkg-dist をベースに設定ファイルを書き直したり、と結構面倒なことになってしまいました…。orz

アップデートだけで結構な分量になってしまったので、フィルタについては別エントリーにて。バージョン上がったことで追加された機能もあるようなので、そのあたりの話もおいおい書いてきたいですね〜。

トラックバック(1)

rspamd をアップデートしたことで、使えるようなった機能があるので、いろいろと試してみよう アップデートだけで結構な分量になってしまったので、フィルタ... 続きを読む

コメントする

コメントする前にサインインすることもできます。