0

I have roundcube and docker-mailserver in docker containers. I've managed to make change of password possible by roundcube password plugin. I created 'mailbox' table and added two columns: 'username' and 'password'. Now this is working, all users can change their passwords.

But still roundcube is logging in users by passwords from /config/postfix-accounts.cf, not from database.

How can I make roundcube take passwords from database (MySQL)?

Surely IMAP and POP3 also should take password from database, not from the given file.

Roundcube 1.5.2, docker-mailserver 10.4.0.

pbies
  • 159
  • 12
  • Have you read the relevant documentation? What have you attempted? Have you read relevant config files for clues? – vidarlo Feb 27 '22 at 20:48
  • @vidarlo Yes, yes. Seems like roundcube is missing code for login taking password from database. – pbies Feb 28 '22 at 07:57
  • Currently what I am trying to do is to make roundcube auth users by passwords from database, not from file. Maybe dovecot configuration needs to be changed? – pbies Feb 28 '22 at 09:54

1 Answers1

0

Ok, so there was much work involved + much research:

  1. you must have separate MySQL container and containers using it
  2. docker-mailserver must use these lines instead of image:
build:
  context: .
  dockerfile: Dockerfile
  1. Dockerfile must be:
FROM docker.io/mailserver/docker-mailserver:latest
RUN apt-get update && apt-get install -y dovecot-mysql
  1. as you can see it must be run with docker-compose with --build parameter
  2. dovecot-mysql must be installed as it is for plugin for getting password from MySQL database (this plugin must be enabled for roundcube in config file - to change passwords in database from roundcube)
  3. in etc/dovecot/10-auth.conf you need to comment !include auth-passwdfile.inc with #
  4. in the same file uncomment #!include auth-sql.conf.ext
  5. in file 10-ssl.conf make line ssl=yes
  6. this may be needed for userdb also
  7. make in your container database a table mailbox with columns username, password
  8. add at least one user with password $1$... - encrypted
  9. dovecot.cf file must have ssl=yes and you may want to add disable_plaintext_auth=yes
  10. have /etc/dovecot as volume (take the files from inside the container)
  11. in /etc/dovecot/dovecot-sql.conf.ext have:
driver = mysql
connect = host=mail_mysql_cont dbname=db user=username password=root_passwd_for_db
password_query = \
  SELECT username AS user, password \
  FROM mailbox WHERE username = '%u'
user_query = \
  SELECT '/tmp' AS home, 9999 AS uid, 9999 AS gid;
  1. in /etc/dovecot/auth-sql.conf.ext have:
passdb {
  driver = sql
  args = /etc/dovecot/dovecot-sql.conf.ext
}

I will update the answer later as I will work on the problem further.

EDIT:

To make password changing possible in Roundcube you need to have MySQL database attached and table mailbox created with at least columns username and password.

pbies
  • 159
  • 12