2

the feature I am after is similar to the postfix's relay_recipients, but I need to do it in sendmail. I have a list of known good recipient addresses on a server for which this machine acts as the net-facing frontend (mail comes in from the outside, it is pre-processed on the outer box and eventually relayed to the inner box . the corporate mail server) I cannot do call-forward or LDAP queries tho'.

It is probably a feature of one of of sendmail's *.db files, but my memory or understanding - or both - are currently failing me.

Note: This is a mailwatch/mailscanner box, so mail is queued locally, filtered, then delivered.

Alien Life Form
  • 2,309
  • 2
  • 21
  • 32
  • The only way I see is writing a custom milter, or finding one that already does it. – drookie Feb 24 '16 at 16:23
  • You could use milter-regexp, but you'll have to present the *good* recipients as a set of patterns. I wouldn't call this a perfect solution. – drookie Feb 24 '16 at 16:25

2 Answers2

3

You can use FEAUTURE(virtusertable) to get equivalent of postfix relay_recipients_maps

sendmail.mc

LOCAL_CONFIG
dnl virtusertable works by default only for local email domains
dnl $={VirtHost} lists non local domains served by virtusertable
C{VirtHost}example.net
divert(0)
dnl  _VIRTUSER_STOP_ONE_LEVEL_RECURSION_ is described in m4/proto.m4 file
define(`_VIRTUSER_STOP_ONE_LEVEL_RECURSION_')dnl
FEATURE(`virtusertable')

virtusertable file (requires makemap compilation):

# list of valid emails in example.net
johh.doe@example.net %0
jane.doe@example.net %0
# default entry for example.net
@example.net  ERROR:5.1.1:550 User unknown

https://groups.google.com/forum/#!topic/comp.mail.sendmail/owHMoZIAkDg news:comp.mail.sendmail thread from 2006.

BTW you can use FEATURE(ldap_routing) with standard sendmail maps (hash,btree,..) instead of LDAP lookups.

AnFi
  • 6,103
  • 1
  • 14
  • 27
  • Sounds cool, I'll try that. (I was experimenting with access.db, along the lines of: To:user@dom.ain OK To:dom.ain DENY which also appears to work. – Alien Life Form Feb 26 '16 at 16:54
0

I eventually resorted to using access ( FEATURE(access_db',hash -T -o /etc/mail/access.db') ) thusly:

To:u1@dom.ain   RELAY
To:u2@dom.ain   RELAY
....
robintur.it     DENY

The behaviour is as required.

Alien Life Form
  • 2,309
  • 2
  • 21
  • 32