logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Mail::MtPolicyd::Cookbook::Installation - How to install mtpolicyd

Author

       Markus Benning <ich@markusbenning.de>

Get Started With Basic Mtpolicyd Installation

INSTALLMEMCACHED
       memcached is required for mtpolicyd. A package of memcached should come with your os distribution.  On
       Debian based distributions it can be installed by:

         apt-get install memcached

       Check /etc/default/memcached if the service is enabled:

         ENABLE_MEMCACHED=yes

       Start the memcached service

         /etc/init.d/memcached start

   INSTALLMTPOLICYDFROMPACKAGE

       Packages for mtpolicyd are included in the Debian package repositories.

       FROMSOURCE/CPAN

       Since mtpolicyd source is shipped as a perl/CPAN package it could be installed from CPAN. To install the
       Mail::Mtpolicyd package with all dependencies required make sure you have installed cpanminus:

         apt-get install cpanminus

       Then install the Mail::Mtpolicyd distribution with:

         cpanm Mail::MtPolicyd

       It is recommended to create an system user and group for the daemon.

       You can get a default configuration file etc/mtpolicyd.conf from the tarball.

       The init scripts for the debian packages are located at debian/mtpolicyd.init and for redhat systems at
       rpm/mtpolicyd.init within the tarball.

   TESTMTPOLICYD
       Now the daemon should be up:

         $ ps -u mtpolicyd f
           PID TTY      STAT   TIME COMMAND
          2566 ?        Ss     0:12 /usr/bin/mtpolicyd (master)
          2731 ?        S      0:28  \_ /usr/bin/mtpolicyd (idle)
         19464 ?        S      0:26  \_ /usr/bin/mtpolicyd (idle)
         28858 ?        S      0:26  \_ /usr/bin/mtpolicyd (idle)
         32372 ?        S      0:24  \_ /usr/bin/mtpolicyd (idle)

       And it should be listening on localhost:12345:

         $ netstat -aenpt | grep :12345
         tcp        0      0 127.0.0.1:12345         0.0.0.0:*               LISTEN      0          17333578    -

       Now test it with a simple query:

         $ policyd-client -h localhost:12345

       Paste the following request to the command:

         reverse_client_name=smtp.google.com
         sender=bob@gmail.com
         client_address=192.168.1.1
         recipient=ich@markusbenning.de
         helo_name=smtp.google.com

       Terminate the request by a blank line. Just press enter.

       The mtpolicyd should respond with a action like:

         PREPEND X-MtScore: NO score

   ADDAMTPOLICYDQUERYTOYOURPOSTFIXSMTPD
       Open you postfix main.cf configuration file in a text editor. It should be located below /etc/postfix.

       Add a 'check_policyd_service inet:127.0.0.1:12345' check to your smtpd_recipient_restrictions. It should
       look like this one:

         smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, check_policy_service inet:127.0.0.1:12345

       Now restart postfix. Now follow your maillog as new mails arrive. There should be a mtpolicyd line for
       every query.

   CONGRATULATIONS
       Your mtpolicyd is now configured and running with the default configuration.

       You may now want to continue with reading Mail::MtPolicyd::Cookbook::DefaultConfig which explains what
       the default configuration does.

Name

       Mail::MtPolicyd::Cookbook::Installation - How to install mtpolicyd

Version

       version 2.05

See Also