from the pgsql configuration file: # Query to retrieve the password. # # The query should return one row, one column. If more than one row or column # is returned, authentication will automatically fail. # # Available substitutions: # %u = entire userid # %n = user part of user@domain # %d = domain part of user@domain #
# Query to retrieve the user information. # # The query must return only one row. The columns to return are: # home - Home directory # mail - MAIL environment # system_user - System user name (for getting user's groups from /etc/group) # uid - System UID # gid - System GID # # Either home or mail is required. uid and gid are required. If more than one # row is returned or there's missing fields, login will automatically fail. #
I'm a bit slow here, so if someone could just nod if I'm in the right direction:
I want to support IMAP for at least two domains. Therefore I have to use the authentication string of: SELECT password FROM users WHERE userid = '%u' and the user must enter their entire email address for their login name. (I can do this!)
I want some portion of these domains and users to be consistent with existing accounts in my /etc/passwd database. I don't expect to use passwd information for the username and password, but I want the information returned for joe@domain2.com to be for the user:joe in my passwd file and have his email in /home/joe/Maildir. Similarly, I want others (either fred@domain2.com or jane@domain1.com) to be (ideally) all driven under a non-local account name and login.
For this second one, I'm thinking I need to do something like this in the user information query (this is mostly a guess): for joe@domain2.com (/etc/passwd) :: jane@domain1.com (no passwd) home - /home/joe --or-- can I use ~/ :: /var/spool/imap/%d/%n ?? mail - maildir:~/Maildir :: maildir:/var/spool/imap/%d/%n ?? system_user - joe :: (a guess -- adduser dovecot-imap to passwd maybe) uid - joes uid (1002) :: dovecot-imap uid (510) gid - joes gid (1001) :: dovecot-imap gid (510) with seperate group
This is where I get fuzzy. If someone could help me figure out where I went wrong I would appreciate it.
If I did this correctly, then in theory I could pass email delivery to procmail and have one set of rules (/etc/procmail) do some additional filtering for all the email under my domain1.com (spam filtering mostly) and perform a final delivery to maildirs in /var/spool/imap/doamin1.com/jane/
Or am I sleep deprived?