Prosody

提供: ArchWiki
ナビゲーションに移動 検索に移動

公式ウェブサイト より:

Prosody は近代的な XMPP 通信サーバーです。簡単にセットアップ・設定ができ、効率的にシステムリソースを使用するように作られています。さらに、開発者が簡単に拡張できる柔軟性のあるシステムとして設計されており、機能の追加や新しいプロトコルのプロトタイプ作成を素早く行うことができます。

インストール

prosody パッケージをインストールしてください。

任意の依存パッケージ

Prosody を実行するのに必ずしも必要ではないが、便利な機能を提供する依存パッケージです。これらの依存パッケージの中には AUR からビルド・インストールする必要があるものも含まれています。AUR のパッケージのインストール・ビルドの方法を知らない場合は AUR#パッケージのインストール を見て下さい。

TLS/SSL サポート (推奨)
盗聴されないように Prosody でストリームを暗号化できるようになります。
必要パッケージ: lua52-sec
MySQL/Postgresql バックエンド
MySQL/mariadb/Postgresql バックエンドを Prosody で使えるようになり拡張性やパフォーマンスが上がります。
必要パッケージ: lua52-dbi
警告:
  • lua51-dbi は上流からは外されています。FS#53081 を参照してください。
  • 有効にすると Prosody はデフォルトでデータベースに平文でパスワードを保存します。mod_auth_internal_hashed などのハッシュ化認証モジュールを使うことを推奨します。
接続スケーリングの向上 (推奨)
libevent を使うことで大量の同時接続を処理できるようになります。
必要パッケージ: lua52-eventAUR
ノート: luaevent を有効にすると全ての s2s 機能が破壊されるバグが存在しましたが、v0.10 で修正されました [1]
ストリームの圧縮
クライアントからサーバーへのストリームを圧縮して対応するクライアントで帯域を節約することができます。
必要パッケージ: lua52-zlibAUR

設定

ノート: The posix module and pidfile setting contained in the default configuration file are required for Prosody's proper operation.

メイン設定ファイルは /etc/prosody/prosody.cfg.lua です。Prosody の設定方法は Prosody の ドキュメント に載っています。以下のコマンドを実行することで設定ファイルの構文チェックをすることができます:

# luac5.1 -p /etc/prosody/prosody.cfg.lua

構文が正しければ何も出力されません。

ログ

Arch Linux の Prosody は syslog にログを出力するようにあらかじめ設定されています。したがって、デフォルトで、Prosody のログメッセージは systemd journal で確認できます。

制御

systemd サービスの prosody.service起動有効化してください。

Prosody はデフォルトの XMPP ポートである 5222 (クライアントからサーバーへの通信) と 5269 (サーバーからサーバーへの通信) を使用します。必要に応じてファイアウォールを設定してください。

prosodyctl プログラムを使うことで Prosody ユーザーを操作できます。ユーザーを追加するには:

# prosodyctl adduser <JID>
ヒント: You will likely want to make at least one user an administrator by adding their Jabber ID to the admins list in the configuration file.

詳しくは prosodyctl(1) を参照してください。

セキュリティ

ユーザー登録

Prosody は XMPP のインバンド登録 標準 に対応しており、ユーザーは XMPP クライアントを使って登録を行ったりパスワードを変更することができます。ユーザーにとっては便利ですが、管理者は新しいユーザーの登録を止めることができません。そのため、デフォルト設定では register モジュールは有効になっていますが allow_registrationfalse に設定されています。クライアントからユーザーができるのはパスワードを変更することだけで、新しいユーザーを登録することはできなくなっています。

ヒント: インバンド登録を有効にする場合、watchregistrationswelcome モジュールが役に立つでしょう。

ストリームの暗号化

Prosody では TLS 証明書を使ってクライアントからサーバーへの通信を暗号化することができます (依存パッケージのインストールが必要です)。prosody.cfg.lua の該当セクションを参照して証明書を使うように Prosody を設定してください。

以下を設定ファイルに追加することでクライアントからサーバーへの通信の暗号化を必須にできます:

/etc/prosody/prosody.cfg.lua
Host "*"

    c2s_require_encryption = true

同じように、サーバーからサーバーへの通信を暗号化するには:

/etc/prosody/prosody.cfg.lua
Host "*"

    s2s_require_encryption = true

クライアントからサーバーへの暗号化を必須にすることは問題ありませんが、サーバーからサーバーへの暗号化は Google Talk/Gmail など人気の XMPP サービスが対応していないので注意してください。

ユーザーの表示

登録されているユーザーのリストを確認するには:

# ls -l /var/lib/prosody/*/accounts/*

もしくは mod_listusers.lua モジュールをダウンロードして以下のように使うこともできます:

# prosodyctl mod_listusers

削除

pacman で Prosody をアンインストールしても /etc/prosody/var/lib/prosody ディレクトリは消えません。Prosody を再インストールすることがないのであれば削除すると良いでしょう。

ヒントとテクニック

コンポーネント

Prosody supports XMPP components, which provide extra services to clients. Components are either provided internally by special Prosody modules or externally using the protocol specified in XEP-0114.

ノート: Components must use a different hostname from the VirtualHost names defined in prosody.cfg.lua. Attempting to host a component on the same hostname as a defined VirtualHost will result in errors.

By default, Prosody will listen for external components. If you do not plan to use any external components with Prosody you can disable this behavior by adding the following your configuration:

/etc/prosody/prosody.cfg.lua
component_ports = {}

マルチユーザーチャット

A common component used with XMPP servers is Multi-User Chat (MUC), which allows conferences between multiple users. MUC is provided as an internal component with Prosody. To enable MUC add the following to your configuration file:

/etc/prosody/prosody.cfg.lua
Component "conference.example.com" "muc"

This will enable the MUC component on host conference.example.com.

Prosody モジュール

Prosody Modules is a collection of extra modules not distributed with Prosody. These modules are in various states of development from highly experimental to relatively stable. You should consult a given module's wiki page for more information. An example of an extra module is pastebin, which when loaded will intercept long messages (for example, log file output) and replace them with a link to a pastebin hosted using Prosody's internal HTTP server (provided by the core module, httpserver).

To use an extra module download its raw file(s) from the source browser (when viewing a file, search for the link "View raw file"). Alternatively and likely easier, use Mercurial to clone the entire repository:

Prosody 0.9+

$ hg clone https://hg.prosody.im/prosody-modules/ prosody-modules

Prosody 0.8

$ hg clone http://0-8.prosody-modules.googlecode.com/hg/ prosody-modules

Now you can copy the module (and any additional files it needs) to Prosody's module directory at /usr/lib/prosody/modules. To enable the module add it to your modules_enabled list in your prosody.cfg.lua for the host or component you wish to use it for. For example, to use the pastebin module on a MUC component:

/etc/prosody/prosody.cfg.lua
Component "conference.example.com" "muc"
    modules_enabled = { "pastebin" }
ノート: An enforced Prosody convention is that modules are named mod_foo.lua but simply enabled by adding foo to the modules_enabled list.

コンソール

警告: The console does not require any authentication so any user on a multi-user system can connect and issue commands on the console. Therefore it is not recommended to enable the console module on a multi-user system.

The console module provides a telnet console from which administrative operations and queries can be performed. You can connect to the console by issuing:

$ telnet localhost 5582

You of course need the telnet program provided by the inetutils package. Use the help command in the console to get usage help.

The console even allows you to execute Lua commands directly on the server by preceding a command with >. For example to see if a client connection is compressed:

> full_sessions["romeo@montague.lit/Resource"].compressed

Will return true if the connection is compressed or nil if it is not.

トラブルシューティング

One of Prosody's primary design principles is to be simple to use and configure. However, issues can still arise (and likely will as is the case with any complex software). If you encounter a problem there are a variety of steps you can take to narrow down the cause:

  • Check for known issues
    Look at the release notes for your Prosody version to see if your issue is listed as a known issue. Also check the issue tracker to see if your issue has already been reported.
  • Check configuration syntax
    Run luac5.1 -p /etc/prosody/prosody.cfg.lua to check for any syntax errors in your configuration file. If there is no output your syntax is fine.
  • Check the log
    Errors are only logged if there is a critical problem so always address those issues. If you think you have a very low level issue (like protocol compatibility between clients and servers with Prosody) then you can enable the very verbose debug level logging.
  • Check permissions
    The Prosody package should add a new prosody user and group to your system and set appropriate permissions, but it is always good to double check. Ensure that /etc/prosody and /var/lib/prosody are owned by the prosody user and that the user has appropriate permissions to read and write to those paths and all contained files.
  • Check listening ports
    When troubleshooting connection issues make sure that Prosody is actually listening for connections. You may do so by running ss -tul and making sure that xmpp-client (port 5222) and xmpp-server (port 5269) are listed.
  • Restart
    Like most things, it does not hurt to restart Prosody (systemctl restart prosody) to see if it resolves an issue.

If you are unable to resolve your issue yourself there are a variety of resources you can use to seek help. In order of immediacy with which you will likely receive help:

  1. XMPP カンファレンス: prosody@conference.prosody.im
  2. メーリングリスト: prosody-users@googlegroups.com, web interface
  3. Arch フォーラム (パッケージの問題についてのみ)

開発

Two development packages are maintained for Prosody in the AUR, prosody-develAUR[リンク切れ: アーカイブ: aur-mirror] and prosody-hgAUR. prosody-devel tracks the latest source release of a development version (alpha, beta, release candidate) and will actually be behind the stable version if a final version of the development version is released. prosody-hg tracks the Mercurial repository tip for Prosody and will always contain the latest code as it is checked in. Both packages are built similarly to the stable package.

コミュニティ

参照