V1.0.3 LDAP setup ended in no login + cannot log in

Issue Description

After completing the full setup I am left on the “Setup Complete” screen. With a blue box telling me there are credentials above to continue administering my server. There are no credentials, likely due to the LDAP setup.

I thus continued using the recovery admin.

Sadly the LDAP setup still does not let me log in even though the authentication succeeds.

Expected Behavior

  1. Remove the incorrect statement that there are login credentials on the final bootstrapping screen (or add them, or link to the recovery admin docs in case it’s needed).

  2. Improved LDAP/auth debug logs that tell me what to fix or simply letting me log in with the current setup.

Actual Behavior

Relatively unclear log, with not really a path to fix.

stalwart-mail  | 2026-11-04T22:25:10Z INFO Unauthorized access (security.unauthorized) listenerId = "https", localPort = 443, remotePort = 53294, reason = "authenticate", accountId = 1, remoteIp = 172.18.0.7`

Reproduction Steps

  1. Configure stalwart v1 from scratch with defaults except directory = LDAP
  2. LDAP server is Kanidm
  3. Try to match the LDAP directory config as follows:
Directory
  • Description: kanidm
Connection
  • Server URL: ldaps://idm.melijn.com:3636
  • Timeout: 15 seconds
  • Enable TLS: true
  • Allow Invalid Certificates: true
Bind
  • Base DN: dc=idm,dc=melijn,dc=com
  • Bind DN: dn=token
  • Bind Secret: (Type=Secret Value; Secret=redacted)
  • Use Bind Authentication: true
Filters
  • Login Filter: (&(|(objectClass=person)(objectClass=service_account))(|(uid=?)(spn=?)(name=?)))
  • Recipient Filter: (&(|(objectClass=person)(objectClass=service_account))(|(mail=?)))
  • Member of Filter: blank
Attributes
  • Account Type Attribute: objectClass
  • Description Attribute: description
  • Primary E-mail Attribute: mail emailprimary
  • E-mail Alias Attribute: emailalternative
  • Member Of Attribute: memberOf
  • Password Attribute: blank
  • Password Changed Attribute: blank
  • Group Object Class: groupOfNames
  1. See Invalid username or password. Please try again. on the login screen and the logs are linked below.

Relevant Log Output

stalwart-mail  | 2026-11-04T22:25:09Z DEBUG HTTP request URL (http.request-url) listenerId = "https", localPort = 443, remoteIp = 172.18.0.7, remotePort = 53294, url = "/api/auth"
stalwart-mail  | 2026-11-04T22:25:09Z TRACE Expression evaluation result (eval.result) listenerId = "https", localPort = 443, remoteIp = 172.18.0.7, remotePort = 53294, name = "Http with id singleton", property = "allowedEndpoints", result = "Integer(200)"
stalwart-mail  | 2026-11-04T22:25:09Z TRACE HTTP request body (http.request-body) listenerId = "https", localPort = 443, remoteIp = 172.18.0.7, remotePort = 53294, headers = [["host", "mail.melijn.com"], ["user-agent", "Mozilla/5.0 (X11; Linux x86_64; rv:159.0) Gecko/20100101 Firefox/159.0"], ["accept", "application/json"], ["accept-language", "en-US,en;q=0.9"], ["accept-encoding", "gzip, deflate, br, zstd"], ["content-type", "application/json"], ["content-length", "502"], ["origin", "https://mail.melijn.com"], ["dnt", "1"], ["sec-gpc", "1"], ["connection", "keep-alive"], ["sec-fetch-dest", "empty"], ["sec-fetch-mode", "cors"], ["sec-fetch-site", "same-origin"], ["priority", "u=0"], ["pragma", "no-cache"], ["cache-control", "no-cache"]], contents = "{\"type\":\"authCode\",\"accountName\":\"merlijn\",\"accountSecret\":\"redacted\",\"query\":\"response_type=code&client_id=https%3A%2F%2Fmail.melijn.com%2Faccount%2Foauth-client.json&redirect_uri=https%3A%2F%2Fmail.melijn.com%2Faccount%2Foauth%2Fcallback&code_challenge=t4E-IILKq4RlAtUnn8hYlFLIteji3BZs-fv3fKer0fI&code_challenge_method=S256&state=27527a1e9b7fc85a6b95ce8d3fefd8cf&login_hint=merlijn&prompt=login&scope=openid&resource=https%3A%2F%2Fmail.melijn.com\"}", size = 502
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Authentication warning (auth.warning) accountName = "merlijn", reason = "No domain in username"
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = "melijn.com", name = "domainName"
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = 1, name = "domainId"
stalwart-mail  | 2026-11-04T22:25:09Z TRACE LDAP query executed (store.ldap-query) query = "(&(|(objectClass=person)(objectClass=service_account))(|(uid=merlijn)(spn=merlijn)(name=merlijn)))", result = [["emailprimary", "mainemail@mydomain"], ["emailalternative", "comma separated list of cool email addresses@mydomain"], ["objectclass", "account, memberof, object, person, posixaccount"], ["memberof", "[email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com, [email protected],dc=idm,dc=melijn,dc=com"], ["mail", "[email protected], [email protected], [email protected]"], "[email protected],dc=idm,dc=melijn,dc=com"]
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = "melijn.com", name = "domainName"
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = 1, name = "domainId"
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = "merlijn", domain = 1, name = "email"
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = "melijn.com", name = "domainName"
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = 1, name = "domainId"
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = "admin", domain = 1, name = "email"
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = "melijn.com", name = "domainName"
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = 1, name = "domainId"
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = "toxicmushroom", domain = 1, name = "email"
stalwart-mail  | 2026-11-04T22:25:09Z DEBUG Cache hit (cache.hit) key = 1, name = "accessToken"
stalwart-mail  | 2026-11-04T22:25:09Z INFO Authentication successful (auth.success) listenerId = "https", localPort = 443, remoteIp = 172.18.0.7, remotePort = 53294, accountName = "[email protected]", accountId = 1
stalwart-mail  | 2026-11-04T22:25:10Z INFO Unauthorized access (security.unauthorized) listenerId = "https", localPort = 443, remotePort = 53294, reason = "authenticate", accountId = 1, remoteIp = 172.18.0.7
stalwart-mail  | 2026-11-04T22:25:10Z TRACE HTTP response body (http.response-body) listenerId = "https", localPort = 443, remoteIp = 172.18.0.7, remotePort = 53294, contents = "{\"type\":\"failure\"}", code = 200, size = 18

Stalwart Version

v1.x

Installation Method

Docker

Database Backend

RocksDB

Blob Storage

RocksDB

Search Engine

Internal

Directory Backend

LDAP

Additional Context

Setup was copied from a working v0.15 instance.

I have reviewed the documentation and FAQ and confirm that my issue is NOT addressed there.

on

I have searched this support forum (open and closed topics) and confirm this is not a duplicate.

on

I understand that topics in this category are triaged by a bot first but a human reply will follow up. If I’d prefer a human-only reply, I’ll add the no-ai tag to my topic.

on

The login failure is a permissions problem, not an LDAP problem. LDAP authentication succeeds (auth.success for [email protected], accountId 1). Right after that, the server checks that the account holds the authenticate permission. The reason = "authenticate" in the security.unauthorized line is the name of the permission that was missing. The WebUI then shows the generic “Invalid username or password”.

The docs say quotas, roles and permissions are not read from the directory. Stalwart creates a local account for each LDAP user, with roles set to User. That value resolves to the roles in defaultUserRoleIds on the Authentication singleton, normally the built-in User role, which includes authenticate. Your account is ending up without it. My guess is that defaultUserRoleIds is empty, or the User role lacks that permission. I couldn’t confirm from the source why that would happen after a setup that used LDAP from the start.

To check and fix it, sign in as the recovery admin:

  1. Open Authentication › General (the Authentication singleton) and check that defaultUserRoleIds contains the User role. Also check that the User role itself includes the authenticate permission.
  2. If you change the defaults, run a ReloadSettings action. Accounts used since the last restart keep their cached permissions, so also run InvalidateCaches or restart the server.
  3. Alternatively, open the local account for [email protected] and set its roles to Admin or Custom with the roles you want. Since you’re the administrator, Admin is probably what you want. It applies defaultAdminRoleIds, which by default is System Administrator plus User.

Your LDAP settings look fine. The query returned your entry, the aliases were resolved, and the bind worked.

Your two feature requests, a misleading “Setup Complete” box and a clearer log or login error for a missing permission, aren’t something I can act on from here. A human will see them in this topic.

Docs: Roles | Stalwart and LDAP Server | Stalwart

This is an automated reply from the Stalwart Help Bot. Other community members may follow up if this answer is incomplete or wrong.

This solved the issues it seems, it’d be nice if it was done automatically (setting the default roles) when doing the bootstrap setup.

Feel free to mark resolved, I just want to make sure it is seen by your team as the current setup feels a bit incomplete or unclear.

I could be mistaken but I thought this is resolved in 1.0.3 by using this environment variable when upgrading:

STALWART_UPDATE_ROLE_PERMISSIONS environment variable. When set to true (or 1), startup adds to each default role every permission introduced after v1.0.0 that a new install would give that role and that the role is missing.

This turned out to be a bug in the setup, not something in your LDAP config. When the wizard is completed with an external directory, it saves the directory choice before the default roles exist. On the first normal start the server then creates the User, Group and Administrator roles but skips assigning them as defaults, because the authentication settings are already there. Every directory account ended up with no roles at all, so the LDAP bind succeeded and the server still refused the sign-in for lack of the authenticate permission. That’s the security.unauthorized line right after auth.success in your log. Setups with the internal directory weren’t affected.

The fix assigns the default roles in that case too, which is exactly what you did by hand, so your server is already in the right state. It ships in the next weekly release. Servers that were set up with an external directory before the fix keep their empty defaults, so anyone else hitting this needs the same manual step.

The last screen of the wizard is fixed as well. It no longer mentions credentials when none were created, and instead says that accounts come from the directory and that the first administrator role is assigned by signing in with the recovery administrator, which is what you ended up doing.

@Disrupt, STALWART_UPDATE_ROLE_PERMISSIONS couldn’t have helped here. It adds newer permissions to the roles that are already listed as defaults, and in this case that list was empty.