Matrix Cheatsheet

This is a quick cheatsheet for doing things in matrix. For simplicity I opted to go with Postgresql & a pip install for my environment. Adjust accordingly for your installation needs.

UPDATE MATRIX

Here is my updating script. Adjust accordingly.

    #!/bin/bash
    # Update certs
    systemctl start httpd
    /usr/bin/certbot renew --apache --force-renewal
    cp /etc/letsencrypt/live/matrix.schotty.com/fullchain.pem /opt/synapse/fullchain.pem
    cp /etc/letsencrypt/live/matrix.schotty.com/privkey.pem /opt/synapse/privkey.pem
    systemctl stop httpd
    # Change python environment
    source /opt/synapse/env3/bin/activate
    # Stop service
    systemctl stop matrix-synapse
    # Update python modules
    pip3 install --upgrade pip
    pip3 install --upgrade matrix-synapse[all]
    # Start service
    systemctl start matrix-synapse

CHECK CURRENT MATRIX-SYNAPSE VERSION

    curl -kv https://server.tld:port/_matrix/client/versions 2>&1 | grep "Server:"

RESET USER'S PASSWORD MANUALLY

The $DB_NAME and $DB_USER can be found in your "homeserver.yaml" configuration file.

GENERATE HASH

Go to where you installed your environment.

    cd /opt/matrix/
    cd bin
    ./hash_password

The program will ask you to enter the password and then to confirm. The has that is returned will be needed in the next step, updating it in the database.

UPDATE HASH

Log into your DB

    psql -d $DB_NAME -U $DB_USER

Update hash

    synapse=> UPDATE users SET password_hash='$HASH' WHERE name='@USER:HOST.TLD';
    <CTL-d> to quit