Topic: Dovecot says unknown user for create_mail_user_SQL.sh users
==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.6.2 PGSQL edition.
- Deployed with iRedMail Easy or the downloadable installer? downloadable installer
- Linux/BSD distribution name and version: FreeBSD 13.1-RELEASE-p3
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): PGSQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
OK, adding users through the iRedMail interface works fine. Once I try the create_mail_user_SQL.sh script for Bulk creation I can login to SOGo but it says No mailbox selected. Then the SOGo log says: Could not connect IMAP4.
I enabled all the verbose logging for dovecot auth and now it seems Dovecot is not able to recognize the user:
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: Loading modules from directory: /usr/local/lib/dovecot/auth
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: Module loaded: /usr/local/lib/dovecot/auth/lib20_auth_var_expand_crypt.so
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: sqlpool(pgsql): Creating new connection
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: Wrote new auth token secret to /var/run/dovecot/auth-token-secret.dat
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: passwd-file /usr/local/etc/dovecot/dovecot-master-users:Read 1 users in 0 secs
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: sqlpool(pgsql): Creating new connection
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: auth client connected (pid=44840)
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: client in: AUTH 1 PLAIN service=imap secured=tls session=UTDzEXHwSSx/AAAB lip=127.0.0.1 rip=127.0.0.1 lport=143 rport=11337 local_name=127.0.0.1 resp=AFNpbWFBcmptYW5kQDNycjByLmNvbQBoU2lhUU0xZFhaenZaSGVreFFVV3U5RHE= (previous base64 data may contain sensitive data)
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: sql(somemail@somedomain.tld,127.0.0.1,<UTDzEXHwSSx/AAAB>): Performing passdb lookup
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: sql(somemail@somedomain.tld,127.0.0.1,<UTDzEXHwSSx/AAAB>): query: SELECT mailbox.password, mailbox.allow_nets FROM mailbox,domain WHERE mailbox.username='somemail@somedomain.tld' AND mailbox."enableimaptls"=1 AND mailbox.active=1 AND mailbox.domain=domain.domain AND domain.backupmx=0 AND domain.active=1
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: pgsql(127.0.0.1): Finished query 'SELECT mailbox.password, mailbox.allow_nets FROM mailbox,domain WHERE mailbox.username='somemail@somedomain.tld' AND mailbox."enableimaptls"=1 AND mailbox.active=1 AND mailbox.domain=domain.domain AND domain.backupmx=0 AND domain.active=1' in 2 msecs
Dec 22 21:08:26 mx dovecot[42214]: auth: sql(somemail@somedomain.tld,127.0.0.1,<UTDzEXHwSSx/AAAB>): unknown user (given password: SOME_PASSWORD_HERE)
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: sql(somemail@somedomain.tld,127.0.0.1,<UTDzEXHwSSx/AAAB>): Finished passdb lookup
Dec 22 21:08:26 mx dovecot[42214]: auth: Debug: auth(somemail@somedomain.tld,127.0.0.1,<UTDzEXHwSSx/AAAB>): Auth request finished
This is the generated SQL commands and when I query Postgres, everything is there:
INSERT INTO mailbox (username, password, name,
storagebasedirectory,storagenode, maildir,
quota, domain, active, passwordlastchange, created)
VALUES ('somemail@somedomain.tld', '{BLF-CRYPT}$2y$05$VVG/dHRRb9l3jVE3f.IqF.mDoamn33GNaaRFVRME3nwS6.6LNi0HW', 'somemail',
'/var/vmail','vmail1', 'somedomain.tld/A/s/a/somemail-2022.12.22.20.57.41/',
'8', 'somedomain.tld', '1', NOW(), NOW());
INSERT INTO forwardings (address, forwarding, domain, dest_domain, is_forwarding)
Any ideas?
----
Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.