Mastodon

如何轻松地将 XMPP 服务器与 Mastodon 集成。

ejabberd 服务器链接到同一服务器上的 Mastodon 实例的最简单方法是使用直接与 Mastodon Postgresql 数据库交互的外部认证脚本。此方法仅在本地网络上安全工作,但已在中型 Mastodon 实例上进行了良好的测试。

另一个易于使用的选项是在 Mastodon 实例上运行机器人,可以通过 ejabberd API 与之交互注册账号。您可以在此处找到所需的机器人软件。此机器人还有一些其他不错的功能,可以从 ejabberd 获取详情,因此即使使用其他账号集成方法,它也值得运行。

If you are setting up a new Mastodon instance, you might also consider managing the accounts via a separate LDAP database as explained in the official Mastodon documentation here. Please refer to our dedicated LDAP tutorial for the XMPP server part.

您可能能够调整 Prosody Sharkey 集成,或使用下面解释的新 Oauth2 透传功能。

目前处于实验阶段。

Prosody 服务器与 Mastodon 的集成可以通过 OAuth2 完成。为此需要新的 mod_auth_oauth_external 模块(它需要最近的每晚 Prosody 构建)。

首先,需要从 Mastodon 端注册一个新应用程序。这可以在 Mastodon → 设置 → 开发 → 新应用程序中完成。重定向 URI 并不重要。Prosody 需要 read:accounts 范围,仅此而已。

然后,需要将这几行添加到 Prosody 配置中:

1authentication = "oauth_external"
2oauth_external_token_endpoint = "https://mastodon.example/oauth/token"
3oauth_external_validation_endpoint = "https://mastodon.example/api/v1/accounts/verify_credentials"
4oauth_external_username_field = "account name"
5oauth_external_scope = "read:accounts"
6oauth_external_client_id = "Get client_id from https://mastodon.example/settings/applications"
7oauth_external_client_secret = "Get client_secret from https://mastodon.example/settings/applications"

Now people can login with this name: email\40example.com@xmpp.example.org, which is composed of the email address they are registered with on the Mastodon server (with the @ escaped as \40) and the domain of the XMPP server behind the second @. Hopefully this complex login name can be simplified in the future.