Sendmail v8.7+

  1. What is Sendmail ?

  2. Where to get Sendmail.

  3. How Sendmail processes mail.

  4. Autopsy of the Rulesets.

  5. The emails path through the rulesets.

  6. Mailer Definitions.

  7. m4 macros.

  8. A walk through of a typical m4 macro file.

  9. Masquerading and Sendmail for the SOHO.

  10. New v8.10 features.

  11. Q'n'A.

What is Sendmail ?

How Sendmail processes mail

Autopsy of the Rulesets

Macros

Class Macros

Database Macros
  • Database macros allows sendmail to look up and match over large volumes of data.
  • However they are more difficult to setup.
  • Unlike other Macros a change to the database is immediately available to sendmail.
  • To make a d.b. for sendmail use the makemap command.

    makemap switches class file

    Switches
    -d Allow the database to conatin dulpicate keys
    -f Preserve uppercase
    -N Append null byte to all keys
    -o Append to d.b
    -r Replace(silently) duplicate keys

    Source - Sendmail, O'Reilly

  • The class depends upon the syle of the database you want to create and what database formats have been compiled into sendmail. The command 'strings /usr/lib/sendmail | grep map_open' returns the db info for sendmail.

    faye@morpheus faye]$ strings /usr/lib/sendmail | grep map_open

    bt_map_open(%s, %s, %d)
    hash_map_open(%s, %s, %d)
    db_map_open: cannot pre-open database %s
    db_map_open(%s): file changed after pre-open
    db_map_open(%s): cannot fstat pre-opened file
    db_map_open: cannot lock %s
    db_map_open(%s): file changed after open
    nis_map_open(%s, %s, %d)
    nis_map_open: yp_match(@, %s, %s) => %s
    text_map_open(%s, %s, %d)
    text_map_open(%s, %s): delimiter =
    stab_map_open(%s, %s, %d)
    impl_map_open(%s, %s, %d)
    user_map_open(%s, %d)
    switch_map_open(%s, %s, %d)

  • Database macros are defined in the sendmail.cf file useing the 'K' command, i.e.

    K my_database class switched file_or_map

    ClassVersionDescription
    btree8.1+Berkeley's db form old database
    bestmx8.7+Look up the best MX record for a host
    dbm8.1+Really ndbm supplied with most verions of UNIX
    dequote8.1+A pseudo map for removing quotation marks
    hash8.1+Berkeley's db form od daabase
    hesiod8.7+MIT network user authentication services
    host8.1+Internal table to store and look up hostnames
    implicit8.1+Search for an aliases database file
    ldapx8.8+The Lightweight directory Access Protocol
    netinfo8.7+NeXT Computers network information services
    nis8.1+Sun's Network Inormation Services (NIS)
    nisplus8.7+Sun's newer Network Information Services (NIS+)
    null8.7+Provide a never found service
    program8.7+Run an external program to look up the key
    sequence8.7+Search a series of maps
    stab8.1+Internally load aliases into the symbol table
    switch8.7+Internal hook to auto-build sequences
    text8.7+Look up in flat text files
    userdb8.7+Look up in the User Database
    user8.7+Look up local passwd information

    Source - Sendmail, O'Reilly

    SwitchVersionDescription
    -A8.7+Append values for duplicate keys
    -a8.1+Append tag on successful match
    -f8.1+Don't fold keys to lowercase
    -k8.7+Specify column for key
    -m8.1+Suppress replacement on match
    -N8.1+Append a null byte to all keys
    -O8.2+Adaptive versus never add a null
    -o8.1+The database file is optional
    -q8.7+Don't strip quotes from key
    -s8.7+Space replacement character
    -v8.7+Specify the value's column
    -z8.7+Specify the column delimiter

    Source - Sendmail, O'Reilly
  • Sendmail uses database searches with the $(   $) or $[   $] syntax

  • $( name key $@$1 $@text2 $:default $)

    This checks for the map to 'key' in the defined database 'name'. If it returns a value , that value is rewritten by '$@$1 $@text2'. If the key does not match in the database then the value 'default' is return. Database lookups can get very complex!

  • The $[   ]$ is special syntax used for resolving hosts and IP addresses.
  • More database definitions are added to the distribution every release, newer one include the regex, for matching regular expressions.

Rules

Rule Sets

 

 

The emails path through the rule sets

Mailer Definitions

m4 Macros

 

 

Sendmail for the SOHO

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

8.10.1 Features