Skip to content

Matrix Authentication Service (MAS)installation fails when migrating from oidc enabled server #4679

Description

@tiran133

Describe the bug
MAS installation fails when following config is used

To Reproduce
My vars.yml file looks like this:

matrix_authentication_service_enabled: true
matrix_authentication_service_migration_in_progress: true
matrix_synapse_oidc_enabled: true

The issue is the validation

- name: Fail if OpenID Connect is enabled for Synapse when auth is delegated to Matrix Authentication Service
ansible.builtin.fail:
msg: "When Synapse is delegating authentication to Matrix Authentication Service (`matrix_synapse_matrix_authentication_service_enabled: true`), it doesn't make sense to enable OpenID Connect (`matrix_synapse_oidc_enabled: true`), because it is not Synapse that is handling authentication. Synapse will refuse to start otherwise."
when: matrix_synapse_matrix_authentication_service_enabled and matrix_synapse_oidc_enabled

Expected behavior
The MAS installation should go through since it will not be activated because of matrix_authentication_service_migration_in_progress: true

Possible fix

validate_config.yml

- name: Fail if OpenID Connect is enabled for Synapse when auth is delegated to Matrix Authentication Service
  ansible.builtin.fail:
    msg: "When Synapse is delegating authentication to Matrix Authentication Service (`matrix_synapse_matrix_authentication_service_enabled: true`), it doesn't make sense to enable OpenID Connect (`matrix_synapse_oidc_enabled: true`), because it is not Synapse that is handling authentication. Synapse will refuse to start otherwise."
  when: matrix_synapse_matrix_authentication_service_enabled and matrix_synapse_oidc_enabled and not matrix_authentication_service_migration_in_progress

homeserver.yaml.j2

{% if matrix_synapse_matrix_authentication_service_enabled and not matrix_authentication_service_migration_in_progress %}
matrix_authentication_service:
  enabled: true
  endpoint: {{ matrix_synapse_matrix_authentication_service_endpoint | to_json }}
  secret: {{ matrix_synapse_matrix_authentication_service_secret | to_json }}
{% endif %}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions