0

I need to use sendmail without any system users.

The only problem that still exists in my configuration is that FEATURE(virtusertable) wants a final systemuser on RHS in my virtusertable like this:

@domain.tld           user@domain.tld
user@domain.tld       systemuser

The problem is, there is NO such systemuser and I want all mail to @domain.tld delivered to my lda (procmail, then dovecot-lda) which is capable of handling full email addresses as users.

I already tried things like

define(`_VIRTUSER_STOP_ONE_LEVEL_RECURSION_', `true')dnl
define(`_NEED_MACRO_MAP_',`1')dnl

but this does not help either.

We already have an ugly workaround with procmail scripting which is reading the virtusertable, but we would love to have this handled by sendmail so that any sent email that has no RHS and/or user in the lda to be bounced. In addition using dovecot-lda is direct lda in sendmail is also no option in our setup. :(

Any help is welcome!

Jimmy Koerting
  • 151
  • 1
  • 8
  • How many virtual users do you plan to configure in your dovecot? (100,1_000,10_000,...) Do you keep docecot's mailbox list in plain text file? – AnFi Dec 18 '13 at 20:21

2 Answers2

2

Take a look at Sendmail FAQ 3.29 - "How can I add a header specifying the actual recipient when having multiple users in a virtual domain go to a single mailbox?"

IMHO it may be easily adapted to deliver what you want - it provides all needed hooks.

BTW you may use "@domain.tld" virtusertable entry to selected error mailer. It will allow you to reject messages to virtual users not listed in virtusertable.

@domain.tld           error:nouser No such user here
adam@domain.tld       systemuser+%1
eve@domain.tld        systemuser+%1

You may also consult https://www.sendmail.com/sm/open_source/tips/virtual_hosting/

AnFi
  • 6,103
  • 1
  • 14
  • 27
  • We have between 10 and 1000 virtual users in one host and about 10 to 200 domains handled by the same sendmail. Most customers need/want the terrible catch-all feature and we need to 'reuse' a really hugh nested procmail for many reasons, so we can't omit it. In the meantime I have everything running with some fake entries in aliases, but this is not clean and sendmail is not able to reject on not existing recipients in all cases. I guess I need to write some rules to achieve this. I hoped to use a existing solution. – Jimmy Koerting Dec 18 '13 at 23:01
0

I ended up solving this by two ways:

a) Patching libsm/mbdb.c and sendmail/recipient.c to have an additional lookup into the dovecot user table. To have this working, a minor tweaking with a LOCAL_RULE_0 was needed.

b) Andrzej pointed me in a similar question on stackoverflow to solution with mailertable and access file. Following this idea I found an even easier solution to have everything we need:

virtusertable:

@domain.tld              user_domain_tld
info@domain.tld          user_another_tld

aliases:

user_domain_tld: "|/bin/procmail -a user@domain.tld"
user_another_tld: "|/bin/procmail -a user@another.tld"

Solution a) is nice to have, because it changes the accepted syntax in virtusertable and one has to have only check one file over the time, where solution b) wins because of the easy way to achieve it, which is in addition more compatible with future releases of sendmail. After all the work, I use solution a), but I will change it to solution b) after christmas ;)

Jimmy Koerting
  • 151
  • 1
  • 8
  • 1) Have you considered using custom sendmail.cf rules and `text` map lookups into dopvecot's userdb/password files? 2) Do you plan to submit your patches to sendmail.org? – AnFi Dec 22 '13 at 09:52
  • 1) I did this exactly that way, but `sendmail/recipient.c` is still invoked, so it's not possible to achieve this without a patch 2) Noone seems to be interested as my inital question to this problem was even set on hold by some super-php-hackers on stackoverflow.... Sometimes even I'm huffy ;) – Jimmy Koerting Dec 22 '13 at 12:18
  • oh to 2) -> except YOU, what I really appreciate!! – Jimmy Koerting Dec 22 '13 at 13:11
  • Sendmail hacking questions and answers are ALWAYS appreciated. There are lots of us running sendmail with complex requirements, and we are very tired of every question being answered with: "why don't you run Postfix". – Chris Nadovich Aug 28 '19 at 16:52