spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.76k stars 1.03k forks source link

Feature request: invite-only server #161

Closed thedanbob closed 5 years ago

thedanbob commented 5 years ago

mxisd has the ability to restrict registrations to only users invited by email. Described here: https://github.com/kamax-matrix/mxisd/blob/master/docs/features/registration.md This config was enough to get it working:

# vars.yml
matrix_synapse_enable_registration: true

# Same config as /_matrix/client/r0/user_directory/search
matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks:
  - |
    location /_matrix/client/r0/register/email/requestToken {
      resolver 127.0.0.11 valid=5s;
      proxy_pass http://matrix-mxisd:8090;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $remote_addr;
    }
# homeserver.yaml.j2
# Uncomment these lines:
registrations_require_3pid:
  - email

It would be nice to enable it with a single flag like the user_directory_search feature.

spantaleev commented 5 years ago

Since this is a more niche use case, It would probably be better if we make it possible and document it somewhere, instead of trying to magically enable it all with a single variable.

Looks like configuring registrations_require_3pid is not possible at the moment. We can introduce a new matrix_synapse_registrations_require_3pid variable for that.

thedanbob commented 5 years ago

Fair enough. That one change would make it much nicer than having to copy the whole homeserver.yaml.j2 just for two lines.

spantaleev commented 5 years ago

Sure!

If you'd like to work on it, please go ahead. If not, I will probably get to it at some point.

thedanbob commented 5 years ago

I'll open a pull request in a moment for the new homeserver.yaml option. I'll see about adding the nginx config block later as well.

T3chTobi commented 4 years ago

Update 26.01.2021: Use the code one comment below

An update for everybody that is searching for a solution. Use this code now:

matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks:
  - |
    location /_matrix/client/r0/register/email/requestToken {
      resolver 127.0.0.11 valid=5s;
      proxy_pass http://matrix-ma1sd:8090;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $remote_addr;
    }
T3chTobi commented 3 years ago

Another update:

matrix_nginx_proxy_proxy_matrix_additional_server_configuration_blocks:
  - |
    location /_matrix/client/r0/register/email/requestToken {
      resolver 127.0.0.11 valid=5s;
      set $backend "matrix-ma1sd:8090";
      proxy_pass http://$backend;
      proxy_set_header Host $host;
      proxy_set_header X-Forwarded-For $remote_addr;
    }