Skip to content
datadavev edited this page May 26, 2017 · 1 revision

System Email

Email is a convenient, scriptable, asynchronous messaging system for informing humans of some event that occurred on a system.

Each of the data centers at ORC, UNM, and UCSB is configured with an email forwarder that accepts mail from known machines over SMTP. This is preferable to installing postfix on every system just to be able to send email, though that is an option as well.

Email Forwarders

The email forwarders are named mail-ucsb-1.dataone.org, mail-unm-1.dataone.org, and mail-orc-1.dataone.org and are basic Postfix Internet configurations with firewall and other rules limiting access to the service.

Postfix configuration on the forwarders is similar to the following, with adjustments as needed for the specific data center:

sudo dpkg-reconfigure postfix

  General type of mail configuration: Internet Site
  System mail name: mail-unm-1.dataone.org
  Root and postmaster mail recipient: vieglais
  Other destinations to accept mail for:
    mail-unm-1.dataone.org, project.dataone.org, dataone.org, localhost      [1]
  Force synchronous updates on mail queue? No
  Local networks:
    127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128 64.106.40.0/24 64.106.84.0/27
  Mailbox size limit (bytes): 0
  Local address extension character: +
  Internet protocol to use: all

[1] project.dataone.org is the primary host name for the server

The firewall on the mail forwarder must be configured to allow access to the SMTP service from the trusted network:

sudo ufw allow from 64.106.40.0/24 to any port 25

Networks:

UCSB: 128.111.54.0/24
UNM:  64.106.40.0/24
      64.106.84.0/27  #DMZ
UTK:  160.36.13.128/26

Note: Something about the VMNetwork at UTK is blocking most ports even between machines on the LAN. The SMTP server there is running on port 80 with firewall rules blocking outside access until this can be resolved (DV-20170520):

in /etc/postfix/master.cf, change the line:

  smtp inet n – y – – smtpd

to

  80 inet n – y – – smtpd

Restart postfix

Email Client

Any SMTP client should suffice for sending email from a server on the trusted network. heirloom-mailx is a lightweight, apt managed mail client that supports SMTP and is easily scripted.

Installation

sudo apt-get install heirloom-mailx

Then set a default SMTP server by adding the following to the end of /etc/nail.rc or /etc/s-nail.rc on 16.04 or later systems (adjust as appropriate for the data center):

set smtp=mail-unm-1.dataone.org

Sending Mail

To send an email to user1@example.com and user2@other.org:

echo "This is the message body" | mailx -r "vieglais@cn-unm-1.dataone.org" \
-s "This is the subject" \
user1@example.com user2@other.org

Problems?

Start by checking /var/log/mail on the mail forwarder for the network. Google stuff from there.

Clone this wiki locally