Thursday, January 11, 2018

Sendmail in 2018: What went wrong with my Life


Subtitle: Even determining the code version is awful !

Sendmail: The Vietnam of Berkley Unix
I stole the title from the 1994 Edition of the UNIX Haters Handbook.

It's not quite that bad, but sendmail, the UNIX and now therefore a LINUX mailer program needs to be treated with some respect.

The Need
Email is still quite an efficient way to receive summary or interrupt information about your computer system.  For example,  on your server you might run some significant  program once per day, say make a backup to the cloud.   You can send summary statistics or precise details of an error in an email once per day.

Email is an interrupt mechanism, because assuming you read your email daily you will see it.  Else your server could generate a local webpage and then you'd install a local webserver on that computer that would be your job to have a daily look at.   But of course you might not bother, whereas surely with email, you check that daily  (right?!?)

For Marcus and Agata we setup some of our more critical server computers to mail us on error. And maybe in the future we can make a general purpose LAN accessible SMS gateway, and migrate to that when ready.



Some of the Config

Updating /etc/mail/access...
Linking /etc/aliases to /etc/mail/aliases
Informational: ALIAS_FILE file empty: /etc/mail/aliases
Updating /etc/mail/aliases...
/etc/mail/aliases: 0 aliases, longest 0 bytes, 0 bytes total

Warning: 3 database(s) sources
        were not found, (but were created)
        please investigate.
Setting up libgsasl7 (1.8.0-8ubuntu2) ...
Setting up libkyotocabinet16v5:amd64 (1.2.76-4.1) ...
Setting up mailutils-common (1:2.99.99-1ubuntu2) ...
Setting up mysql-common (5.7.20-0ubuntu0.16.04.1) ...
update-alternatives: using /etc/mysql/my.cnf.fallback to provide /etc/mysql/my.cnf (my.cnf) in auto mode
Setting up libmysqlclient20:amd64 (5.7.20-0ubuntu0.16.04.1) ...
Setting up libmailutils4:amd64 (1:2.99.99-1ubuntu2) ...
Setting up mailutils (1:2.99.99-1ubuntu2) ...
update-alternatives: using /usr/bin/frm.mailutils to provide /usr/bin/frm (frm) in auto mode
update-alternatives: using /usr/bin/from.mailutils to provide /usr/bin/from (from) in auto mode
update-alternatives: using /usr/bin/messages.mailutils to provide /usr/bin/messages (messages) in auto mode
update-alternatives: using /usr/bin/movemail.mailutils to provide /usr/bin/movemail (movemail) in auto mode
update-alternatives: using /usr/bin/readmsg.mailutils to provide /usr/bin/readmsg (readmsg) in auto mode
update-alternatives: using /usr/bin/dotlock.mailutils to provide /usr/bin/dotlock (dotlock) in auto mode
update-alternatives: using /usr/bin/mail.mailutils to provide /usr/bin/mailx (mailx) in auto mode

# strip group: syntax (not inside angle brackets!) and trailing semicolon
R$*                     $: $1 <@>                       mark addresses
R$* < $* > $* <@>       $: $1 < $2 > $3                 unmark <addr>
R@ $* <@>               $: @ $1                         unmark @host:...
R$* [ IPv6 : $+ ] <@>   $: $1 [ IPv6 : $2 ]             unmark IPv6 addr
R$* :: $* <@>           $: $1 :: $2                     unmark node::addr
R:include: $* <@>       $: :include: $1                 unmark :include:...
R$* : $* [ $* ]         $: $1 : $2 [ $3 ] <@>           remark if leading colon
R$* : $* <@>            $: $2                           strip colon if marked
R$* <@>                 $: $1                           unmark


include(`/etc/mail/m4/dialup.m4')dnl
include(`/etc/mail/m4/provider.m4')dnl
dnl #
dnl # Default Mailer setup
define(`SMART_HOST',`[smtp.gmail.com]')dnl
define(`RELAY_MAILER_ARGS', `TCP $h 587')dnl
define(`ESMTP_MAILER_ARGS', `TCP $h 587')dnl
define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`EXTERNAL DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `EXTERNAL GSSAPI DIGEST-MD5 CRAM-MD5 LOGIN PLAIN')dnl


<<< 530-5.5.1 Authentication Required. Learn more at
<<< 530 5.5.1  https://support.google.com/mail/?p=WantAuthError o65sm19427416wmi.42 - gsmtp
554 5.0.0 Service unavailable

--w0ALf2cL021258.1515620462/pan.amaus
Content-Type: message/delivery-status

Reporting-MTA: dns; pan.amaus
Received-From-MTA: DNS; localhost
Arrival-Date: Wed, 10 Jan 2018 22:41:00 +0100
?
No applicable message
? d1-3


An Easier Way

I was about to scream with malfunction, but then I did find this simplified guide to configuring gmail and sendmail   This will take about 10 minutes of your time

Note that you need to reduce the security level of your gmail account so I would recommend creating a separate gmail for this sendmail pairing  i.e. don't use any of your personal accounts.

Create a gmail account here

So it's all working now and I recommend that guide to get things done quickly and efficiently.






And Now



This song somehow seemed appropriate