Postorius

提供: ArchWiki
2023年9月1日 (金) 20:54時点におけるKusanaginoturugi (トーク | 投稿記録)による版 (→‎Hosting: 翻訳)
ナビゲーションに移動 検索に移動

Postorius は、Mailman の管理インターフェースのための Django ベースのツールです。

インストール

Postorius を使うためには、動作するウェブサーバーのセットアップが必要です (例えば、Apache を使って WSGI に直接転送するか、Nginx を使ってリクエストを UWSGI のようなアプリケーションサーバーに転送する)。

postorius パッケージをインストールします。

警告: Postorius は、パスワードやユーザーデータをネットワークに公開してしまうため、TLS 経由でのみアクセスされるべきです (テスト目的でそれを実行しているマシンから直接アクセスされる場合を除く)。

Configuration

The web application is configured in /etc/webapps/postorius/settings_local.py which is included by the default configuration in /usr/share/webapps/postorius/settings.py.

ノート: Postorius should store user sensitive data (e.g. sqlite database) in /var/lib/postorius/data/, as that directory is only accessible by root and the application itself.

Change the default secret for the application:

/etc/webapps/postorius/settings_local.py
SECRET_KEY = 'something-very-secret'

Make sure to disable debugging when running in production:

/etc/webapps/postorius/settings_local.py
DEBUG = False

To be able to configure a running mailman instance configuration options for its REST API have to be added to postorius' configuration.

/etc/webapps/postorius/settings_local.py
MAILMAN_REST_API_URL = 'http://localhost:8001'
MAILMAN_REST_API_USER = 'rest_admin'
MAILMAN_REST_API_PASS = 'rest_admin_password'

Add a valid email configuration (so that the Django application can verify subscribers):

/etc/webapps/postorius/settings_local.py
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 25
EMAIL_HOST_USER = username
EMAIL_HOST_PASSWORD = password
ノート: The DEFAULT_FROM_EMAIL and SERVER_EMAIL configuration options can be used to define the From: header of mails sent for internal authentication and error reporting (respectively).

The valid hosts or domain names for the application need to be defined:

/etc/webapps/postorius/settings_local.py
ALLOWED_HOSTS = [
    'localhost',
    'lists.example.com'
]

ホスティング

この記事またはセクションは加筆を必要としています。
理由: Apache HTTP Server を使ったセットアップの例。 (議論: トーク:Postorius#)
ノート: Postorius はそれ自身のユーザーとグループ (すなわち postorius) として実行する必要があります。それは設定、静的キャッシュ、および (潜在的に) ソケットのためにそれぞれ /etc/webapps/postorius/, /var/lib/postorius/, および /run/postorius/ を使用しています。
ノート: 静的ファイルはデフォルトでトップレベルの static/ ディレクトリから提供され、同じ (サブ) ドメイン上の hyperkitty と競合するため、/etc/webapps/postorius/settings_local.pySTATIC_URL 変数をユニークなもの (例: '/postorius_static/') に設定することをお勧めします。

Nginx と uWSGI

Postorius は /etc/uwsgi/postorius.ini にある動作する uWSGI 設定ファイルが付属しています。

nginxuwsgi-plugin-pythonインストールし、uWSGI のアプリケーションごとのソケットを作成し (UWSGI#Accessibility of uWSGI socket を参照)、uwsgi-secure@postorius.socket有効化してください。

ローカルのテストセットアップで、http://127.0.0.1:80/postorius で Postorius を提供するには、以下の Nginx 設定をセットアップに追加します:

/etc/nginx/postorius.conf
server {
  listen 80;
  server_name localhost;
  charset utf-8;
  client_max_body_size 75M;
  root /usr/share/webapps/postorius;
  access_log /var/log/nginx/access.postorius.log;
  error_log /var/log/nginx/error.postorius.log;

  location /postorius_static {
    alias /var/lib/postorius/static;
  }

  location ~^/(accounts|admin|postorius)/(.*)$ {
    include /etc/nginx/uwsgi_params;
    uwsgi_pass unix:/run/postorius/postorius.sock;
  }
}

セットアップ

ノート: 以下のコマンドは postorius ユーザーとして実行してください (例: sudo または su を使用して)。

初回インストール後、データベースを生成することを確認してください:

[postorius]$ django-admin migrate --pythonpath /usr/share/webapps/postorius/ --settings settings

その後、アプリケーションの静的データを収集する必要があります:

[postorius]$ django-admin collectstatic --pythonpath /usr/share/webapps/postorius/ --settings settings

Django アプリケーションのスーパーユーザーアカウントを作成します:

[postorius]$ django-admin createsuperuser --pythonpath /usr/share/webapps/postorius/ --settings settings

ヒントとコツ

エイリアスドメインを設定する

postfix と共に 仮想エイリアスドメイン のセットアップでドメインを使用するためには、ドメインの Alias Domain を設定する必要があります。ドメイン名は実在しなくても構いません。

Alias Domain を設定するためには、管理ユーザーでログインします (デフォルトでは postorius) し、Domains メニューでドメインの設定を変更します。

参照