uid/gid are for vmail (/home/dovecot directory). I've looked at the smtpd lookup trace and query_userinfo queries the database purely by user name (without domain part). That is essentially where all virtuality fails. :/ If the database was queried by the full e-mail address (not unlike the virtual alias query), I could extract the domain part easily and proceed from there.

In Dovecot I've specified the username + domain separately in MySQL lookups where clauses.


On 04.02.2018 19:18, Edgar Pettijohn wrote:

does the system have a uid and gid 5000? I'm using mysql myself, but i don't have a userinfo section.  I'm guessing it should still work the same as the userinfo table described in table(5) though. Unfortunantly I am no sql expert, so I would just recommend verifying that your query does what you expect it to do perhaps run it from the command line and see what you get.

On 02/04/18 10:32, Reio Remma wrote:
Current smtpd.conf below.

As I understand userbase is the only way to let OpenSMTPD know where to look for

table aliases  mysql:/etc/opensmtpd/mysql.conf
table domains mysql:/etc/opensmtpd/mysql.conf
table userinfo mysql:/etc/opensmtpd/mysql.conf
table credentials mysql:/etc/opensmtpd/mysql.conf

listen on port 25 tls pki bwo.mrstuudio.ee
listen on port 587 tls-require pki bwo.mrstuudio.ee auth <credentials>

listen on lo port 10025 tag Filtered
listen on lo port 10027 tag Signed

accept tagged Filtered for domain <domains> virtual <aliases> userbase <userinfo> deliver to lmtp "/var/run/dovecot/lmtp" rcpt-to

accept from any for domain <domains> relay via lmtp://

accept tagged Signed for any relay via tls://orc.mrstuudio.ee

accept from local for any relay via lmtp://



query_alias             SELECT username FROM users WHERE email = ?;
query_domain            SELECT domain FROM users WHERE domain = ? LIMIT 1; query_userinfo          SELECT 5000, 5000, CONCAT('/home/dovecot/domains/', domain, '/', username ) AS homedir FROM users WHERE username = ?; query_credentials       SELECT username, password FROM users WHERE email = ?;


On 04.02.2018 18:09, Edgar Pettijohn wrote:

what does your smtpd.conf look like?

On 02/04/18 08:01, Reio Remma wrote:

I'm trying to figure out how I can have virtual domains/users working completely decoupled from system users.

Every virtual/alias path seem to want to end up at a system account so I'm trying to use userbase, but userbase seems to take username without the domain part as key.

query_userinfo          SELECT 5000, 5000, CONCAT('/home/dovecot/domains/', domain, '/', username ) AS homedir FROM users WHERE username = ?;

- bob
- emily

- john
- albert
- bob (not the same bob as b...@domain-one.com)

Mail sent to b...@domain-two.com will end up at b...@domain-one.com mailbox.

Am I missing something about using virtuals in general? I'm starting to feel a little stupid here. :)


Reply via email to