• Email aliases using ip address syntax [a.b.c.d.] always using smarthost

    From Francisco Amaro@21:1/5 to All on Tue Apr 12 06:20:51 2022
    Hello,

    I'm having an issue with a simple sendmail setup, emails aliases on the form

    user: remoteuser@[a.b.c.d]

    are not sending the email directly to [a.b.c.d], but are always using the smart host defined in sendmail.mc

    I have a mailertable with just one domain, directing all emails to our old server, that them process them directly or forwards them to other hosts.

    localdomain.com relay:[192.168.254.121]

    This is working fine.
    And them a virtualusertable with the usernames I want to process locally;

    user@domain.com localuser

    The ideia behind this was to move all users from the old server to the new one, starting with the most used ones... as this is an older server not everything is well documented and we would like to keep things working...
    With local delivery to local users, it's working fine. But forwarding to other servers, I have the same issues as using the local /etc/aliases file, it always use the smarthost.

    Anybody has an ideia why is this happening ? What do I need to change so I can redirect emails directly to other hosts, bypassing the smarthost ?

    This is on RHEL8, using sendmail 8.15

    My redacted sendmail.mc is the following :

    [root@mail02 mail]# egrep -v "^dnl" sendmail.mc
    divert(-1)dnl
    include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
    VERSIONID(`setup for linux')dnl
    OSTYPE(`linux')dnl
    define(`confLOG_LEVEL', `19')dnl
    define(`SMART_HOST', `sh.domain.com')dnl
    define(`confDEF_USER_ID', ``8:12'')dnl
    define(`confTO_CONNECT', `1m')dnl
    define(`confTRY_NULL_MX_LIST', `True')dnl
    define(`confDONT_PROBE_INTERFACES', `True')dnl
    define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl
    define(`ALIAS_FILE', `/etc/aliases')dnl
    define(`STATUS_FILE', `/var/log/mail/statistics')dnl
    define(`UUCP_MAILER_MAX', `2000000')dnl
    define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl
    define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl define(`confAUTH_OPTIONS', `A')dnl
    define(`confAUTH_REALM', `mail')dnl
    define(`confCACERT_PATH', `/etc/mail/certs')dnl
    define(`confCACERT', `/etc/mail/certs/CA.pem')dnl
    define(`confTLS_SRV_OPTIONS', `V')dnl
    define(`confTO_IDENT', `0')dnl
    FEATURE(`no_default_msa', `dnl')dnl
    FEATURE(`smrsh', `/usr/sbin/smrsh')dnl
    FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl VIRTUSER_DOMAIN(`localdomain.com')dnl
    FEATURE(redirect)dnl
    FEATURE(always_add_domain)dnl
    FEATURE(use_cw_file)dnl
    FEATURE(use_ct_file)dnl
    define(`LUSER_RELAY',`local:bouncedemail')
    FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl FEATURE(`blacklist_recipients')dnl
    EXPOSED_USER(`root')dnl
    FEATURE(`accept_unresolvable_domains')dnl LOCAL_DOMAIN(`localhost.localdomain')dnl
    MASQUERADE_AS(`localdomain.com')dnl
    FEATURE(masquerade_envelope)dnl
    FEATURE(masquerade_entire_domain)dnl
    MAILER(smtp)dnl
    MAILER(procmail)dnl

    Access file is

    Connect:localhost.localdomain RELAY
    Connect:localhost RELAY
    Connect:127.0.0.1 RELAY
    Connect:192.168.1.121 RELAY
    Connect:172 RELAY
    Connect:10.235 RELAY
    Connect:10.236 RELAY
    Connect:10.237 RELAY
    Connect:localdomain.com RELAY
    10.235.200.184 RELAY

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Andrzej Adam Filip@21:1/5 to Francisco Amaro on Tue Apr 12 14:57:02 2022
    Francisco Amaro <famaro@gmail.com> wrote:
    Hello,

    I'm having an issue with a simple sendmail setup, emails aliases on the form

    user: remoteuser@[a.b.c.d]

    are not sending the email directly to [a.b.c.d], but are always using the smart host defined in sendmail.mc

    I have a mailertable with just one domain, directing all emails to our old server, that them process them directly or forwards them to other hosts.

    localdomain.com relay:[192.168.254.121]

    This is working fine.
    And them a virtualusertable with the usernames I want to process locally;

    user@domain.com localuser

    The ideia behind this was to move all users from the old server to the
    new one, starting with the most used ones... as this is an older
    server not everything is well documented and we would like to keep
    things working...
    With local delivery to local users, it's working fine. But forwarding
    to other servers, I have the same issues as using the local
    /etc/aliases file, it always use the smarthost.

    Anybody has an ideia why is this happening ? What do I need to change so I can redirect emails directly to other hosts, bypassing the smarthost ?

    This is on RHEL8, using sendmail 8.15

    My redacted sendmail.mc is the following :

    [root@mail02 mail]# egrep -v "^dnl" sendmail.mc
    divert(-1)dnl
    include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
    VERSIONID(`setup for linux')dnl
    OSTYPE(`linux')dnl
    define(`confLOG_LEVEL', `19')dnl
    define(`SMART_HOST', `sh.domain.com')dnl
    define(`confDEF_USER_ID', ``8:12'')dnl
    define(`confTO_CONNECT', `1m')dnl
    define(`confTRY_NULL_MX_LIST', `True')dnl
    define(`confDONT_PROBE_INTERFACES', `True')dnl
    define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl
    define(`ALIAS_FILE', `/etc/aliases')dnl
    define(`STATUS_FILE', `/var/log/mail/statistics')dnl define(`UUCP_MAILER_MAX', `2000000')dnl
    define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl define(`confAUTH_OPTIONS', `A')dnl
    define(`confAUTH_REALM', `mail')dnl
    define(`confCACERT_PATH', `/etc/mail/certs')dnl
    define(`confCACERT', `/etc/mail/certs/CA.pem')dnl define(`confTLS_SRV_OPTIONS', `V')dnl
    define(`confTO_IDENT', `0')dnl
    FEATURE(`no_default_msa', `dnl')dnl
    FEATURE(`smrsh', `/usr/sbin/smrsh')dnl
    FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl VIRTUSER_DOMAIN(`localdomain.com')dnl
    FEATURE(redirect)dnl
    FEATURE(always_add_domain)dnl
    FEATURE(use_cw_file)dnl
    FEATURE(use_ct_file)dnl
    define(`LUSER_RELAY',`local:bouncedemail')
    FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl FEATURE(`blacklist_recipients')dnl
    EXPOSED_USER(`root')dnl
    FEATURE(`accept_unresolvable_domains')dnl LOCAL_DOMAIN(`localhost.localdomain')dnl
    MASQUERADE_AS(`localdomain.com')dnl
    FEATURE(masquerade_envelope)dnl
    FEATURE(masquerade_entire_domain)dnl
    MAILER(smtp)dnl
    MAILER(procmail)dnl

    Access file is

    Connect:localhost.localdomain RELAY
    Connect:localhost RELAY
    Connect:127.0.0.1 RELAY
    Connect:192.168.1.121 RELAY
    Connect:172 RELAY
    Connect:10.235 RELAY
    Connect:10.236 RELAY
    Connect:10.237 RELAY
    Connect:localdomain.com RELAY
    10.235.200.184 RELAY

    1, You can use mailertable to exclude some non local destination from
    relaying via smart host. It seems that mailertable is not consulted for
    "ip domains" ([a.b.c.d]

    2. My classic suggestion is to use organization domain name
    (example.com) and per host domain names (oldhost.example.com, newhost.example.com).
    On oldhost use mailertable to exclude newhost.example.com from smart
    host routing. It should make aliases and virtusertable work with
    "per host" (sub) domain names.

    In case of problem use the following email routing test commands.
    Each further stage stage adds extra dignostics

    sendmail -bv JohnDone@some.domain
    # test map lookupss including mailertable lookups
    sendmail -d60.5 JohnDone@some.domain
    # test also rewriting rules (no aliases)
    echo '3,0 JohnDone@some.domain" | sendmail -bt -d60.5 -d21.12


    --
    [Andrew] Andrzej A. Filip

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Francisco Amaro@21:1/5 to All on Tue Apr 12 09:36:45 2022
    Hello Andrzej

    Thank you for your help, but subdomains are not a solution here, not all hosts are on the same top level domain, we don't want to change the configuration on the oldhost, etc.

    I've tried some more of the test commands, one think I noted is that virtualusertable is checked early on the process, so I've tried to do the redirect directly, but no change, it still goes via the smarthost.
    I've also deployed a new clean install (without a smarthost defined) and the aliases work as expected, so it is definitely something in my config that's causing this...

    I'll keep testing stuff...


    A terça-feira, 12 de abril de 2022 à(s) 15:57:12 UTC+1, Andrzej Adam Filip escreveu:
    Francisco Amaro <fam...@gmail.com> wrote:
    Hello,

    I'm having an issue with a simple sendmail setup, emails aliases on the form

    user: remoteuser@[a.b.c.d]

    are not sending the email directly to [a.b.c.d], but are always using the smart host defined in sendmail.mc

    I have a mailertable with just one domain, directing all emails to our old server, that them process them directly or forwards them to other hosts.

    localdomain.com relay:[192.168.254.121]

    This is working fine.
    And them a virtualusertable with the usernames I want to process locally;

    us...@domain.com localuser

    The ideia behind this was to move all users from the old server to the
    new one, starting with the most used ones... as this is an older
    server not everything is well documented and we would like to keep
    things working...
    With local delivery to local users, it's working fine. But forwarding
    to other servers, I have the same issues as using the local
    /etc/aliases file, it always use the smarthost.

    Anybody has an ideia why is this happening ? What do I need to change so I can redirect emails directly to other hosts, bypassing the smarthost ?

    This is on RHEL8, using sendmail 8.15

    My redacted sendmail.mc is the following :

    [root@mail02 mail]# egrep -v "^dnl" sendmail.mc
    divert(-1)dnl
    include(`/usr/share/sendmail-cf/m4/cf.m4')dnl
    VERSIONID(`setup for linux')dnl
    OSTYPE(`linux')dnl
    define(`confLOG_LEVEL', `19')dnl
    define(`SMART_HOST', `sh.domain.com')dnl
    define(`confDEF_USER_ID', ``8:12'')dnl
    define(`confTO_CONNECT', `1m')dnl
    define(`confTRY_NULL_MX_LIST', `True')dnl define(`confDONT_PROBE_INTERFACES', `True')dnl define(`PROCMAIL_MAILER_PATH', `/usr/bin/procmail')dnl define(`ALIAS_FILE', `/etc/aliases')dnl
    define(`STATUS_FILE', `/var/log/mail/statistics')dnl define(`UUCP_MAILER_MAX', `2000000')dnl
    define(`confUSERDB_SPEC', `/etc/mail/userdb.db')dnl define(`confPRIVACY_FLAGS', `authwarnings,novrfy,noexpn,restrictqrun')dnl define(`confAUTH_OPTIONS', `A')dnl
    define(`confAUTH_REALM', `mail')dnl
    define(`confCACERT_PATH', `/etc/mail/certs')dnl
    define(`confCACERT', `/etc/mail/certs/CA.pem')dnl define(`confTLS_SRV_OPTIONS', `V')dnl
    define(`confTO_IDENT', `0')dnl
    FEATURE(`no_default_msa', `dnl')dnl
    FEATURE(`smrsh', `/usr/sbin/smrsh')dnl
    FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl FEATURE(`virtusertable', `hash -o /etc/mail/virtusertable.db')dnl VIRTUSER_DOMAIN(`localdomain.com')dnl
    FEATURE(redirect)dnl
    FEATURE(always_add_domain)dnl
    FEATURE(use_cw_file)dnl
    FEATURE(use_ct_file)dnl
    define(`LUSER_RELAY',`local:bouncedemail')
    FEATURE(local_procmail, `', `procmail -t -Y -a $h -d $u')dnl FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl FEATURE(`blacklist_recipients')dnl
    EXPOSED_USER(`root')dnl
    FEATURE(`accept_unresolvable_domains')dnl LOCAL_DOMAIN(`localhost.localdomain')dnl MASQUERADE_AS(`localdomain.com')dnl
    FEATURE(masquerade_envelope)dnl
    FEATURE(masquerade_entire_domain)dnl
    MAILER(smtp)dnl
    MAILER(procmail)dnl

    Access file is

    Connect:localhost.localdomain RELAY
    Connect:localhost RELAY
    Connect:127.0.0.1 RELAY
    Connect:192.168.1.121 RELAY
    Connect:172 RELAY
    Connect:10.235 RELAY
    Connect:10.236 RELAY
    Connect:10.237 RELAY
    Connect:localdomain.com RELAY
    10.235.200.184 RELAY
    1, You can use mailertable to exclude some non local destination from relaying via smart host. It seems that mailertable is not consulted for
    "ip domains" ([a.b.c.d]

    2. My classic suggestion is to use organization domain name
    (example.com) and per host domain names (oldhost.example.com, newhost.example.com).
    On oldhost use mailertable to exclude newhost.example.com from smart
    host routing. It should make aliases and virtusertable work with
    "per host" (sub) domain names.

    In case of problem use the following email routing test commands.
    Each further stage stage adds extra dignostics

    sendmail -bv John...@some.domain
    # test map lookupss including mailertable lookups
    sendmail -d60.5 John...@some.domain
    # test also rewriting rules (no aliases)
    echo '3,0 John...@some.domain" | sendmail -bt -d60.5 -d21.12


    --
    [Andrew] Andrzej A. Filip

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)