The following stages are required to configure sendmail integration:
- Install sendmail if needed
- Enable manual sendmail configuration
- Edit sendmail configuration file
- Configure daemon options
- Add Jiglu mailer to sendmail configuration file
- Enable mailertable and access features in sendmail configuration file
- Add Jiglu mailer to mailertable
- Add Jiglu domain to access table
- Compile the sendmail configuration file and rebuild databases
- Restart sendmail
- Test configuration
Not all these stages will necessarily be required, depending on the Linux distribution and the integration required.
Install sendmail if needed
Sendmail may not be the default MTA on some Linux distributions.
To install it on OpenSuse use:
zypper install sendmail sendmail-devel
When prompted, you should choose the option to remove Postfix.
On Amazon Linux, Fedora or Redhat you will need to install the configuration and milter packages:
yum install sendmail sendmail-cf sendmail-milter
Enable manual sendmail configuration
In OpenSuse it will be necessary to edit /etc/sysconfig/mail to disable automatic generation of the sendmail configuration file and to enable outside connections.
Change MAIL_CREATE_CONFIG
to "no"
and SMTPD_LISTEN_REMOTE
to "yes"
.
Edit sendmail configuration file
In OpenSuse the sendmail definition file will be /etc/mail/linux.mc
, in Amazon Linux, Fedora and Redhat it will be /etc/mail/sendmail.mc
. You will need to edit this file to configure sendmail for use by Jiglu.
Configure daemon options
To allow mail to be sent from elsewhere to Jiglu you will need to change the DAEMON_OPTIONS line so it can listen on all interfaces:
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
To allow Jiglu to submit messages to sendmail you will need to uncomment the submission DAEMON_OPTIONS line so it does not require authentication and only listens on the localhost interface:
DAEMON_OPTIONS(`Port=submission, Addr=127.0.0.1, Name=MSA, M=E')dnl
Add jiglu mailer
Jiglu uses a sendmail mailer definition to have sendmail forward on messages to the /opt/jiglu/sbin/queuemail
executable. This is a tiny program written in C that will take an incoming message on stdin and write it to the Jiglu incoming mail spool file.
The Jiglu RPM installs the mailer definition file in both the /usr/share/sendmail/mailer
and /usr/share/sendmail-cf/mailer
directories. In OpenSuse the former directory will be used, in Amazon Linux, Fedora and Redhat the latter will be used.
To enable sendmail to use the Jiglu mailer, add the following to the end of the sendmail definition file:
MAILER(`jiglu')dnl
Note that in sendmail definitions the first tick is a backtick and the second an apostrophe.
Add Jiglu milter
If the Jiglu mailer was used on its own then if you sent a message to an address on the Jiglu domain that did not exist it would be necessary for sendmail to receive it in full, forward it on to Jiglu and then Jiglu would need to return a message to the sender saying the address could not be found. Instead when the connection is first made to sendmail, sendmail can ask Jiglu if it knows about the address using a milter. To enable this, add the following to the end of the sendmail definition file:
INPUT_MAIL_FILTER(`jiglufilter', `S=inet:25000@localhost, T=C:20s;S:10s;R:15s;E:30s')dnl
There are some additional settings in the bootstrap.
properties
configuration file to control milter usage, including using it to reject messages from senders that are unknown by the Jiglu system.
Enable mailertable and access features
Jiglu makes use of the mailertable feature to route messages for the Jiglu mail domain to the Jiglu mailer. Make sure that the following line exists or is uncommented in the sendmail.
mc
file:
FEATURE(`mailertable', `hash -o /etc/mail/mailertable.db')dnl
Jiglu also needs sendmail to know that it handles mail for this domain using the access table feature. Make sure that the following line exists or is uncommented in the linux.mc
or sendmail.
mc
file:
FEATURE(`access_db', `hash -T<TMPF> -o /etc/mail/access.db')dnl
Add Jiglu mailer to mailertable
Sendmail now needs to know how to route messages for the Jiglu domain to the Jiglu mailer. Edit the file /etc/mail/mailertable
and add the following line:
jiglu.example.com jiglu:default
Replacing jiglu.example.com
with the domain name used by the system, as set in the com.jiglu.mail.domain
property in bootstrap.properties
.
Add Jiglu domain to access table
Sendmail also needs to know that it is responsible for access to the Jiglu domain. Edit the file /etc/mail/access
and ad the following line:
jiglu.example.com RELAY
Again replacing jiglu.example.com
with the domain name used by the system, as set in the com.jiglu.mail.domain
property in bootstrap.properties
. Note that this domain should not appear in /etc/mail/local-host-names or sendmail will consider it used for local users that exist on the machine.
Compile the sendmail configuration file and rebuild databases
The sendmail definition file needs to be compiled into the form used by sendmail before it can be used. The databases also need to be rebuilt.
In OpenSuse use:
m4 /etc/mail/linux.mc > /etc/sendmail.cf
make
In Amazon Linux, Fedora or Redhat instead use:
/etc/mail/make
Restart sendmail
To restart sendmail use:
systemctl restart sendmail
Test configuration
To check that everything is configured correctly, you can ask sendmail to confirm how it will deliver messages to the Jiglu domain. Enter:
/usr/sbin/sendmail –bv (Address removed)
Again replacing jiglu.example.com
with the domain name used by the system, as set in the com.jiglu.mail.domain
property in bootstrap.properties
. You should get a result similar to the below:
(Address removed)... deliverable: mailer jiglu, host jiglu, user (Address removed)