- GET STARTED WITH BASIC MTPOLICYD INSTALLATION
- COPYRIGHT AND LICENSE
Mail::MtPolicyd::Cookbook::Installation - How to install mtpolicyd
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:
Start the memcached service
Packages for mtpolicyd are included in the Debian package repositories.
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:
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.
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 firstname.lastname@example.org client_address=192.168.1.1 email@example.com 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
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.
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.
Markus Benning <firstname.lastname@example.org>
This software is Copyright (c) 2014 by Markus Benning <email@example.com>.
This is free software, licensed under:
The GNU General Public License, Version 2, June 1991