LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 11-11-2020, 03:25 PM   #1
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Rep: Reputation: 30
posftix, dovecot and mysql - auth failed after updating MySql


Hello,
I'm running Ubuntu 20.04 with Posftix, Dovecot and Mysql (latest versions).
The config worked, but with the latest version of MySQL the ENCRYPT function was deprecated.

Now I have in /etc/dovecot/dovecot-sql.conf:

Code:
driver = mysql
connect = host=127.0.0.1 dbname=mail user=mail_admin password=mail_admin_password
default_pass_scheme = SHA512-CRYPT
password_query = SELECT email as user, password FROM users WHERE email='%u';
I'm inserting domains and users like this:
Code:
msyql> USE mail;
msyql>INSERT INTO domains (domain) VALUES ('mydomain.com');
mysql>INSERT INTO users (email,password) values('u1@mydomain.com',sha2('mypassword', CONCAT('$6$', SUBSTRING(SHA(RAND()), -16))));
mysql>quit;
The user table was created like this:
Code:
 mysql> CREATE TABLE users (email varchar(80) NOT NULL, password varchar(256) NOT NULL, PRIMARY KEY (email) );
msyql> CREATE TABLE domains (domain varchar(50) NOT NULL, PRIMARY KEY (domain) );
The only error I'm getting in the logs is:
dovecot: imap-login: Disconnected (auth failed, 2 attempts in 8 secs): user=<u1@mydomain.com>, method=PLAIN, rip=5.12.x.y, lip=206.81.x.y, TLS, session=<uBerVtuzNOkFDENS>

Any idea? What could I do?
I'm sure there is something related to the way I'm inserting the password in the db and how dovecot is reading it.
I've spent the entire day with this (
 
Old 11-11-2020, 03:42 PM   #2
ddaas
Member
 
Registered: Oct 2004
Location: Romania
Distribution: Ubuntu server, FreeBsd
Posts: 474

Original Poster
Rep: Reputation: 30
I've got a workaround running doveadm pw -s SHA512-CRYPT and inserting the string including what's inside the curly braces in the password field.
But I don't think this is the best solution.
Maybe someone has a better solution.
 
  


Reply

Tags
dovecot, mysql, postfix



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Dovecot authorization fails when trying to connect via Mutt but all suggested Dovecot auth tests work spenced Linux - Server 1 04-18-2020 11:04 PM
Posftix - multiple relay error KamilKrK Linux - Software 1 11-14-2019 08:56 AM
dovecot-auth: pam_succeed_if(dovecot:auth): error retrieving information about user karsel Linux - Newbie 0 12-11-2012 07:44 AM
HELP! with Posftix mail disappear after delivered combilli Linux - Server 0 06-13-2007 04:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration