RaspberryPi自宅サーバにmailman

投稿者: | 2017年1月19日

自分へのメモをメーリングリストで管理することにした。
以前fmlとか扱ったことがあるが最近はmailmanというものが主流らしい。
さっそく調べてラズパイ自宅サーバへセットアップ。

この自宅サーバーは
Nginx+Phpでこのwordpressを配信している。
すでにpostfixでメールサーバーは構築すみ。
ネットの情報はapacheが多いけど海外サイトなどの参考になんとかインストール。
インストール自体はaptで行けるので

apt-get install mailman

でサクッと完了。
/etc/postfix/main.cfのalias_mapに

,hash:/var/lib/mailman/data/aliases

を追記する。

次にmailmanの設定ファイル/etc/mailman/mm_cfg.pyを環境に合わせて修正

# -*- python -*-

# Copyright (C) 1998,1999,2000 by the Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301 USA
“””This is the module which takes your site-specific settings.

From a raw distribution it should be copied to mm_cfg.py.  If you
already have an mm_cfg.py, be careful to add in only the new settings
you want.  The complete set of distributed defaults, with annotation,
are in ./Defaults.  In mm_cfg, override only those you want to
change, after the

from Defaults import *

line (see below).

Note that these are just default settings – many can be overridden via the
admin and user interfaces on a per-list or per-user basis.

Note also that some of the settings are resolved against the active list
setting by using the value as a format string against the
list-instance-object’s dictionary – see the distributed value of
DEFAULT_MSG_FOOTER for an example.”””
#######################################################
#    Here’s where we get the distributed defaults.    #

from Defaults import *

##############################################################
# Put YOUR site-specific configuration below, in mm_cfg.py . #
# See Defaults.py for explanations of the values.            #

#————————————————————-
# The name of the list Mailman uses to send password reminders
# and similar. Don’t change if you want mailman-owner to be
# a valid local part.
MAILMAN_SITE_LIST = ‘mailman’

#————————————————————-
# If you change these, you have to configure your http server
# accordingly (Alias and ScriptAlias directives in most httpds)
DEFAULT_URL_PATTERN = ‘http://%s/cgi-bin/mailman/’
IMAGE_LOGOS         = ‘/images/mailman/’

#————————————————————-
# Default domain for email addresses of newly created MLs
DEFAULT_EMAIL_HOST = ‘k2-y.com’
#————————————————————-
# Default host for web interface of newly created MLs
DEFAULT_URL_HOST   = ‘k2-y.com’
#————————————————————-
# Required when setting any of its arguments.
add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)

add_virtualhost(‘www.k2-y.com’, ‘k2-y.com’)

#————————————————————-
# The default language for this server.
DEFAULT_SERVER_LANGUAGE = ‘ja’

#————————————————————-
# Iirc this was used in pre 2.1, leave it for now
USE_ENVELOPE_SENDER    = 0              # Still used?

#————————————————————-
# Unset send_reminders on newly created lists
DEFAULT_SEND_REMINDERS = 0

#————————————————————-
# Uncomment this if you configured your MTA such that it
# automatically recognizes newly created lists.
# (see /usr/share/doc/mailman/README.Exim4.Debian or
# /usr/share/mailman/postfix-to-mailman.py)
# MTA=None   # Misnomer, suppresses alias output on newlist

#————————————————————-
# Uncomment if you use Postfix virtual domains (but not
# postfix-to-mailman.py), but be sure to see
# /usr/share/doc/mailman/README.Debian first.

MTA=’Postfix’

#————————————————————-
# Uncomment if you want to filter mail with SpamAssassin. For
# more information please visit this website:
# http://www.jamesh.id.au/articles/mailman-spamassassin/
# GLOBAL_PIPELINE.insert(1, ‘SpamAssassin’)

# Note – if you’re looking for something that is imported from mm_cfg, but you
# didn’t find it above, it’s probably in /usr/lib/mailman/Mailman/Defaults.py.

 

赤字の部分を修正しました。
初期パスワードを設定

mmsitepass

パスワードを2回入れmailmanの準備は完了。

sudo service postfix restart
sudo service mailman start

で起動。
この状態でもコマンド運用なら使用できます。
コマンド群は/var/lib/mailman/binにあります。

コマンド運用ならば

newlistでメーリングリストを作成し
add_memberでメンバーを追加する。
config_listで設定変更もOK。詳しくはwebで調べてください。

ここからは結果うまくいってない部分。
webでのML管理を行うための設定である。

NginxでCGIを動作させる必要があるので

sudo apt-get fcgiwrap

Nginxのconfigに以下を設定

location /cgi-bin/mailman {
root /usr/lib/;
fastcgi_split_path_info (^/cgi-bin/mailman/[^/]*)(.*)$;
include /etc/nginx/fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_intercept_errors on;
fastcgi_pass unix:/var/run/fcgiwrap.socket;
}
location /images/mailman {
alias /usr/share/images/mailman;
}
location /pipermail {
alias /var/lib/mailman/archives/public;
autoindex on;
}

そしNginxを再起動

一応ML作成などできるけど管理画面が403となってしまう部分で躓いています。

なんでぇー?
恐らく権限関係の問題あと思うけどapacheなら行けるのかな??
とりあえず自分専用なのでコマンド運用することにします。

 

 

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です