Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
matrix:conduwuit [2025/03/11 08:16] – willy | matrix:conduwuit [2025/03/11 08:45] (current) – [Reverse proxy] willy | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Conduwuit ====== | ====== Conduwuit ====== | ||
- | [[https:// | + | [[https:// |
- | I will show you also how to install Element Web app which is a nice companion for web access everywhere. | + | ===== Installation ===== |
- | + | ||
- | ===== Installation | + | |
Installation instructions: | Installation instructions: | ||
Line 22: | Line 20: | ||
cd bin | cd bin | ||
wget https:// | wget https:// | ||
- | </ | ||
- | |||
- | ===== Installation of Element Web app ===== | ||
- | |||
- | Element Web app is a great web based UI for Matrix, that you can pair to your instance. | ||
- | |||
- | Again installing bare-metal is the way to go. See [[https:// | ||
- | |||
- | Download latest release tarball from [[https:// | ||
- | <code bash> | ||
- | su - conduwuit | ||
- | wget https:// | ||
- | tar xvf element-<< | ||
- | ln -s element-<< | ||
</ | </ | ||
Line 64: | Line 48: | ||
You are now ready for testing your installation. | You are now ready for testing your installation. | ||
- | ===== Configuration of Element Web App ===== | ||
- | |||
- | Rename the file called **config.sample.json** to **config.json** inside the // | ||
- | <code bash> | ||
- | cd / | ||
- | cp config.sample.json / | ||
- | ln -s / | ||
- | </ | ||
- | |||
- | At the very least perform the following edits: | ||
- | < | ||
- | " | ||
- | " | ||
- | " | ||
- | " | ||
- | }, | ||
- | " | ||
- | " | ||
- | </ | ||
- | |||
- | at the beginning of the file. I suggest to disable both custom URLs and guests, to avoid your web instance to be used too openly. Please note that this **does not mean** that your instance will be used: Element X is a javascript app that works in the browser of the use anyway. | ||
===== Manual startup ===== | ===== Manual startup ===== | ||
- | to run Conduwuit server, run the following command as **conduwuit** user: | + | To run Conduwuit server, run the following command as **conduwuit** user: |
<code bash> | <code bash> | ||
/ | / | ||
Line 119: | Line 82: | ||
server { | server { | ||
server_name chat.mydomain.com; | server_name chat.mydomain.com; | ||
- | listen 8443 ssl; # external access | + | |
- | listen 443 ssl; # internal access | + | |
+ | | ||
+ | listen 443 ssl; | ||
+ | http2 on; | ||
access_log / | access_log / | ||
error_log / | error_log / | ||
- | location / { | + | location / { # this is to provide a web client, see the ElementWeb page... |
root / | root / | ||
} | } | ||
- | location ~ ^(/_matrix|/_synapse/client) { | + | location ~ ^(/ |
- | | + | |
- | proxy_pass | + | proxy_pass |
- | # | + | proxy_set_header |
- | proxy_set_header X-Forwarded-For $remote_addr; | + | proxy_set_header |
- | proxy_set_header X-Forwarded-Proto $scheme; | + | proxy_set_header |
- | proxy_set_header Host $host; | + | |
- | | + | proxy_read_timeout |
- | client_max_body_size 30M; | + | proxy_http_version |
- | proxy_read_timeout 10m; | + | |
- | proxy_http_version 1.1; | + | |
} | } | ||
+ | # This is needed for federation | ||
location / | location / | ||
- | return 200 ' | + | |
- | types { } default_type " | + | add_header |
+ | | ||
} | } | ||
+ | # Enable snail sync for Element X and client access info in general | ||
location / | location / | ||
- | return 200 ' | + | |
- | types { } default_type " | + | add_header |
- | add_header " | + | |
} | } | ||
+ | include com.mydomain/ | ||
} | } | ||
</ | </ | ||
+ | In the above file i have already introduced the location (/) of the ElementWeb client, the installation is described [[matrix: | ||
Line 180: | Line 146: | ||
You can run any admin command later on directly in your favorite Matrix client in the admin chat. You might need the terminal only if you accidentally lock your user out of the instance. | You can run any admin command later on directly in your favorite Matrix client in the admin chat. You might need the terminal only if you accidentally lock your user out of the instance. | ||
+ | |||
===== Autostart ===== | ===== Autostart ===== | ||
Line 209: | Line 176: | ||
rc-update add conduwuit default | rc-update add conduwuit default | ||
</ | </ | ||
- | |||
- | If you use the telegram bridge described below, also add the following: | ||
- | <file - / | ||
- | # | ||
- | # Copyright 2025 Gentoo Authors | ||
- | # Distributed under the terms of the GNU General Public License v2 | ||
- | |||
- | name=" | ||
- | description=" | ||
- | pidfile="/ | ||
- | command_background=true | ||
- | command="/ | ||
- | command_args="/ | ||
- | command_user=" | ||
- | output_log="/ | ||
- | output_err="/ | ||
- | |||
- | start_pre() { | ||
- | cd / | ||
- | } | ||
- | |||
- | depend() { | ||
- | need net | ||
- | } | ||
- | </ | ||
- | |||
- | Make it executable and add to the proper runlevel: | ||
- | <code bash> | ||
- | chmod +x / | ||
- | rc-update add conduwuit-telegram default | ||
- | </ | ||
- | |||
- | If you use the Whatsapp bridge described below, also add the following: | ||
- | <file - / | ||
- | # | ||
- | # Copyright 2025 Gentoo Authors | ||
- | # Distributed under the terms of the GNU General Public License v2 | ||
- | |||
- | name=" | ||
- | description=" | ||
- | pidfile="/ | ||
- | command_background=true | ||
- | command="/ | ||
- | command_args="/ | ||
- | command_user=" | ||
- | output_log="/ | ||
- | output_err="/ | ||
- | |||
- | start_pre() { | ||
- | cd / | ||
- | } | ||
- | |||
- | depend() { | ||
- | need net | ||
- | } | ||
- | </ | ||
- | |||
- | Make it executable and add to the proper runlevel: | ||
- | <code bash> | ||
- | chmod +x / | ||
- | rc-update add conduwuit-whatsapp default | ||
- | </ | ||
- | |||
- | ===== Installing the Telegram Bridge ===== | ||
- | |||
- | The Mautrix Telegram bridge is currently the best (only?) option. More info | ||
- | [[https:// | ||
- | |||
- | Create subfolder and Python venv inside (see [[gentoo: | ||
- | <code bash> | ||
- | su - conduwuit | ||
- | mkdir mautrix-telegram | ||
- | cd mautrix-telegram | ||
- | # Enable PIP like in the link above | ||
- | # - create ~/ | ||
- | # - add ~/ | ||
- | python -m venv . # Note the dot at the end! | ||
- | source ./ | ||
- | # Now flip include-system-site-packages = true in pyvenv.cfg | ||
- | # Install: | ||
- | pip install --upgrade mautrix-telegram[all] | ||
- | </ | ||
- | |||
- | You need to create API keys to connect to Telegram. Go to [[https:// | ||
- | Grab the example config file [[https:// | ||
- | <code bash> | ||
- | wget -O / | ||
- | mv / | ||
- | </ | ||
- | |||
- | This file is huge, here are the most relevant changes needed: | ||
- | <file - config.yaml> | ||
- | address: https:// | ||
- | domain: chat.mydomain.com | ||
- | verify_ssl: true | ||
- | database: sqlite:/ | ||
- | telegram: | ||
- | # Get your own API keys at https:// | ||
- | api_id: << put your id here >> | ||
- | api_hash: << put your hash >> | ||
- | # (Optional) Create your own bot at https:// | ||
- | bot_token: disabled | ||
- | permissions: | ||
- | " | ||
- | " | ||
- | " | ||
- | | ||
- | encryption: | ||
- | # Whether to enable encryption at all. If false, the bridge will not function in encrypted rooms. | ||
- | allow: true | ||
- | |||
- | + double puppeting | ||
- | </ | ||
- | More details on configuration can be found [[https:// | ||
- | |||
- | I choose to use SQLite as database because i only have a few users and don't want to spin a PostreSQL instance for that. | ||
- | |||
- | At this point you need to register the bridge: | ||
- | <code bash> | ||
- | python -m mautrix_telegram -g -c / | ||
- | </ | ||
- | |||
- | This step will create a **registration.yaml** file that you need to perform the registration of the bridge as an appservice in Conduwuit. Conduwuit is different from Synapse (the most common Matrix server) because the appservice must be registered from the admin chat with the following command: | ||
- | < | ||
- | !admin appservices register << shift+enter >> | ||
- | ``` << shift+enter >> | ||
- | [ ... copy here the content of registration.yaml ... ] | ||
- | ``` << enter >> | ||
- | </ | ||
- | |||
- | When you see **<< shift enter >>** you need to press those two keys in order to create a new line in the same command. The three **```** (backthicks) are the markdown token to create a code block. | ||
- | The **<< autogenrated >>** are secret strings found in the // | ||
- | |||
- | The chat should reply with a message like: | ||
- | < | ||
- | Appservice registered with ID: telegram | ||
- | </ | ||
- | |||
- | More details on registering the appservice can be found [[https:// | ||
- | |||
- | You need to create the **telegrambot** user, again from the admin chat: | ||
- | < | ||
- | !admin users create-user telegrambot | ||
- | </ | ||
- | |||
- | Good! Now you can run the bridge: | ||
- | <code bash> | ||
- | python -m mautrix_telegram -c / | ||
- | </ | ||
- | |||
- | If all is well, your bridge should be up and running now. | ||
- | |||
- | To login into telegram you need to: | ||
- | * Start a chat with telegrambot: | ||
- | * type " | ||
- | * when prompted, type your telegram registered phone number with country code | ||
- | * when prompted, type the code you received in telegram to authorize the login | ||
- | * when prompted, type your 2FA password (if enabled in telegram) | ||
- | |||
- | You will start seeing your telegram chats appear in Matrix now! It takes time, even hours, and also most chats will only appear the first time the other person messages you. | ||
- | |||
- | **Note:** Telegram does not allow registration from third party clients, so to register a **new** telegram account, you must use Telegram official app. | ||
- | |||
- | General documentation on the Telegram bot can be found [[https:// | ||
- | |||
- | To manage animated sticker [[https:// | ||
- | |||
- | |||
- | ===== Installing the Whatsapp Bridge ===== | ||
- | |||
- | |||
- | <code bash> | ||
- | su - conduwuit | ||
- | mkdir mautrix-whatsapp | ||
- | cd mautrix-whatsapp | ||
- | wget -O mautrix-whatsapp.zip ' | ||
- | unzip mautrix-whatsapp.zip | ||
- | </ | ||
- | |||
- | Generate config and edit: | ||
- | <code bash> | ||
- | ./ | ||
- | mv config.yaml / | ||
- | </ | ||
- | |||
- | edit it... | ||
- | < | ||
- | network: | ||
- | displayname_template: | ||
- | | ||
- | database: | ||
- | type: sqlite3-fk-wal | ||
- | uri: file:/ | ||
- | |||
- | homeserver: | ||
- | address: https:// | ||
- | domain: chat.mydomain.com | ||
- | | ||
- | permissions: | ||
- | " | ||
- | " | ||
- | " | ||
- | |||
- | backfill: | ||
- | enabled: true # to populate chats with older messages | ||
- | | ||
- | encryption: | ||
- | # Whether to enable encryption at all. If false, the bridge will not function in encrypted rooms. | ||
- | allow: true | ||
- | |||
- | + double puppeting | ||
- | |||
- | </ | ||
- | |||
- | Note that backfill is disabled by default, you need to enable it to see older messages. Also note that messages **cannot** be backfilled for already created rooms, so don't forget to enable backfill before the first start! | ||
- | |||
- | Generate the appservice files: | ||
- | <code bash> | ||
- | ./ | ||
- | </ | ||
- | |||
- | This step will create a **registration.yaml** file that you need to perform the registration of the bridge as an appservice in Conduwuit. Conduwuit is different from Synapse (the most common Matrix server) because the appservice must be registered from the admin chat with the following command: | ||
- | < | ||
- | !admin appservices register << shift+enter >> | ||
- | ``` << shift+enter >> | ||
- | id: whatsapp | ||
- | [ ... copy the content of the appservice.yaml .. ] | ||
- | ``` << enter >> | ||
- | </ | ||
- | |||
- | When you see **<< shift enter >>** you need to press those two keys in order to create a new line in the same command. The three **```** (backthicks) are the markdown token to create a code block. | ||
- | |||
- | The chat should reply with a message like: | ||
- | < | ||
- | Appservice registered with ID: whatsapp | ||
- | </ | ||
- | |||
- | More details on registering the appservice can be found [[https:// | ||
- | |||
- | The **whatsappbot** user should have been created automatically. | ||
- | |||
- | Good! Now you can run the bridge: | ||
- | <code bash> | ||
- | / | ||
- | </ | ||
- | |||
- | If all is well, your bridge should be up and running now. | ||
- | |||
- | To login into whatsapp you need to: | ||
- | * Start a chat with whatsappbot: | ||
- | * type "login qr" | ||
- | * Scan the QR code with your whatsapp on your phone. | ||
- | |||
- | You could install whatsapp on a Android Virtual Emulator, but it's discouraged and could lead to a ban of your account. | ||
- | |||
- | **Note:** if your usernames do not get popupated, you should do a //search username// in the whatsappbot chat. | ||