Passer au contenu principal

Matrix

Il y a deux3 logiciels:

  • Synapse, Synapse, le serveur
  • Element, Element, le client web
  • EnMatrix-authentication-service, cours:

    • une 3emebrique brique:d'auth matrix-authentication-servicepour matrix 2.0 (element X)

    Les clients sont listé ici: https://matrix.org/clients/ Tous ne supporte pas le sso.

    Fluffy chat : Client android et ios plutot complet https://gitlab.com/famedly/fluffychat
    Fractal : Pour Linux: client GTK moderne (il y a son cousin en QT6, mais fractal est mieux)
    Element web : l'officiel, client.matrix.fede.re, il y a aussi l'app dans les apps store

    Synapse

    Synapse est installé via dnf. Sa config est dans /etc/synapse/homeserver.yaml

    Un example de config: https://github.com/matrix-org/synapse/blob/master/docs/sample_config.yaml

    Si il y a un problème de connexion à la base de donnée:

    • verifier si postgresql fonctionne
    • verifier que le fichier /var/lib/pgsql/data/pg_hba.conf contient
    host    synapse         synapse_user    ::1/128                 md5
    

    SSO (avec openid avant Matrix-authentication-service)

    oidc_providers:
      - idp_id: keycloak
        idp_name: "PPSfleet"
        issuer: "https://auth.ppsfleet.navy/realms/Ppsfleet"
        client_id: "synapse"
        client_secret: "****"
        scopes: ["openid", "profile"]
        allow_existing_users: true # important so it will not create new account
        user_mapping_provider:
          config:
            localpart_template: "{{ user.preferred_username }}"
            display_name_template: "{{ user.name }}"
        backchannel_logout_enabled: true # Optional
    

    Element

    Element est installé dans /srv/www/client.matrix.fede.re/current

    Matrix-authentication-service

    # root
    useradd matrix-auth -m -s /usr/bin/fish -d /srv/matrix-auth
    usermod -a -G synapse matrix-auth
    # matrix-auth
    npx syn2mas --command=advisor --synapseConfigFile=/etc/synapse/homeserver.yaml # check si migration possible
    ./mas-cli config generate > config.yaml
    
    # edition de la config...
    
    podman create --name postgre-17.2 \
        --restart=unless-stopped \
        -v /srv/matrix-auth/podman-data/postgres:/var/lib/postgresql/data:Z \
        -e POSTGRES_USER=matrix_auth_user \
        -e POSTGRES_PASSWORD=*** \
        -e POSTGRES_DB=matrix_auth \
        -p 127.0.0.1:9294:5432 \
        postgres:17.2-alpine
    
    ./mas-cli database migrate
    
    npx syn2mas --command migrate --synapseConfigFile /etc/synapse/homeserver.yaml --masConfigFile v12.0/config.yaml \
        --upstreamProviderMapping saml:01H8PKNWKKRPCBW4YGH1RWV279 \
        --upstreamProviderMapping oidc-keycloak:01H8PKNWKKRPCBW4YGH1RWV279 \
        --dryRun
    

    TODO:

    • create systemd service
    • le relier à synapse
    • migration from synapse
    • run podman at server boot

    Les bridges

    Les bridges sont installé via docker dans /srv/matrix-bridges/<bridge> avec l'user matrix-bridge

    Facebook

    Install

    https://docs.mau.fi/bridges/python/setup/docker.html?bridge=facebook

    Run

    Commande pour run le docker facebook:

    podman run --name matrix-facebook -d -p 127.0.0.1:29319:29319 -v /srv/matrix-bridges/facebook:/data:z dock.mau.dev/mautrix/facebook:latest
    

    Whatsapp

    podman stop matrix-whatsapp
    podman rename matrix-whatsapp matrix-whatsapp-old
    podman pull dock.mau.dev/mautrix/whatsapp:latest
    podman run --name matrix-whatsapp -d -p 127.0.0.1:29318:29318 -v /srv/matrix-bridges/whatsapp:/data:z dock.mau.dev/mautrix/whatsapp:latest
    

    Discord

    https://gitlab.com/mx-puppet/discord/mx-puppet-discord

    Instagram

    https://docs.mau.fi/bridges/general/docker-setup.html?bridge=instagram

    Le docker-compose.yml ne sert finalement pas.

    Docker network

    podman network create matrix-instagram
    

    Postgres

    Pas de sqlite :/

    podman run -d --name matrix-instagram-postgres -e POSTGRES_PASSWORD='*****' --network=matrix-instagram --restart always postgres:14
    

    Run

    podman run -d --name matrix-instagram --restart unless-stopped -v /srv/matrix-bridges/instagram:/data:z --network=matrix-instagram dock.mau.dev/mautrix/instagram:latest