やるきなし

2018/03/27 09:58 / Mailman 2.1 設定メモ

いつも ML を作成する際は fml 4 を利用していたのだが,使えないことはないのだが(若干の patch が必要)最近利用している人がめっきり減ってきているので Mailman を利用することにした.

Debian GNU/Linux Stretch で mailman3 package (backports 3.1.1-8~bpo9+1)を利用しようとしたのだが,RDBMS に依存したうえかなり手作業で調整する必要がありそうだったので,mailman package (1:2.1.23-1+deb9u2) を利用.

(注(2021/9/8): 2021/8/14 にリリースされた Debian 11 “bullseye” には mailman package が無いので,選択肢としては mailman3 のみ.See 特記すべき時代遅れとなったパッケージたち.)

インストールは基本的に aptitude 等で mailman package を入れるだけ(debconf でもろもろ聞かれるが適当に答える; 言語とか).

list group に属していれば一般ユーザ権限で ML の操作が可能.以下手動でメンバの操作をして,参加者からの制御を禁止するMLの設定例.Default の状態だとかなりメンバ宛にいろいろなメールが届いてちょっと鬱陶しいので.

ML 作成

% /usr/sbin/newlist mytestml
Enter the email of the person running the list: myn@example.com
Initial mytestml password: 
To finish creating your mailing list, you must edit your /etc/aliases (or
equivalent) file by adding the following lines, and possibly running the
`newaliases' program:

## mytestml mailing list
mytestml:              "|/var/lib/mailman/mail/mailman post mytestml"
mytestml-admin:        "|/var/lib/mailman/mail/mailman admin mytestml"
mytestml-bounces:      "|/var/lib/mailman/mail/mailman bounces mytestml"
mytestml-confirm:      "|/var/lib/mailman/mail/mailman confirm mytestml"
mytestml-join:         "|/var/lib/mailman/mail/mailman join mytestml"
mytestml-leave:        "|/var/lib/mailman/mail/mailman leave mytestml"
mytestml-owner:        "|/var/lib/mailman/mail/mailman owner mytestml"
mytestml-request:      "|/var/lib/mailman/mail/mailman request mytestml"
mytestml-subscribe:    "|/var/lib/mailman/mail/mailman subscribe mytestml"
mytestml-unsubscribe:  "|/var/lib/mailman/mail/mailman unsubscribe mytestml"

Hit enter to notify mytestml owner...

これで owner (myn@example.com) 宛に以下のメールが届く(newlist-q option を付けると届かない).

To: myn@example.com
Subject: Your new mailing list: mytestml
From: mailman-owner@example.com
Content-Type: text/plain; charset="utf-8"
Message-ID: <mailman.0.XXXXXXXXXX.XXXXX.mytestml@example.com>
Date: Tue, 27 Mar 2018 10:15:05 +0900
X-List-Administrivia: yes

The mailing list `mytestml' has just been created for you.  The
following is some basic information about your mailing list.

Your mailing list password is:

    xxxxxxxx

You need this password to configure your mailing list.  You also need
it to handle administrative requests, such as approving mail if you
choose to run a moderated list.

You can configure your mailing list at the following web page:

    http://example.com/cgi-bin/mailman/admin/mytestml

The web page for users of your mailing list is: 

    http://example.com/cgi-bin/mailman/listinfo/mytestml

You can even customize these web pages from the list configuration
page.  However, you do need to know HTML to be able to do this.

There is also an email-based interface for users (not administrators)
of your list; you can get info about using it by sending a message
with just the word `help' as subject or in the body, to:

    mytestml-request@example.com

To unsubscribe a user: from the mailing list 'listinfo' web page,
click on or enter the user's email address as if you were that user.
Where that user would put in their password to unsubscribe, put in
your admin password.  You can also use your password to change
member's options, including digestification, delivery disabling, etc.

Please address all questions to mailman-owner@example.com.

From: が mailman-owner@example.com になっているが,インストール時に mailman という名前の ML を作成するように言われて作ったような気もする.

/etc/aliasesについては以下のみ追加, newaliasesする.

mytestml:              "|/var/lib/mailman/mail/mailman post mytestml"
mytestml-bounces:      "|/var/lib/mailman/mail/mailman bounces mytestml"
mytestml-owner:        "|/var/lib/mailman/mail/mailman owner mytestml"

mytestml は ML の宛先,mytestml-bounces は配信時の envelope from.mytestml-owner には何かあった時に mailman から連絡が届く(メンバ外からの投稿を許可していない状態でメンバ外からメールが来た際に moderate request が届いたり).他は今回目的外なので,そもそも aliases に登録しない.

Web I/F 設定

手元の環境では sudo a2enmod cgid して,/etc/apache2/sites-enabled//etc/mailman/apache.conf への symlink を配置するのみで動作している.ただし,外部公開はかなり危険なので,サーバ自体へのアクセスを制限(iptables).各種 URL は以下のとおり.

ML 設定

以下で現在の設定を Export.

% /usr/sbin/config_list -o mytestml.conf mytestml

mytestml.conf (python) を修正のうえ,以下で Import.

/usr/sbin/config_list -i mytestml.conf mytestml

Web interface もあるが,上記が最も手軽で再現性がある.以下設定メモ.

To: myn@example.com
Subject: Welcome to the "Mytestml" mailing list
From: mytestml-request@example.com
Content-Type: text/plain; charset="utf-8"
Message-ID: <mailman.0.XXXXXXXXXX.XXXXX.mytestml@example.com>
Date: Tue, 27 Mar 2018 10:37:05 +0900
X-List-Administrivia: yes

Welcome to the Mytestml@example.com mailing list!

To post to this list, send your message to:

  mytestml@example.com

General information about the mailing list is at:

  http://example.com/cgi-bin/mailman/listinfo/mytestml

If you ever want to unsubscribe or change your options (eg, switch to
or from digest mode, change your password, etc.), visit your
subscription page at:

  http://example.com/cgi-bin/mailman/options/mytestml/myn%40example.com


You can also make such adjustments via email by sending a message to:

  Mytestml-request@example.com

with the word `help' in the subject or body (don't include the
quotes), and you will get back a message with instructions.

You must know your password to change your options (including changing
the password, itself) or to unsubscribe without confirmation.  It is:

  xxxxxxxx

Normally, Mailman will remind you of your example.com
mailing list passwords once every month, although you can disable this
if you prefer.  This reminder will also include instructions on how to
unsubscribe or change your account options.  There is also a button on
your options page that will email your current password to you.
To: myn@example.com
Subject: You have been unsubscribed from the Mytestml mailing list
From: mytestml-bounces@example.com
Content-Type: text/plain; charset="utf-8"
Message-ID: <mailman.0.XXXXXXXXXX.XXXXX.mytestml@example.com>
Date: Tue, 27 Mar 2018 10:41:49 +0900
X-List-Administrivia: yes

以下 subject_prefix, msg_footer, include_rfc2369_headers が default の状態の投稿.

To: mytestml@example.com
Subject: [Mytestml] test
From: myn@example.com
Delivered-To: mytestml@example.com
Date: Tue, 27 Mar 2018 10:45:31 +0900
Message-ID: <xxxx@example.com>
Precedence: list
List-Id: <mytestml.example.com>
List-Unsubscribe: <http://example.com/cgi-bin/mailman/options/mytestml>,  <mailto:mytestml-request@example.com?subject=unsubscribe>
List-Archive: <http://example.com/pipermail/mytestml/>
List-Post: <mailto:mytestml@example.com>
List-Help: <mailto:mytestml-request@example.com?subject=help>
List-Subscribe: <http://example.com/cgi-bin/mailman/listinfo/mytestml>,  <mailto:mytestml-request@example.com?subject=subscribe>
Content-Type: text/plain; charset="utf-8"
Errors-To: mytestml-bounces@example.com
Sender: "Mytestml" <mytestml-bounces@example.com>

test

-- 
myn.meganecco.org

_______________________________________________
Mytestml mailing list
Mytestml@example.com
http://example.com/cgi-bin/mailman/listinfo/mytestml

ML メンバ追加・削除

メンバ全員削除.

% /usr/sbin/remove_members -a mytestml

メンバリスト export.

% /usr/sbin/list_members mytestml > mytestml.members.txt

(Regular)メンバ追加.mytestml.members.txt に one address per line 形式でメールアドレスをリストしておく.-r ではなく -d を使うと digest member になるが,この機能は今回使わない.

% /usr/sbin/add_members -r mytestml.members.txt mytestml

cron について

以下が仕込まれる(/etc/cron.d/mailman).

0 8 * * * list [ -x /usr/lib/mailman/cron/checkdbs ] && /usr/lib/mailman/cron/checkdbs
0 9 * * * list [ -x /usr/lib/mailman/cron/disabled ] && /usr/lib/mailman/cron/disabled
0 12 * * * list [ -x /usr/lib/mailman/cron/senddigests ] && /usr/lib/mailman/cron/senddigests
0 5 1 * * list [ -x /usr/lib/mailman/cron/mailpasswds ] && /usr/lib/mailman/cron/mailpasswds
27 3 * * * list [ -x /usr/lib/mailman/cron/nightly_gzip ] && /usr/lib/mailman/cron/nightly_gzip
30 4 * * * list [ -x /usr/lib/mailman/cron/cull_bad_shunt ] && /usr/lib/mailman/cron/cull_bad_shunt

0 5 1 * * の mailpasswds が気になるが(テストし辛い...),これは各MLの send_reminders (0:No, 1:Yes, Default: 0)を見て送付するかどうかを決めているので,特に問題なさげ.

追記 (2018/3/28)

「mailman 設定」でGoogle検索するとトップに現れる https://www.speever.jp/vzmanual/mailman/ は,丁寧に設定のやり方が書かれている割に,誤りが多いような気がする(訳した際に解釈を誤ったか,バージョン違い?).

追記 (2018/3/29)

new_member_options (Default: 256) というのがあって,これは新規ユーザ追加時のオプションで,DontReceiveDuplicates (nodupes) flag のみ On になるのが Default の設定.各ビットの意味は以下のとおり.

[/usr/lib/mailman/Mailman/Defaults.py]
# Bitfield for user options.  See DEFAULT_NEW_MEMBER_OPTIONS above to set
# defaults for all new lists.
Digests             = 0 # handled by other mechanism, doesn't need a flag.
DisableDelivery     = 1 # Obsolete; use set/getDeliveryStatus()
DontReceiveOwnPosts = 2 # Non-digesters only
AcknowledgePosts    = 4
DisableMime         = 8 # Digesters only
ConcealSubscription = 16
SuppressPasswordReminder = 32
ReceiveNonmatchingTopics = 64
Moderate = 128
DontReceiveDuplicates = 256

DontReceiveDuplicates (nodupes) だが,To: 個人,Cc: ML のメールで,この個人が ML メンバだった場合に,その個人にこのメールを配信しない,というオプション.通常はこの手のメールは2通届いたりするのだが,mailman の場合は default で重複配信しないようになっている.

追記 (2018/4/18)

max_num_recipients (Default: 10) というのがあって,これは,この数字以上の宛先がメールに含まれている場合に admin proval を要求するというもの.0 だと制限がなくなる.通常は 10 ぐらいで充分なのだが,メールのやり取りをしている間に宛先が徐々に増えていって,この制限に引っかかる事例が発生した.0 は少し怖いので少しだけ大きく 15 にしておいた.

Related articles