Update docs/configuration/howto_ejabberd.md

This commit is contained in:
Norm 2022-07-02 23:10:07 -04:00
parent 9cc445b2ee
commit 57e3b90e67
2 changed files with 16 additions and 16 deletions

View file

@ -1,7 +1,7 @@
# How to activate Akkoma in-database configuration # How to activate Akkoma in-database configuration
## Explanation ## Explanation
The configuration of Akkoma (and previously Pleroma) has traditionally been managed with a config file, e.g. `config/prod.secret.exs`. This method requires a restart of the application for any configuration changes to take effect. We have made it possible to control most settings in the AdminFE interface after running a migration script. The configuration of Akkoma (and Pleroma) has traditionally been managed with a config file, e.g. `config/prod.secret.exs`. This method requires a restart of the application for any configuration changes to take effect. We have made it possible to control most settings in the AdminFE interface after running a migration script.
## Migration to database config ## Migration to database config

View file

@ -1,29 +1,29 @@
# Configuring Ejabberd (XMPP Server) to use Pleroma for authentication # Configuring Ejabberd (XMPP Server) to use Akkoma for authentication
If you want to give your Pleroma users an XMPP (chat) account, you can configure [Ejabberd](https://github.com/processone/ejabberd) to use your Pleroma server for user authentication, automatically giving every local user an XMPP account. If you want to give your Akkoma users an XMPP (chat) account, you can configure [Ejabberd](https://github.com/processone/ejabberd) to use your Akkoma server for user authentication, automatically giving every local user an XMPP account.
In general, you just have to follow the configuration described at [https://docs.ejabberd.im/admin/configuration/authentication/#external-script](https://docs.ejabberd.im/admin/configuration/authentication/#external-script). Please read this section carefully. In general, you just have to follow the configuration described at [https://docs.ejabberd.im/admin/configuration/authentication/#external-script](https://docs.ejabberd.im/admin/configuration/authentication/#external-script). Please read this section carefully.
Copy the script below to suitable path on your system and set owner and permissions. Also do not forget adjusting `PLEROMA_HOST` and `PLEROMA_PORT`, if necessary. Copy the script below to suitable path on your system and set owner and permissions. Also do not forget adjusting `AKKOMA_HOST` and `AKKOMA_PORT`, if necessary.
```bash ```bash
cp pleroma_ejabberd_auth.py /etc/ejabberd/pleroma_ejabberd_auth.py cp akkoma_ejabberd_auth.py /etc/ejabberd/akkoma_ejabberd_auth.py
chown ejabberd /etc/ejabberd/pleroma_ejabberd_auth.py chown ejabberd /etc/ejabberd/akkoma_ejabberd_auth.py
chmod 700 /etc/ejabberd/pleroma_ejabberd_auth.py chmod 700 /etc/ejabberd/akkoma_ejabberd_auth.py
``` ```
Set external auth params in ejabberd.yaml file: Set external auth params in ejabberd.yaml file:
```bash ```bash
auth_method: [external] auth_method: [external]
extauth_program: "python3 /etc/ejabberd/pleroma_ejabberd_auth.py" extauth_program: "python3 /etc/ejabberd/akkoma_ejabberd_auth.py"
extauth_instances: 3 extauth_instances: 3
auth_use_cache: false auth_use_cache: false
``` ```
Restart / reload your ejabberd service. Restart / reload your ejabberd service.
After restarting your Ejabberd server, your users should now be able to connect with their Pleroma credentials. After restarting your Ejabberd server, your users should now be able to connect with their Akkoma credentials.
```python ```python
@ -34,18 +34,18 @@ from base64 import b64encode
import logging import logging
PLEROMA_HOST = "127.0.0.1" AKKOMA_HOST = "127.0.0.1"
PLEROMA_PORT = "4000" AKKOMA_PORT = "4000"
AUTH_ENDPOINT = "/api/v1/accounts/verify_credentials" AUTH_ENDPOINT = "/api/v1/accounts/verify_credentials"
USER_ENDPOINT = "/api/v1/accounts" USER_ENDPOINT = "/api/v1/accounts"
LOGFILE = "/var/log/ejabberd/pleroma_auth.log" LOGFILE = "/var/log/ejabberd/akkoma_auth.log"
logging.basicConfig(filename=LOGFILE, level=logging.INFO) logging.basicConfig(filename=LOGFILE, level=logging.INFO)
# Pleroma functions # Akkoma functions
def create_connection(): def create_connection():
return http.client.HTTPConnection(PLEROMA_HOST, PLEROMA_PORT) return http.client.HTTPConnection(AKKOMA_HOST, AKKOMA_PORT)
def verify_credentials(user: str, password: str) -> bool: def verify_credentials(user: str, password: str) -> bool:
@ -124,7 +124,7 @@ def write(result):
if __name__ == "__main__": if __name__ == "__main__":
logging.info("Starting pleroma ejabberd auth daemon...") logging.info("Starting akkoma ejabberd auth daemon...")
while True: while True:
try: try:
read() read()
@ -133,4 +133,4 @@ if __name__ == "__main__":
"Error while processing data from ejabberd %s", str(e)) "Error while processing data from ejabberd %s", str(e))
pass pass
``` ```