Sendmail omnios

From Asenjo
Revision as of 14:40, 4 September 2015 by Natxo (Talk | contribs)

Jump to: navigation, search


in order to get e-mail notifications for whatever software you may use you need to install and configure sendmail (no kidding).

In my case I needed to relay through my provider, upc.nl. Their smarthost is smtp.upcmail.nl. Let's do it!

install sendmail

by default omnios installs no mailer, so we need to install it:

# pkg install sendmail
           Packages to install:  1
       Create boot environment: No
Create backup boot environment: No
            Services to change:  1

DOWNLOAD                                  PKGS       FILES    XFER (MB)
Completed                                  1/1     133/133      1.3/1.3

PHASE                                        ACTIONS
Install Phase                                205/205

PHASE                                          ITEMS
Package State Update Phase                       1/1
Image State Update Phase                         2/2

We need to enable it to have it start on boot, of course:

svcadm enable sendmail

configuration

we need to modify an mc file that will be used to 'compile' the configuration file using m4.

The config dir in omnios for sendmail is /etc/mail/. The main config file is /etc/mail/sendmail.cf, but you must not edit this file directly. Instead, go to /etc/mail/cf/cf and copy the macro file main.mc to whatever.mc. This is my mc file:

divert(0)dnl
VERSIONID(`sendmail.mc (Sun)')
OSTYPE(`solaris8')dnl
DOMAIN(`solaris-generic')dnl
define(`SMART_HOST', `smtp.upcmail.nl')dnl
EXPOSED_USER(`root')dnl
FEATURE(`genericstable',`hash -o /etc/mail/genericstable.db')dnl
GENERICS_DOMAIN_FILE(`/etc/mail/generics-domains')dnl

FEATURE(always_add_domain)dnl
FEATURE(`masquerade_entire_domain')dnl
FEATURE(`masquerade_envelope')dnl
FEATURE(`allmasquerade')dnl
MASQUERADE_AS(`asenjo.nl')dnl
MASQUERADE_DOMAIN(`zone4.asenjo.nl.')dnl
MASQUERADE_DOMAIN(localhost)dnl
MASQUERADE_DOMAIN(localhost.localdomain)dnl

MAILER(`smtp')dnl

after that, compile the config file (from /etc/mail/cf/cf):

m4 ../m4/cf.m4 whatever.mc > whatever.cf

I will not explain the settings, you may buy the bat book to learn all you ever wanted to know about sendmail but were to shy to ask. Suffice to say, this works for me.

masquerade addresses

upc.nl will not let me relay unless I say my from: address is something they like. So that is why I use the masquerading directives.

genericstable

we need to give root a decent from: address, so I make a genericstable file like this:

root    user@domain.nl

and compile the database with

makemap -r hash genericstable.db < genericstable

copy config file

copy the whatever.cf file we just compiled to /etc/mail/sendmail.cf and restart the sendmail daemon:

svcadm refresh sendmail