feat: extend Dovecot passwdfile driver with dynamic file path support#10038
Conversation
| * @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 |
| return strtr($subject, [ | ||
| '%l' => $local_part, | ||
| '%d' => $domain_part, | ||
| '%u' => $username, |
There was a problem hiding this comment.
I don't think %u and %l make sense here, but %d and %h would.
There was a problem hiding this comment.
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=alicefromalice@mydomain.com
*%d=mydomain.comfromalice@mydomain.com
*%u= wholealice@mydomain.com
*%h=mail.mailserver.comfromimap://mail.mailserver.com(hostname of IMAP server)
*%n=webmail.mailserver.comfromhttps://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.
fix #10036