Skip to main content

A Diaspora* auth provider for Synapse

Project description

A diaspora authenticator for matrix synapse.

Installation

This package is easy to install from pypi:

Just run this command to install:

pip install synapse-diaspora-auth

Alternatively, to install from git:

pip install git+https://git.fosscommunity.in/necessary129/synapse-diaspora-auth.git

Configuration

In your homeserver.yaml file, the password_providers directive should look like this:

password_providers:
  - module: "diaspora_auth_provider.DiasporaAuthProvider"
    config:
      pepper: <pepper>
      database:
        engine: <db engine>
        name: "<database>"
        username: <db_user>
        password: <db_password>
        host: "127.0.0.1"
        port: <port>

You should get pepper from <DIASPORA_HOME>/database.yaml or from <DIASPORA_HOME>/initializers/devise.rb as config.pepper.

the engine should either be mysql or postgres

The port is usually 5432 for PostgreSQL and 3306 for MariaDB/MySQL

Database

synapse-diaspora-auth currently supports MySQL and PostgreSQL as the database engines.

PostgreSQL

It is recommended to create a seperate user for synapse in the postgres database, with read-only access to <database>.

To do that, first login to postgres as the root user:

sudo -u postgres psql <database>

then, run these commands:

CREATE user <db_user> WITH password '<db_password>';
GRANT CONNECT ON DATABASE <database> TO <db_user>;
GRANT SELECT ON users TO <db_user>;

MySQL

The commands are almost the same in MySQL:

login to MySQL as root:

sudo mysql -u root

Then run these queries:

CREATE user '<db_user>'@'localhost' WITH password '<db_password>';
GRANT SELECT ON <database>.users TO '<db_user>'@'localhost';

And you will be good to go!

Email Authentication

While this module helps in authenticating with diaspora, we need to set up mxisd for supporting authentication through email.

Installation

Follow the instructions here

Configuration & Setup

Follow this.

Basically, if you used the debian package, you just need to set up the matrix.domain first.

And then, add these lines to mxisd.yaml:

sql:
  enabled: true
  type: mysql
  connection: "//<HOST>/<DATABASE>?user=<USERNAME>&password=<PASSWORD>"
  identity:
    type: 'uid'
    query: "select (case when ?='email' then username else null end) as uid from users where email=?"

Where <HOST>, <DATABASE>, <USERNAME> and <PASSWORD> are your database host, diaspora database, user and password you created when you set up database for synapse-diaspora-auth

Now follow the steps given here. ie, forward the /_matrix/client/r0/login endpoint to mxisd and add

dns.overwrite.homeserver.client:
  - name: '<DOMAIN>'
    value: 'http://localhost:8008'

where <DOMAIN> is your matrix server name.

An Apache2 reverse proxy example is already provided here. An example nginx configuration would be this:

location /_matrix/client/r0/login {
    proxy_pass http://localhost:8090/_matrix/client/r0/login;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}

Make sure to put this above other matrix reverse proxy directives. And Congrats! You now have a competely integrated synapse - diaspora setup! :D

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

synapse-diaspora-auth-0.2.2.tar.gz (17.5 kB view details)

Uploaded Source

Built Distribution

synapse_diaspora_auth-0.2.2-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file synapse-diaspora-auth-0.2.2.tar.gz.

File metadata

  • Download URL: synapse-diaspora-auth-0.2.2.tar.gz
  • Upload date:
  • Size: 17.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.24.0 CPython/3.6.8

File hashes

Hashes for synapse-diaspora-auth-0.2.2.tar.gz
Algorithm Hash digest
SHA256 b2941e59eecf8553fbc570a654ec8cfc7cb44eb0fbc23f67a67c7134b60a5562
MD5 e24610739fca5b4c86c2d9449004c863
BLAKE2b-256 7498a878015d156f6366ad1165e16ef117a4c35834b38b6dc1279a14442055ab

See more details on using hashes here.

File details

Details for the file synapse_diaspora_auth-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: synapse_diaspora_auth-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 17.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.24.0 CPython/3.6.8

File hashes

Hashes for synapse_diaspora_auth-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ebb12b658ec71cb2c83b7003e6759b88b0d769871bdda49f73c0db8532d0e1af
MD5 f11c6a785d0abd28ef21232013aec373
BLAKE2b-256 30371e6aa95ae4c159daef40b256ed9642864daa4ac7cbae13217bd3def90f62

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page