Blame doc/install_milter.rst

Pierre-Yves Chibon 7a137a
Installing pagure's milter
Pierre-Yves Chibon 7a137a
==========================
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 18e5d3
A milter is a script that is ran by a Mail Transfer Agent (`MTA
Pierre-Yves Chibon 2edf48
<https: en.wikipedia.org="" message_transfer_agent="" wiki="">`_)</https:>
Pierre-Yves Chibon 18e5d3
upon receiving an email via either a network or an unix socket.
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
If you want more information feel free to check out the corresponding page
Pierre-Yves Chibon 2edf48
on wikipedia: `https://en.wikipedia.org/wiki/Milter
Pierre-Yves Chibon 2edf48
<https: en.wikipedia.org="" milter="" wiki="">`_.</https:>
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
Configure your system
Pierre-Yves Chibon 7a137a
---------------------
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 18e5d3
* Install the required dependencies
Pierre-Yves Chibon 9664af
::
Pierre-Yves Chibon 9664af
Pierre-Yves Chibon 9664af
    python-pymilter
Pierre-Yves Chibon 9664af
Pierre-Yves Chibon 18e5d3
..note: We ship a systemd unit file for pagure_milter but we welcome patches
Pierre-Yves Chibon 18e5d3
        for scripts for other init systems.
Pierre-Yves Chibon 9664af
Pierre-Yves Chibon 9664af
..note: It also requires a MTA, we used postfix.
Pierre-Yves Chibon 9664af
Pierre-Yves Chibon 9664af
Pierre-Yves Chibon 7a137a
* Create an alias ``reply``
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
This can be done in ``/etc/aliases``, for example:
Pierre-Yves Chibon 7a137a
::
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
    reply:      /dev/null
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 18e5d3
* Activate the ability of your MTA, to split users based on the character ``+``.
Pierre-Yves Chibon 7a137a
  This way all the emails sent to ``reply+...@example.com`` will be forwarded
Pierre-Yves Chibon 7a137a
  to your alias for ``reply``.
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
In postfix this is done via:
Pierre-Yves Chibon 7a137a
::
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
    recipient_delimiter = +
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
* Hook the milter in the MTA
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
In postfix this is done via:
Pierre-Yves Chibon 7a137a
::
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
    non_smtpd_milters = unix:/var/run/pagure/paguresock
Pierre-Yves Chibon 7a137a
    smtpd_milters = unix:/var/run/pagure/paguresock
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon cb69ee
Pierre-Yves Chibon cb69ee
* Install the files of the milter as follow:
Pierre-Yves Chibon cb69ee
Pierre-Yves Chibon cb69ee
+--------------------------------------+---------------------------------------------------+
Pierre-Yves Chibon cb69ee
|              Source                  |                   Destination                     |
Pierre-Yves Chibon cb69ee
+======================================+===================================================+
Pierre-Yves Chibon cb69ee
| ``milters/comment_email_milter.py``  | ``/usr/share//pagure/comment_email_milter.py``    |
Pierre-Yves Chibon cb69ee
+----------------------------------------+-------------------------------------------------+
Pierre-Yves Chibon cb69ee
| ``milters/milter_tempfile.conf``     | ``/usr/lib/tmpfiles.d/pagure-milter.conf``        |
Pierre-Yves Chibon cb69ee
+----------------------------------------+-------------------------------------------------+
Pierre-Yves Chibon 18e5d3
| ``milters/pagure_milter.service``    | ``/etc/systemd/system/pagure_milter.service``     |
Pierre-Yves Chibon cb69ee
+--------------------------------------+---------------------------------------------------+
Pierre-Yves Chibon cb69ee
Pierre-Yves Chibon cb69ee
The first file is the script of the milter itself.
Pierre-Yves Chibon cb69ee
Pierre-Yves Chibon cb69ee
The second file is a file specific for systemd and ensuring the temporary
Pierre-Yves Chibon cb69ee
folders needed by the milter are re-created if needed at each boot.
Pierre-Yves Chibon cb69ee
Pierre-Yves Chibon cb69ee
The third file is the systemd service file.
Pierre-Yves Chibon cb69ee
Pierre-Yves Chibon cb69ee
Pierre-Yves Chibon 7a137a
* Activate the service and ensure it's started upon boot:
Pierre-Yves Chibon 7a137a
::
Pierre-Yves Chibon 7a137a
Pierre-Yves Chibon 7a137a
    systemctl enable pagure_milter
Pierre-Yves Chibon 7a137a
    systemctl start pagure_milter