A tad confused about mapping virtual users to system users in Dovecot

0

What I hope to do:

  1. Use getmail to grab emails from several of my accounts (gmail, fastmail, Yahoo etc) ->
  2. deliver to an instance of Dovecot running locally ->
  3. from which I'll use a mail client to access my emails

Sending isn't a goal for now.

What I don't know: how to map account1@gmail.com and myveryoldaccount@yahoo.com to iain the system account.

I'm looking at virtual users but every discussion either mentions:

  1. Postfix, which I'm not using (as yet)
  2. Editing /etc/passwd

Focussing on (2), I've already set up authentication via PAM and I'm not really interested in fiddling around with /etc/passwd. Is there not something available like?

# Some barely spoken about file
iain: account1@gmail.com, myveryoldaccount@yahoo.com

# dovecot.conf
address_mapping: use_barely_spoken_about_file

My conf.d/auth-system.conf.ext has the following (I'm not sure it's relevant or not):

passdb {
  driver = pam
  args = dovecot
}

userdb {
  # <doc/wiki/AuthDatabase.Passwd.txt>
  driver = passwd
  # [blocking=no]
  # see https://trac.macports.org/wiki/howto/SetupDovecot
  args = 
}

The Macports link has:

Together, these prevent the need for hardcoded passwd.dovecot and userdb.dovecot files, and don't require any knowledge of LDAP. However, they only support system usernames, and not virtual mailboxes. I have tested this with IMAP and the dovecot LDA (deliver) successfully.

Should I simply replace getmail with Postfix? That seems like a lot of extra work, getmail is simple to setup.

Does the barely_spoken_about_file exist, or is it really /etc/passwd?

Can I still authenticate via PAM?

Any help or insight, or just a nudge towards to right article would be much appreciated.

Iain

Posted 2019-01-28T08:53:14.773

Reputation: 232

I'm not sure why you're trying to map mailboxes that don't belong to your server in the first place? Is that something getmail requires? (If it did, most people would have been unable to use it...) – user1686 – 2019-01-28T08:59:22.927

Reading the getmail man oage I would be very surprised if getmail is deliverjng mail through dovecot - in fact I dont think dovecot supports this. I expect its simlly writing mail in a standard firnat and dovecot reads it. This neans looking to dovecot is looking in the wrong place. – davidgo – 2019-01-28T09:14:44.203

@davidgo getmail is acting as the Mail Retrieval Agent and Dovecot is acting as the Local Delivery agent. I can invoke getmail to deliver to a directory on my box but then messages are siloed and I lose the things that Dovecot can do, like filtering and funneling the messages to one receiver. – Iain – 2019-01-28T14:58:15.023

@grawity getmail will simply fetch mail given the address and account details. What I want is to take those disparate accounts and funnel them to one recipient who owns the accounts. I believe (because I've seen some articles where people do something similar but not quite, for example) Dovecot should be able to take the messages from getmail and do this, but I'm not sure how to configure the mapping.

– Iain – 2019-01-28T15:02:07.167

Ah, if it works anything like fetchmail used to, then I don't think you need to map these addresses as accounts at all; getmail delivers everything via LDA to a single regular Dovecot account. Instead, I think you need to use Dovecot's Sieve module to filter/sort based on "Delivered-To:" or similar headers. – user1686 – 2019-01-28T15:31:45.613

@grawity I see, I'll need to look into that then. Thanks for giving me a nudge in the right direction, much appreciated. – Iain – 2019-01-30T05:23:28.513

No answers