0

I've set up my mail server using a guide from Digital Ocean, followed by another guide. So, now if I send mail to torvin@mydomain, it works.

Now I'm trying to set up a catch-all address for all undelivered mail. Things I've tried so far:

1) Replaced

local_recipient_maps = proxy:pgsql:/etc/postfix/pgsql-boxes.cf $alias_maps

line with this:

local_recipient_maps =
luser_relay = torvin

The result I see in the logs:

postfix/lmtp[32692]: D5AD540085: to=, relay=mail.mydomain[private/dovecot-lmtp], delay=0.21, delays=0.17/0.01/0.01/0.02, dsn=5.1.1, status=bounced (host mail.mydomain[private/dovecot-lmtp] said: 550 5.1.1 User doesn't exist: thisisjustatest@mydomain (in reply to RCPT TO command))

2) Instead replaced

alias_maps = hash:/etc/aliases proxy:pgsql:/etc/postfix/pgsql-aliases.cf

with

alias_maps = hash:/etc/aliases pcre:/etc/aliases_pcre proxy:pgsql:/etc/postfix/pgsql-aliases.cf

And created /etc/aliases_pcre with the following content:

/.*/    torvin

Result is the endless loop of:

to=, relay=local, delay=0.01, delays=0/0/0/0, dsn=5.4.6, status=bounced (mail forwarding loop for torvin@mydomain)

3) Instead tried

virtual_alias_maps = pcre:/etc/aliases_pcre

Now all my mail goes to torvin, and never gets delivered to any other existing users in the system.

Please help!

1

This is because /.*/ also includes torvin. I assume your proxy:pgsql: has information on this user, but pcre:/etc/aliases_pcre is looked before that. In this case, the easiest solution would be to reorder them. Also, a simple hash: database line @example.com torvin@example.com would do the same as your /.*/ PCRE approach.

Technical implementation aside, having such a catch-all on a domain with multiple users is a bad idea. There would not be ANY actual messages that would need attention. What you'd get is:

  • Spam for non-existent common addresses like sales@example.com. This is the most common.
  • Messages destined to someone else. Picture someone trying to send confidential information to Jane Smith on <j.smith@example.com>, but forgets the dot <jsmith@example.com> or mistypes it like <j.smiht@example.com>. Normally, the sender would receive a notification that the user doesn't exist, double check the email address and resend the message. With a catch-all, this doesn't happen. Instead, there's this torvin guy in an awkward and most likely illegal situation.

Both should be treated with a SMTP connection-stage rejection.

  • I tried reordering and got the same mail forwarding loop problem. Then I tried @mydomain torvin@mydomain and got postalias: warning: /etc/aliases, line 18: name must be local. I suspect this syntax is supported in virtual_alias_maps, but then I will get the problem #3. Any ideas? Also, thank you for your concern, I understand that my setup is quite unusual and your argument is valid in the general case! – torvin Dec 10 '18 at 21:22
  • 1
    a) As you already have proxy:pgsql: you could edit the SQL query to answer with torvin when there's no match in the database. b) If you use hash:, remember to postmap. – Esa Jokinen Dec 11 '18 at 5:03
  • Thanks for your reply! a) I don't think it's a SQL query, /etc/postfix/pgsql-aliases.cf looks like a config file of some sort, but I have no idea how to find documentation for it. And I don't think I can trick it into returning something in case of a miss... b) Sorry, but I literally have no idea what that means. I read the man page for postmap but I don't understand how and if it is applicable in my situation (LMTP etc). postfix is just horrifying... – torvin Dec 11 '18 at 9:59
  • a) Don't have overly complicated configuration you don't understand. If your users aren't listed in the database, remove such configuration. If that part was relevant, it's certainly possible to modify the SQL query. b) You have hash:/etc/aliases, so you already need to to postmap /etc/aliases every time you make a change to that file. The hash: database for virtual aliases works the same way. – Esa Jokinen Dec 11 '18 at 10:02
  • a) yes, I want to keep users in the DB, because I don't want to create system users for mailboxes. but what I'm saying is, /etc/postfix/pgsql-aliases.cf doesn't have any SQL query, so there is no way to modify it. b) I used newaliases instead... is that wrong?.. – torvin Dec 13 '18 at 10:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.