Issue Description
I created am external SQL directory using the recovery admin AND set it under Authentication to be used (instead of the internal directory).
stalwart-cli snapshot gives the following output:
{
"@type": "destroy",
"object": "Directory"
}
{
"@type": "create",
"object": "Directory",
"value": {
"directory-iuhrsiviaaqa": {
"@type": "Sql",
"queryEmailAliases": "SELECT alias.mail_value as address FROM egw_accounts JOIN egw_addressbook ON egw_accounts.account_id=egw_addressbook.account_id JOIN egw_mailaccounts a
lias ON egw_accounts.account_id=alias.account_id AND alias.mail_type=3 JOIN egw_mailaccounts active ON egw_accounts.account_id=active.account_id AND active.mail_type=0 AND active.mail
_value='active' LEFT JOIN egw_mailaccounts delivery ON egw_accounts.account_id=delivery.account_id AND delivery.mail_type=1 WHERE account_status='A' AND account_type='u' AND (account_
expires=-1 OR account_expires>UNIX_TIMESTAMP()) AND (delivery.mail_value IS NULL OR delivery.mail_value<>'forwardOnly') AND account_lid<>'anonymous' AND contact_email = $1",
"description": "EGroupware",
"columnEmail": "name",
"columnClass": "type",
"columnSecret": "secret",
"memberTenantId": null,
"store": {
"@type": "MySql",
"allowInvalidCerts": false,
"authUsername": "ralf",
"database": "egroupware",
"maxAllowedPacket": null,
"readReplicas": {},
"timeout": 15000,
"port": 3306,
"poolMinConnections": 5,
"useTls": false,
"poolMaxConnections": 10,
"host": "db",
"authSecret": {
"@type": "Value",
"secret": "****"
}
},
"queryMemberOf": "SELECT groups.account_lid AS member_of FROM egw_accounts groups JOIN egw_acl ON acl_location=CAST(-groups.account_id AS char CHARACTER SET ascii) AND acl_a
ppname='phpgw_group' JOIN egw_addressbook ON egw_addressbook.account_id=egw_acl.acl_account WHERE groups.account_type='g' AND egw_addressbook.contact_email = $1",
"queryRecipient": "SELECT contact_email AS name, account_pwd AS secret, n_fn AS description, 'individual' AS type /*1024*1024*quota.mail_value AS quota*/ FRO
M egw_accounts JOIN egw_addressbook ON egw_addressbook.account_id=egw_accounts.account_id JOIN egw_mailaccounts active ON egw_accounts.account_id=active.account_id AND active.mail_typ
e=0 AND active.mail_value='active' /*LEFT JOIN egw_mailaccounts quota ON egw_accounts.account_id=quota.account_id AND quota.mail_type=2*/ LEFT JOIN egw_mailaccounts delivery ON egw_ac
counts.account_id=delivery.account_id AND delivery.mail_type=1 LEFT JOIN egw_mailaccounts alias ON egw_accounts.account_id=ABS(alias.account_id) AND alias.mail_type=3 WHERE (account_t
ype='g' OR active.mail_value='active' AND account_status='A' AND (account_expires=-1 OR account_expires>UNIX_TIMESTAMP())) AND (delivery.mail_value IS NULL OR delivery.mail_value<>'
forwardOnly') AND account_lid<>'anonymous' AND (contact_email = $1 OR alias.mail_value = $1) UNION SELECT contact_email AS name, member.account_pwd AS secret, n_fn AS d
escription, 'individual' AS type /*1024*1024*quota.mail_value AS quota*/ from egw_accounts groups join egw_mailaccounts gmail on gmail.account_id=-groups.account_id and gmail.
mail_type=3 JOIN egw_acl ON acl_location=CAST(-groups.account_id AS char CHARACTER SET ascii) AND acl_appname='phpgw_group' JOIN egw_accounts member ON acl_account=member.account_id J
OIN egw_addressbook on member.account_id=egw_addressbook.account_id JOIN egw_mailaccounts active ON member.account_id=active.account_id AND active.mail_type=0 AND active.mail_value='a
ctive' /*LEFT JOIN egw_mailaccounts quota ON member.account_id=quota.account_id AND quota.mail_type=2*/ LEFT JOIN egw_mailaccounts delivery ON member.account_id=delivery.account_id AN
D delivery.mail_type=1 where groups.account_type='g' AND active.mail_value='active' AND (delivery.mail_value IS NULL OR delivery.mail_value<>'forwardOnly') AND member.account_lid<>'
anonymous' AND member.account_status='A' AND (member.account_expires=-1 OR member.account_expires>UNIX_TIMESTAMP()) AND gmail.mail_value = $1",
"columnDescription": "description",
"queryLogin": "SELECT contact_email AS name, account_pwd AS secret, n_fn AS description, 'individual' AS type /*1024*1024*quota.mail_value AS quota*/ FROM eg
w_accounts JOIN egw_addressbook ON egw_addressbook.account_id=egw_accounts.account_id LEFT JOIN egw_mailaccounts active ON egw_accounts.account_id=active.account_id AND active.mail_ty
pe=0 AND active.mail_value='active' /*LEFT JOIN egw_mailaccounts quota ON egw_accounts.account_id=quota.account_id AND quota.mail_type=2*/ LEFT JOIN egw_mailaccounts delivery ON egw_a
ccounts.account_id=delivery.account_id AND delivery.mail_type=1 WHERE active.mail_value='active' AND account_status='A' AND (account_expires=-1 OR account_expires>UNIX_TIMESTAMP())
AND (delivery.mail_value IS NULL OR delivery.mail_value<>'forwardOnly') AND account_lid<>'anonymous' AND contact_email = $1"
}
}
}
{
"@type": "update",
"object": "Authentication",
"value": {
"maxAppPasswords": 5,
"maxApiKeys": 5,
"passwordHashAlgorithm": "argon2id",
"passwordMaxLength": 128,
"passwordDefaultExpiry": null,
"passwordMinLength": 8,
"passwordMinStrength": "three",
"directoryId": "#directory-iuhrsiviaaqa"
}
}
Then I try to log in with [email protected] for which the queryLogin returns the correct secret, testing it e.g. in phpMyAdmin.
Expected Behavior
The login should succeed.
Actual Behavior
I get the error message: Invalid username or password. Please try again.
Relevant Log Output
I set the a Tracer to console with log-level Trace, but nothing is shown when I try to login with a user from the external directory, while logging in with the recovery admin produces a line in docker logs -f stalwart-mail.
When I trace tcp.port == 3306, I can see no connection from Stalwart ![]()
Stalwart Version
v0.16.x
Installation Method
Docker
Database Backend
RocksDB
Blob Storage
Filesystem
Search Engine
Internal
Directory Backend
SQL
Additional Context
Stalwart is started / running with the following docker-compose.yml:
networks:
dev_default:
external: true
services:
mail:
restart: unless-stopped
networks:
- dev_default
image: stalwartlabs/stalwart:v0.16-alpine
container_name: stalwart-mail
ports:
- "993:993"
- "4190:4190"
- "587:587"
- "465:465"
- "25:25"
- "8081:8080"
extra_hosts:
- "boulder.egroupware.org:172.17.0.1"
volumes:
- $PWD/data:/var/lib/stalwart
- $PWD/config:/etc/stalwart
- $PWD/certificates:/opt/stalwart/certs
environment:
- STALWART_RECOVERY_ADMIN=admin:secretPW
# disables the mail-server only gives the UI: https://stalw.art/docs/configuration/recovery-mode/
#- STALWART_RECOVERY_MODE=1
- STALWART_PUBLIC_URL=https://boulder-stalwart.egroupware.org
There is a Nginx proxy running in an other container giving access to the WebUI (port 8080) under the given URL https://boulder-stalwart.egroupware.org and I can successful login with the recovery-admin and PW. Which I used to configure the directory.
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