mail_satellite

Overview

Installs and configures a mail server so that it’s possible to send emails either through port 25 or by executing the sendmail command. All email is sent using a smarthost.

It’s mainly useful in two cases:

  1. Forwarding cron email (otherwise the administrator would need to login to see if any cron email has been received locally.)

  2. Being used as the smarthost of applications or services installed on the server. In this case such applications should be configured to use localhost:25 as the smarthost. While they could be configured to use the smarthost directly, using localhost:25 can be useful especially when the smarthost is not in our control, because whenever something doesn’t work we can get some information from Postfix’s logs as to what is going wrong.

Parameters

mail_satellite_mailname

The default domain name that will be used for email addresses that do not contain @.

mail_satellite_smarthost

The smart host, such as relay.example.com.

mail_satellite_smarthostport

The smarthost port, such as 25 or 587 (the default). If the outgoing port is 465 or 587, encrypted connections are forced.

mail_satellite_smarthostusername, mail_satellite_smarthostpassword

The username and password to connect to the smart host. If unspecified it will be connecting unauthenticated.

mail_satellite_masquerade_domains

Optional. This will be used as Postfix’s masquerade_domains parameter. For example, if mail_satellite_mailname is nextcloud.digigov.grnet.gr, you may want to use mail_satellite_masquerade_domains = grnet.gr so that the sender root@nextcloud.digigov.grnet.gr will be converted to grnet.gr.

mail_satellite_canonical_sender

Optional. If set, the sender will be rewritten to this; both the envelope sender and the header sender.

mail_satellite_mail_aliases

A hash that maps local emails to actual addresses, for example:

mail_satellite_mail_aliases:
  root: antonis@example.com,panagiotis@example.com
  www-data: root

You should practically always create an alias for root, and very often for www-data as well, and for everything that uses cron.

Note: We don’t use /etc/aliases for this functionality; Postfix only uses /etc/aliases for local delivery. We use virtual_alias_maps instead.

mail_satellite_inet_interfaces

If loopback-only (the default), it listens only on the local interface. Change it to all (or any value accepted by the postfix inet_interfaces parameter) so that it listens on all interfaces. In that case, you need to care about the firewall yourself. For example, assuming you use the base firewall:

- name: Allow smtp through firewall
  lineinfile:
    path: /etc/nftables/ansible-late.nft
    line: "ip saddr { 1.2.3.4, 5.6.7.8 } tcp dport smtp accept"
  notify: Reload nftables

You also need to set mail_satellite_mynetworks.

mail_satellite_mynetworks

The networks that are allowed to relay. If unset, only the localhost from the local interface is allowed to send emails. If you set it, don’t specify the localhost, this will be included anyway.

See also mail_satellite_inet_interfaces.

The old unprefixed variable names are still accepted for backwards compatibility, but new playbooks should use the mail_satellite_* names above.