Migrate Synapse authentication to Matrix Authentication Service

A planning guide for moving an existing Synapse homeserver's user authentication to Matrix Authentication Service with syn2mas, covering readiness, password hashing, IdP mapping, dry runs and downtime.

On this page

Moving Synapse logins to Matrix Authentication Service: what the move involves

If your hand-built Synapse signs users in with local passwords or an identity provider and you are weighing a move of authentication to Matrix Authentication Service (MAS), the short answer is this: syn2mas moves existing accounts and their password hashes into MAS, but only when the server passes its readiness checks and your team accepts a downtime window. Most of the work is checking and planning, not running the tool. The actual migration is a short run at the end, once the configuration, the database and the identity provider mapping are settled. Before committing, confirm that your Synapse database is PostgreSQL, because MAS supports only PostgreSQL and the migration tool reads only from a PostgreSQL Synapse database. A SQLite deployment needs its database moved first, which is a separate project.

The readiness checks are where most migrations stop. Synapse configured with SAML2, LDAP or a custom password provider blocks the path, because MAS does not support SAML and does not read LDAP directly. If you rely on those today, decide whether an upstream OpenID Connect provider can take over sign-in, or whether a bridge such as Dex is needed for SAML or LDAP. Ask your identity team to confirm which login methods are live, which user populations depend on them, and whether any service accounts authenticate through Synapse. Plan the password hash settings too: Synapse hashes passwords with bcrypt while MAS defaults to argon2id, so the migrated passwords must keep a bcrypt scheme with the same pepper, if one is set. Confirm those values before anyone runs the tool.

Treat the downtime window and the reversal limits as hard constraints. The real migration requires homeserver downtime and is not easily reversible once MAS is started, so the dry run is the decision point. Running syn2mas migrate --dry-run performs a full import and then empties the MAS database, which gives you a representative timing and a chance to catch mapping errors. Plan your rollback path before MAS starts: the tool never writes to the Synapse database, so rolling back before MAS is started does not require restoring Synapse, but any rollback after MAS takes over logins is a different exercise. Budget the window, communicate it to users and confirm backups of both databases before the cutover.

Which Synapse authentication features map to MAS and which do not

This table compares the authentication features in a Synapse configuration with their Matrix Authentication Service equivalents, and flags the features that block migration. Read each row against your current homeserver.yaml: a blocker needs a bridge or a redesign before you run syn2mas, while a mapped feature needs its upstream provider and password settings confirmed.

Synapse featureMAS equivalentMigration note
Local password loginLocal password accounts stored in MAS after importPasswords move as existing bcrypt hashes. Configure a version 1 bcrypt scheme with unicode_normalization set to true in MAS before the import.
Password hashing with bcrypt and optional pepperargon2id default, with a bcrypt scheme option for migrated hashesSet the same pepper in MAS if Synapse uses one. Without it, migrated users cannot sign in. Confirm the exact configuration keys in the MAS migration documentation.
OIDC providers (oidc_providers)Upstream OpenID Connect providers such as Keycloak, Microsoft Entra ID, Google and AuthentikUsually the most direct mapping. Map each provider's subject claim and user attributes to MAS, and confirm provider-specific behavior in the MAS upstream identity provider documentation.
SAML2 (saml2_config)Not supported by MASBlocker. Put a bridge such as Dex between the SAML identity provider and MAS, or redesign sign-in before migrating. Test the bridge with real accounts.
CASNot supported by MASBlocker. Confirm whether your CAS server can front an OIDC provider, or plan a replacement identity flow before the migration window.
LDAP password providerNot supported directly by MASBlocker. Route LDAP through an OIDC-capable bridge or identity provider, such as Dex or an LDAP-backed Keycloak or Authentik, and test group and attribute mapping.
Custom password providersNot supported by MASBlocker. Custom Python modules have no direct MAS equivalent. Replace the logic with an upstream identity provider or a redesigned flow before running the dry run.
Pepper and hash settings in homeserver.yamlScheme and pepper settings in the MAS password configurationRecord the exact values from Synapse now. Losing the pepper value makes every migrated password unusable.

Which documented tools handle the syn2mas import

The syn2mas import is handled by a small set of documented tools and one reference guide. Each card below covers one tool or source, and together they set the order of work: check first, rehearse the import, then configure the upstream identity provider before cutover.

mas-cli syn2mas check

Run mas-cli syn2mas check to find configuration problems before any downtime. It reads your Synapse and MAS settings and reports blockers such as SAML, LDAP or custom password providers, which the migration does not carry over. It runs without stopping Synapse, so you can repeat it while you fix issues. Confirm the exact subcommand flags against the mas-cli version you install, since options can change between releases.

MAS migration docs

syn2mas migrate with dry run

Run syn2mas migrate --dry-run against a copy of your production database to perform a full import, then review the timing. The tool empties the MAS database afterward, so the run leaves no residue, and the duration gives you a representative figure for the real downtime window. Run it at least once against a recent copy of the database, and repeat it if the Synapse data changes significantly.

PostgreSQL-only source reads

The syn2mas tool reads only from a PostgreSQL Synapse database, and MAS itself supports only PostgreSQL. If your homeserver still runs on SQLite, plan the database move before authentication work, because the import will not start from SQLite. Check your database engine and version as the first readiness item, and keep a current backup before any run.

Read-only handling of Synapse data

syn2mas never writes to the Synapse database, so you can stop it at the rollback point. If you have not started MAS yet, rolling back needs no Synapse restore. Once MAS serves logins, this safety no longer applies to the migrated accounts, so decide the rollback point before cutover and record it in the runbook.

MAS upstream identity provider configuration

MAS delegates sign-in to upstream OpenID Connect providers such as Keycloak, Microsoft Entra ID, Google or Authentik. Configure the upstream provider and its claim mapping in MAS before cutover, so migrated users can sign in through the same identity. Because MAS does not support SAML, a bridge such as Dex is needed for SAML sources. Verify the provider settings against the upstream identity provider documentation.

Upstream provider docs

How password hashes and upstream identity mapping carry over

Synapse stores local passwords as bcrypt hashes, while MAS defaults to argon2id for new passwords. The migrated hashes therefore have to be read with a bcrypt scheme in MAS, not with the default. The syn2mas import carries the hashes across unchanged, so the MAS side must be configured to accept them before users sign in. Check the password settings in your Synapse configuration first, because they decide what the MAS configuration has to match.

  • Hash scheme: MAS needs a version 1 bcrypt scheme with unicode_normalization: true so that passwords containing non-ASCII characters verify correctly.
  • Pepper: if Synapse sets a password_config pepper, the same value must be configured in MAS. Copy it exactly, including any whitespace, from the secret store that holds it.
  • Lockout risk: a mismatch in the scheme, normalization or pepper does not produce an obvious error at import time. Users fail to sign in, and the failure looks like a wrong password.
  • Test accounts: before cutover, sign in with a sample of accounts that cover ASCII and non-ASCII passwords, using the staging copy from the dry run.
  • Password changes: confirm with the MAS documentation how password changes are handled after migration, and confirm whether your deployment keeps local password login at all.

Before the work starts, collect the password_config block, the pepper location, and the Synapse version, then confirm the matching settings in the MAS migration guide.

The migration sequence from readiness check to decommissioning Synapse auth

This sequence moves a Synapse homeserver's sign-in from its built-in password and SSO settings to Matrix Authentication Service without losing accounts, with each step closed by a check that gates the next. It produces a tested cutover plan, a live MAS handling sign-in, and a Synapse configuration with the old auth settings retired.

  1. Inventory Synapse auth settings and database access

    The platform team lists every authentication-related setting in the Synapse configuration, including password hashing, password providers, OIDC, SAML2 and CAS blocks, registration options, and any pepper value. They also confirm that Synapse uses PostgreSQL, because MAS and the syn2mas tool read only from PostgreSQL, and that the team holds a database account with read access for the migration. Done means a written inventory signed off by the security owner, with each auth source mapped to a planned upstream identity provider or a decision to drop it.

  2. Run syn2mas check against the live server

    Run mas-cli syn2mas check against the Synapse database and configuration. According to the MAS migration documentation, this check reports configuration problems without stopping Synapse, so users keep signing in while the team works. Any SAML, LDAP or custom password provider found at this stage blocks the migration until it is removed, replaced by an OpenID Connect provider, or bridged. Done means the check reports no blocking findings and the team has recorded each warning with an owner.

  3. Rehearse with syn2mas migrate --dry-run on a database copy

    Restore a recent copy of the Synapse PostgreSQL database into a separate environment and run mas-cli syn2mas migrate --dry-run against it. The dry run performs a full import and then empties the MAS database, so it gives a representative timing for the real window without changing production. Record the elapsed time, any errors, and the count of imported users, then compare the user count with Synapse. Done means a rehearsal log that the team uses to size the downtime window and confirm the password hash settings work for a sample of test accounts.

  4. Configure MAS and upstream providers in a parallel environment

    Deploy MAS with PostgreSQL in a parallel environment, not the production homeserver. Set the password scheme to a version 1 bcrypt configuration with unicode normalization enabled, and add the same pepper if Synapse uses one, so existing passwords verify. Register each upstream OpenID Connect provider, such as Keycloak, Microsoft Entra ID, Google or Authentik, and map its claims to Matrix user IDs. Confirm the mapping with test users from each provider. Done means test accounts from every upstream sign in to the parallel MAS and receive the expected Matrix identifiers.

  5. Schedule the downtime window and run the real migration

    Announce the planned downtime window to users, stop Synapse so the database is no longer written, and run the real syn2mas migration against the production database. The team should treat this step as not easily reversible, because the migration writes to the MAS database and the process requires homeserver downtime. Confirm the migration completes with no errors and that the user counts match the earlier rehearsal. Done means a completed migration log and an explicit go decision recorded by the change owner.

  6. Start MAS and test client sign-in

    Start MAS and point Synapse at it, then test sign-in with a representative set of accounts: a local password user, one account per upstream provider, and an administrator. Check token refresh, device list visibility, room access and a message send from a Matrix client. The MAS documentation should be read to confirm the exact start order and configuration keys for your version before this step. Done means each test account signs in, and the team has recorded the results in the cutover log.

  7. Retire old Synapse password and SSO settings

    After a stable period agreed by the operations owner, remove the superseded Synapse password provider, OIDC, SAML2 and CAS settings from the homeserver configuration so that authentication is handled only by MAS. Keep a dated copy of the old configuration in the change record, because rolling back after MAS has started may require restoring the database. Review the registration and admin settings again against the hardening guidance. Done means the Synapse configuration reflects a single authentication source and the change record links the inventory, rehearsal log and cutover results.

How the syn2mas cutover moves users from Synapse to MAS

The cutover starts with a readiness check that runs against the live Synapse setup without stopping it. A dry run then imports a copy of the PostgreSQL database into MAS, which shows the real timing before anything is changed. During the downtime window, the real import runs, and MAS takes over login through the upstream identity provider. The Synapse database is never written to by syn2mas, so until MAS starts, the rollback decision point needs no Synapse restore.

Phases of the syn2mas cutover, with the Synapse database left untouched throughout.

What drives the cost and duration of the auth migration

This table compares each driver of the Synapse to MAS migration with how it changes effort and who carries the work. Read it as a checklist for the scope you send when requesting a quote. The main takeaway is that blockers such as SAML, LDAP and custom password providers, plus the length of the approved downtime window, will shape the project more than the raw user count.

DriverWhy it changes effortHow to keep it downOne-time or recurring
User count and Synapse database sizeThe syn2mas import scales with the number of accounts and stored auth data, which sets the length of the dry run and the cutover window.Clean up deactivated or stale accounts before the rehearsal, and confirm the expected import time with a dry run on a copy.One-time
Number of auth methods in useOne upstream OpenID Connect provider is a bounded mapping task. Several providers, or password-based accounts mixed with SSO, add mapping and testing work.Inventory every login path in Synapse configuration before scoping, and retire unused methods first.One-time
Blockers: SAML, LDAP or custom password providersMAS does not support SAML and recommends a bridge such as Dex for SAML or LDAP. Custom password providers need a replacement design, which can add the largest share of work.Run the readiness check early, then decide whether to bridge, replace or retire each blocker before committing to a date.One-time, with bridge upkeep recurring
Password hashing and pepper handlingSynapse uses bcrypt while MAS defaults to argon2id, so the bcrypt scheme, unicode normalization and any pepper must be configured and verified against real test logins.Collect the existing hash settings and pepper location in advance, and store the pepper through your secrets process.One-time
Upstream providers to configure in MASEach upstream identity provider needs its own client registration, redirect URIs, claim mapping and test accounts in the target environment.Ask the identity team to prepare client registrations before the build starts, and keep a single mapping document.One-time setup, recurring maintenance
Client and bot testing depthTesting sign-in across each official client, mobile apps, bots and bridges takes longer as the list grows, and bridges often hold their own credentials.Agree a fixed test matrix in writing, and limit deep testing to the clients your users actually run.One-time
Approved downtime windowThe real migration requires homeserver downtime and is not easily reversible, so a short approved window constrains rehearsal and cutover planning.Get the window approved early and rehearse the full sequence against it using the dry run results.One-time
PostgreSQL install or upgrade firstMAS and syn2mas require PostgreSQL, and syn2mas reads only from a PostgreSQL Synapse database. A SQLite or outdated PostgreSQL setup adds a prerequisite project.Confirm the current database engine and version before scoping, and plan any database move as a separate step.One-time
MAS and IdP upgrades and maintenanceOnce live, MAS releases, IdP updates and certificate or client secret rotation require scheduled testing and change control.Agree a support retainer scope in the quote, and document the upgrade checks used during the project.Recurring

What usually goes wrong during a Synapse to MAS auth migration

Most failed Synapse to MAS migrations trace back to a small set of decisions made late or skipped. The cards below cover the readiness gaps, password hashing mismatches, identity mapping errors, rehearsal gaps, database assumptions and client login paths that tend to surface during cutover. Each card names the check to run before the downtime window opens.

Late discovery of SAML, LDAP or custom providers

Synapse deployments often gained a SAML2 integration, an LDAP password provider or a custom password provider years ago and the configuration is easy to forget. These do not carry over to MAS, which does not support SAML and expects an upstream OpenID Connect provider, with a bridge such as Dex for SAML or LDAP. Run mas-cli syn2mas check against the live configuration early, and inventory every saml2_config, ldap and password provider block in homeserver.yaml before scheduling anything.

MAS migration docs

Password hash and pepper mismatch

Synapse stores passwords as bcrypt hashes, while MAS defaults to argon2id. Migrated passwords therefore need a version 1 bcrypt scheme with unicode_normalization: true, and the same pepper if Synapse uses one. A mismatch does not break the migration itself, but users discover it at their first login, so test a known account's password against the migrated MAS database before reopening the service.

Identity claim mapping links wrong accounts

When MAS links existing Matrix users to upstream OIDC identities, the claim used for matching decides who gets whose account. A claim that is not unique, mutable or verified can attach a user to someone else's Matrix ID, or create duplicate accounts. Confirm with the identity team which claim is stable and verified in your provider, map a sample of accounts in a test environment, and review the linked identities before go-live.

Upstream IdP docs

Dry run skipped, downtime overruns

The real syn2mas migration requires homeserver downtime and is not easily reversible, so the window is only as reliable as the rehearsal. Running syn2mas migrate --dry-run performs a full import against a MAS database and then empties it, which gives a representative timing for your data volume. Schedule the dry run on a copy of production data, record the elapsed time, and size the maintenance window from that result rather than an estimate.

Synapse database is not PostgreSQL

MAS supports only PostgreSQL, and syn2mas reads only from a PostgreSQL Synapse database. A deployment still running on SQLite cannot be migrated directly, so the database move has to happen first and be validated as its own change. Confirm the database engine in homeserver.yaml before planning, and if it is SQLite, treat the database migration as a separate project with its own rehearsal.

Clients and bots keep old login paths

After cutover, clients, bots, bridges and scripts that log in with direct password requests or old session tokens can fail or keep working in ways you did not plan. Inventory every integration that authenticates against Synapse, including bridges and moderation bots, and confirm each one uses the MAS-based flow or a supported token method. Ask each owner to test login after the rehearsal, not during the live window.

Questions teams ask before moving Synapse auth to MAS

How much does moving Synapse authentication to MAS cost?

The cost comes mostly from the labor needed to run the readiness checks, the dry run, the cutover and the IdP configuration, so the quote follows from the written scope rather than from a fixed price. Cost rises with the number of identity providers, the size of the user base that must keep working passwords, the number of custom password providers or bridges that need review, and how much of the Synapse configuration has to be mapped by hand. Ask for a quote that separates the readiness assessment, the dry run, the production migration window, post-cutover checks and any ongoing support, because each has different effort and recurrence. DeployOpen does not publish a price list. Confirm with the vendor which parts of the migration tooling are free and open source, since the cost you pay is for people and environment work.

How long does the migration take, and what does the dry run tell us?

The dry run sets the planning baseline. The migration tool supports syn2mas migrate --dry-run, which performs a full import and then empties the MAS database, so the timing it reports is representative of the real run on the same data and hardware. Your total window depends on the size of the user table, the hardware the database runs on, and how long the homeserver can stay down. The readiness check with mas-cli syn2mas check runs without stopping Synapse, so it can be done early to find blockers. Plan the downtime window from the dry run timing plus margin for verification, and confirm with the MAS documentation at migrating an existing homeserver which steps must happen during the outage.

What does our team need to provide before the work starts?

Plan to provide four things before work starts:

  • The current Synapse configuration file, including the password hash settings, any pepper, and any SSO or password provider blocks.
  • Read access to the Synapse PostgreSQL database, because the migration tool reads only from PostgreSQL and never writes to it.
  • Admin access to the upstream identity provider, such as Keycloak, Microsoft Entra ID, Google or Authentik, so the OIDC client can be created and users can be mapped.
  • A written downtime approval with a planned window, a rollback owner and a communication plan for users.

Confirm the exact access levels with your security team before scheduling, especially for production database credentials.

Can our own team do this migration without outside help?

A team with Matrix administration experience can do much of the work, but the steps that touch authentication and the outage need someone who has run Synapse in production. The password hash configuration, the upstream IdP mapping and the cutover order are the places where mistakes lock users out or break logins for existing accounts. A team new to Synapse should expect to learn the configuration model, the PostgreSQL requirements and the worker or reverse proxy setup before attempting a production cutover. Ask whether your staff can run the dry run and interpret its output, and whether they can roll back the MAS configuration if the cutover fails. Confirm the required skills with the Synapse and MAS documentation before deciding.

Can SAML or LDAP users be moved to MAS?

Not directly. MAS does not support SAML, and the migration readiness checks reject setups that rely on SAML, LDAP or custom password providers. The MAS documentation recommends placing a bridge such as Dex in front of SAML or LDAP sources, so the users authenticate through an OpenID Connect provider that MAS can use. That bridge becomes a new component with its own hosting, certificates and patching. If your users sign in through SAML today, decide early whether the identity provider itself can speak OIDC, and confirm the bridge design and user mapping with your identity team before committing to a date.

Can we undo the migration after MAS starts?

Not easily. The MAS migration docs describe the real migration as requiring homeserver downtime and as not easily reversible. The good news is that syn2mas never writes to the Synapse database, so if you roll back before MAS is started, you do not need to restore Synapse from backup. After MAS begins issuing logins and creating sessions, returning to the old setup means reconciling sessions and accounts created in the meantime. Plan a backup of the PostgreSQL database before cutover and a tested rollback decision point. Confirm the exact rollback steps with the vendor documentation for your versions.

Does DeployOpen take on this migration?

Yes, DeployOpen can plan and carry out the Synapse to MAS migration as a fixed-scope engagement, with scope, deliverables and timelines agreed in writing before work starts. The work covers the readiness assessment, password hash and IdP configuration, the dry run, the production cutover in a window you approve, and verification afterward. DeployOpen implements these services inside your own infrastructure. It does not issue compliance attestations, so if your organization needs evidence for an assessment, DeployOpen prepares the controls and records for an independent auditor to review. Ongoing support and upgrades are available as retainers. Send your Synapse configuration and the list of identity providers to start the scoping conversation.

How DeployOpen scopes and delivers a Synapse to MAS migration

DeployOpen plans and delivers the move from Synapse's built-in authentication to Matrix Authentication Service as a fixed-scope engagement inside infrastructure you control. The work starts with a readiness review of your homeserver and identity setup, then runs a rehearsed syn2mas import before any production downtime is scheduled.

How we scope

  • We review your Synapse configuration for SAML, LDAP and custom password providers before agreeing the migration scope.
  • The written scope records the PostgreSQL database, password hash settings, upstream identity provider mapping and the planned downtime window.
  • Engagements are fixed-scope, and ongoing support after cutover is available as a retainer.

How we build

  • We run syn2mas check against a copy of your configuration first, without stopping Synapse, and document every problem it reports.
  • We configure MAS with the bcrypt password scheme, unicode normalization and any pepper your Synapse uses, then test sign-in on sample accounts.
  • We rehearse syn2mas migrate with --dry-run to measure import timing on a representative database before the production run.

How we hand over

  • You receive the readiness findings, the signed-off cutover runbook and the measured dry-run timing used to size the downtime window.
  • The rollback steps before MAS starts are documented, including the fact that syn2mas never writes to the Synapse database.
  • Your team gets a walkthrough of the upstream IdP configuration, MAS admin settings and the post-migration login checks.

How we support

  • We monitor the first sign-in cycle after cutover and fix login or upstream mapping issues within the agreed scope.
  • Retainers can cover MAS upgrades, Synapse upgrade notes and periodic review of identity provider settings.
  • Any change to the migration plan is recorded in writing with its effect on scope and downtime before work continues.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.