IBM Support

Configuring masquerading in AIX sendmail using generics table

How To


Summary

Masquerading can we defined as rewriting the sender address in the outgoing email, so to the recipient it will appear as coming from different email address. It is usually configured to hide the username or hostname or both of the sender for security reasons or for mail routing purpose. It is also called enveloping.

Steps

1. Create a /etc/mail/genericstable file:
# cat /etc/mail/genericstable
root noreply@test.com        
2. Generate genericstable.db file in /etc/mail directory
# cd /etc/mail
# makemap hash /etc/mail/genericstable < /etc/mail/genericstable 
3. Verify contents of genericstable.db file: 
# makemap -u hash /etc/mail/genericstable 
4. Make the following changes in the submit.cf 
  •  comment following line, like this:
       # FR-o /etc/mail/relay-domains
  •  Below line "D{MTAHost}[127.0.0.1]", add the following line so it should look as:
        D{MTAHost}[127.0.0.1]
       Kgenerics hash /etc/mail/genericstable
  •  Below line "SMasqHdr=93", add the following:
 # handle generics database
        R$+ < @ $=G . >    $: < $1@$2 > $1 < @ $2 . > @    mark
        R$+ < @ *LOCAL* >    $: < $1@$j > $1 < @ *LOCAL* > @    mark
        R< $+ > $+ < $* > @    $: < $(generics $1 $: @ $1 $) > $2 < $3 >
        R<@$+ + $* @ $+> $+ < @ $+ >
                   $: < $(generics $1+*@$3 $@ $2 $:@$1 + $2@$3 $) >  $4 < @ $5 >
        R<@$+ + $* @ $+> $+ < @ $+ > 
                   $: < $(generics $1@$3 $: $) > $4 < @ $5 >
        R<@$+ > $+ < @ $+ >    $: < > $2 < @ $3 >
        R< > $+ < @ $+ . >    $: < $(generics @$2 $@ $1 $: $) > $1 < @ $2 . >
        R< > $+ < @ $+ >     $: < $(generics $1 $: $) > $1 < @ $2 >
        R< > $+ + $* < @ $+ >     $: < $(generics $1+* $@ $2 $: $) > $1 + $2 < @ $3 >
        R< > $+ + $* < @ $+ >     $: < $(generics $1 $: $) > $1 + $2 < @ $3 >
        R< $* @ $* > $* < $* >    $@ $>canonify $1 @ $2        found qualified
        R< $+ > $* < $* >    $: $>canonify $1 @ *LOCAL*    found unqualified
        R< > $*            $: $1                not found
  •  Commnet following line using '#':
       Like this:
      # R$* < @ *LOCAL* >    $@ $1 < @ $j . >   
  •   Just below the above line add following lines:
        # special case the users that should be exposed
         R$=E < @ *LOCAL* >     $@ $1 < @ $j . >
         R$=E < @ $=M . >     $@ $1 < @ $2 . >
         R$=E < @ $=w . >     $@ $1 < @ $2 . >
         # handle domain-specific masquerading
         R$* < @ $=M . > $*     $: $1 < @ $2 . @ $M > $3 convert masqueraded doms
         R$* < @ $=w . > $*     $: $1 < @ $2 . @ $M > $3
         R$* < @ *LOCAL* > $*     $: $1 < @ $j . @ $M > $2
         R$* < @ $+ @ > $*     $: $1 < @ $2 > $3  #$M is null
         R$* < @ $+ @ $+ > $*     $: $1 < @ $3 . > $4  #$M is not null
  • Below "SMasqEnv=94" add the following:
       #R$* < @ *LOCAL* > $*    $: $1 < @ $j . > $2
          R$+            $@ $>93 $1

5. If sendmail daemon is already running, refresh it to read the changes:
# refresh -s sendmail 

Note 1: If sendmail daemon is not running then step 5 is not required, instead start the sendmail daemon using startsrc -s sendmail -a " -bd -q30m"
Note 2: if submit.cf is not present(in levels below 7200-04) then make the changes from step 4 in sendmail.cf.
NOTE 3: genericstable.db must have read permission for everyone.
 

Additional Information

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Author: Mayank Sonakiya
Operating System: AIX and VIOS
Hardware: Power
Feedback: aix_feedback@wwpdl.vnet.ibm.com, msonakiy@in.ibm.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Document Location

Worldwide

[{"Line of Business":{"code":"LOB08","label":"Cognitive Systems"},"Business Unit":{"code":"BU058","label":"IBM Infrastructure w\/TPS"},"Product":{"code":"SWG10","label":"AIX"},"ARM Category":[{"code":"a8m0z0000001fMuAAI","label":"AIX General Support"}],"ARM Case Number":"","Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"All Version(s)"}]

Document Information

Modified date:
15 September 2021

UID

ibm16339231