Skip to content

feat: extend Dovecot passwdfile driver with dynamic file path support#10038

Merged
alecpl merged 2 commits intoroundcube:masterfrom
MikkCZ:mikkcz/issue-10036-feat-user-aware-user-passwd-file
Dec 27, 2025
Merged

feat: extend Dovecot passwdfile driver with dynamic file path support#10038
alecpl merged 2 commits intoroundcube:masterfrom
MikkCZ:mikkcz/issue-10036-feat-user-aware-user-passwd-file

Conversation

@MikkCZ
Copy link
Copy Markdown
Contributor

@MikkCZ MikkCZ commented Nov 30, 2025

fix #10036

* @param string $username Login username (configured form based on $config['password_username_format'])
*
* @return int PASSWORD_SUCCESS|PASSWORD_CONNECT_ERROR|PASSWORD_ERROR
* @throws Exception if the password file cannot be read or written
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no exceptions here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

return strtr($subject, [
'%l' => $local_part,
'%d' => $domain_part,
'%u' => $username,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think %u and %l make sense here, but %d and %h would.

Copy link
Copy Markdown
Contributor Author

@MikkCZ MikkCZ Dec 2, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My specific use case is, that I have one mailserver (mail.mailserver.com), which hosts mailboxes for multiple domains (alice@mydomain.com, bob@anotherdomain.info, ...), which all use Roundcube on the same URL address (https://webmail.mailserver.com/).

I would like to have the credentials stored in file separated by domain (/some/path/domains/mydomain.com/passdb, /some/path/domains/anotherdomain.info/passdb), or potentially even have one file per user (/some/path/domains/mydomain.com/users/alice/passdb, /some/path/domains/anotherdomain.info/users/bob/passdb). It's basically the example from https://doc.dovecot.org/2.4.2/core/config/auth/databases/passwd_file.html#multiple-passwd-files

passdb passwd-file {
  # Each domain has a separate passwd-file:
  passwd_file_path = /etc/auth/%{user | domain}/passwd
}

where %{user | domain} is the domain_part of the email address.

I might have got lost in the definition of the placeholders. Are they like this?

  • %l = alice from alice@mydomain.com
    %d = mydomain.com from alice@mydomain.com
    %u = whole alice@mydomain.com
    %h = mail.mailserver.com from imap://mail.mailserver.com (hostname of IMAP server)
    %n = webmail.mailserver.com from https://webmail.mailserver.com/ (hostname of Roundcube webserver)

In https://github.com/roundcube/roundcubemail/blob/master/plugins/password/config.inc.php.dist, %d seems sometimes referring to part of the email address, and sometimes the hostname of the webserver.

@MikkCZ MikkCZ requested a review from alecpl December 14, 2025 14:14
@alecpl alecpl merged commit 64bfcb6 into roundcube:master Dec 27, 2025
17 checks passed
c4539 pushed a commit to c4539/roundcubemail that referenced this pull request Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

dovecot_passwdfile to support users file per domain

2 participants