Description
I remember having a use-case where I wanted to give email accounts to all PAM users but use passwords from a separate database. And also people on IRC channels for dovecot and postfix often ask questions regarding weird mixes of authentication data sources. So I guess we should have a generic tool to handle such cases.
We create the multi
module that implements authentication provider interface (so it can be used in SMTP, IMAP, etc):
multi instance_name {
user pam
user virtual { file /etc/maddy/userlist }
pass virtual { file /etc/maddy/passwd }
}
user
directive here refers to a module implementing the following interface:
type UserDB interface {
HasUser(name string) bool
}
pass
directive refers to an authentication provider.
If there is at least one user
directive - then at least one "userdb" module should say that the user exists.
Then the user password is also checked against providers listed using pass
directives, at least one provider should accept the password.
multi
module itself also implements the UserDB interface, this allows mixing things together in more complicated use-cases to get the right results.