diff --git a/docs/rdlist_functions.md b/docs/rdlist_functions.md index 3783f9e..3f3815e 100644 --- a/docs/rdlist_functions.md +++ b/docs/rdlist_functions.md @@ -1,6 +1,12 @@ # rdlist Functions +'rdlist' is a comprehensive list of child abuse related rooms on Matrix, it's a safety initiative led by the [Legion of Janitors](https://matrix.to/#/#janitors:glowers.club). + +This script can automatically load and block/purge abusive rooms from rdlist, making it **very easy** for inexperienced administrators to block this harmful content. + +If you are running a public server, please dm me at [@michael:perthchat.org](https://matrix.to/#/@michael:perthchat.org) and I can invite you to the 'Legion of Janitors' room. + *** ## Collect User Reports on local users in rdlist rooms diff --git a/docs/room_functions.md b/docs/room_functions.md index f7e893a..4e547f7 100644 --- a/docs/room_functions.md +++ b/docs/room_functions.md @@ -1,3 +1,4 @@ + #### Room Commands #### 50) **List details of a room.** diff --git a/docs/server_functions.md b/docs/server_functions.md new file mode 100644 index 0000000..677ebef --- /dev/null +++ b/docs/server_functions.md @@ -0,0 +1,84 @@ + +# Server Commands Guide + +This guide provides detailed steps for server-side operations that use the database and SSH. The commands and scripts are essential for handling specific server operations related to Matrix's Synapse server. + +## Table of Contents + +- [1. Delete and Block Specific Media](#1-delete-and-block-specific-media) +- [2. Purge Remote Media Repository](#2-purge-remote-media-repository) +- [3. Prepare Database for Copying Events of Multiple Rooms](#3-prepare-database-for-copying-events-of-multiple-rooms) + +--- + +### 1. Delete and Block Specific Media + +This command allows an admin to delete a specific media on their Matrix Synapse server and block it to prevent future accesses. + +#### Process Flow: + +1. Take `media_id` and remote server URL from the user. +2. Use SSH to query the Synapse PostgreSQL database for the associated `filesystem_id`. +3. Locate the target media files and thumbnails on the server's file system. +4. Zero out (empty) each file and make them immutable, meaning they cannot be modified or deleted. + +#### Example: + +For a media with ID `eDmjusOjnHyFPOYGxlrOsULJ`, the process would involve: + +```bash +$ ssh matrix.perthchat.org "... SQL query to get filesystem_id..." +$ ssh matrix.perthchat.org "... command to locate files ..." +$ ssh matrix.perthchat.org "true > ...path to file..." +$ ssh matrix.perthchat.org "chattr +i ...path to file..." +``` + +### 2. Purge Remote Media Repository + +This command purges the remote media repository for a certain range of days. +Process Flow: + + Ask the user for the range of days to purge. + Calculate the epoch timestamp for each day in the range. + Send a request to the Synapse server to purge media for that day. + Repeat for each day in the range. + +Example: +```bash +$ date --date '149 days ago' +%s +$ curl -X POST --header "Authorization: Bearer ACCESS_TOKEN" '... Matrix Synapse purge endpoint ...' +``` + +### 3. Prepare Database for Copying Events of Multiple Rooms + +This command prepares the PostgreSQL database to export events from multiple Matrix rooms. +Process Flow: + + Prompt for a list of room IDs. + Create a RAM disk on the server to store the export. + For each room ID: + Create a SQL query to extract room events. + Write the query to a file on the RAM disk. + Provide instructions for running the queries in the PostgreSQL container. + +Notes: + + This function is compatible with Spantaleev's Matrix deploy script. + Ensure proper permissions and consider the impact on the server when copying a large amount of data. + +Example: +```bash +# As the root user on the target server: +$ mkdir /matrix/postgres/data/ramdisk +$ ... commands to set up RAM disk ... +$ ... commands to generate SQL queries for each room ... +$ docker exec -it matrix-postgres /bin/bash +bash-5.0$ ... commands to execute SQL queries ... +``` + +After copying the data, ensure to clean up the RAM disk: + +```bash +$ rm -r /matrix/postgres/data/ramdisk/* +$ umount /matrix/postgres/data/ramdisk +``` \ No newline at end of file