Blame doc/milter.rst

Pierre-Yves Chibon 0d5ccf
Pagure's Milter
Pierre-Yves Chibon 0d5ccf
===============
Pierre-Yves Chibon 0d5ccf
Pierre-Yves Chibon fed671
`Milter <http: milter_readme.html="" www.postfix.org="">`_ are script executed by</http:>
Pierre-Yves Chibon 0d5ccf
postfix upon sending or receiving an email.
Pierre-Yves Chibon 0d5ccf
Pierre-Yves Chibon 0d5ccf
We use this system to allow pagure's users to comment on a ticket (or a
Pierre-Yves Chibon 0d5ccf
pull-request) by directly replying to the email sent as a notification.
Pierre-Yves Chibon 0d5ccf
Pierre-Yves Chibon 0d5ccf
Pagure's milter is designed to be run on the same machine as the mail server
Pierre-Yves Chibon 0d5ccf
(postfix by default). Postfix connecting to the milter via a unix socket.
Pierre-Yves Chibon 0d5ccf
Pierre-Yves Chibon 0d5ccf
The milter itself is a service managed by systemd.
Pierre-Yves Chibon 0d5ccf
You can find all the relevant files for the milter under the ``milters`` folder
Pierre-Yves Chibon 0d5ccf
in the sources.
Pierre-Yves Chibon 0d5ccf
Pierre-Yves Chibon 0d5ccf
Pierre-Yves Chibon 0d5ccf
Install the milter
Pierre-Yves Chibon 0d5ccf
------------------
Pierre-Yves Chibon 0d5ccf
Pierre-Yves Chibon 0d5ccf
The first step to enable the milter on a pagure instance is thus to install the
Pierre-Yves Chibon 0d5ccf
``.service`` file for systemd and place the corresponding script that, by
Pierre-Yves Chibon 0d5ccf
default, should go to ``/usr/share/pagure/comment_email_milter.py``.
Pierre-Yves Chibon 0d5ccf
Pierre-Yves Chibon 0d5ccf
If you are using the RPM, install ``pagure-milters`` should provide and install
Pierre-Yves Chibon 0d5ccf
all the files correctly.
Pierre-Yves Chibon 0d5ccf
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
Activate the milter
Pierre-Yves Chibon ae5c86
-------------------
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
Make sure the milter is running and will be automaticall started at boot by
Pierre-Yves Chibon ae5c86
running the commands:
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
To start the milter:
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
::
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
    systemctl start pagure_milter
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
To ensure the milter is always started at boot time:
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
::
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
    systemctl enable pagure_milter
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
Activate the milter in postfix
Pierre-Yves Chibon ae5c86
------------------------------
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
To actually activate the milter in postfix is in fact really easy, all it takes
Pierre-Yves Chibon ae5c86
is two lines in the ``main.cf`` file of postfix:
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
::
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
    non_smtpd_milters = unix:/var/run/pagure/paguresock
Pierre-Yves Chibon ae5c86
    smtpd_milters = unix:/var/run/pagure/paguresock
Pierre-Yves Chibon ae5c86
Pierre-Yves Chibon ae5c86
These two lines are pointing to the unix socket used by postfix to communicate
Pierre-Yves Chibon ae5c86
with the milter. This socket is defined in the milter file itself, in the
Pierre-Yves Chibon ae5c86
sources: ``milters/comment_email_milter.py``.
Pierre-Yves Chibon ae5c86