Mail::...llation(3pm)
β¨ NAME β¨
Mail::MtPolicyd::Cookbook::Installation β bestie, this is literally the "how do I install mtpolicyd" page π it's part of the User Contributed Perl Documentation and it's giving very much "setup tutorial" energy.
πΈ VERSION πΈ
version 2.05 β yes queen, that's the one we're working with π
π GET STARTED WITH BASIC MTPOLICYD INSTALLATION π
okay so here's the whole vibe from zero to running daemon. buckle up, we're doing this together π«Ά
π§ INSTALL MEMCACHED π§
memcached is required for mtpolicyd β not optional, not a suggestion, it's the whole foundation. ngl your OS distribution should already ship a package of it, so you're probably chillin'. On Debian based distributions you install it like:
apt-get install memcached
then go check /etc/default/memcached to see if the service is actually enabled, bestie, because a disabled service is not the serve you think it is:
ENABLE_MEMCACHED=yes
and start the memcached service:
/etc/init.d/memcached start
slay, memcached is up π§β¨
π INSTALL MTPOLICYD π
π¦ FROM PACKAGE π¦
Packages for mtpolicyd are included in the Debian package repositories. easy peasy, iconic, no compiling, we love to see it π
π FROM SOURCE/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, first make sure you have cpanminus installed:
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. do it. main character security energy π
You can get a default configuration file etc/mtpolicyd.conf from the tarball. free config, we love a gift π
The init scripts for the debian packages are located at debian/mtpolicyd.init and for redhat systems at rpm/mtpolicyd.init within the tarball. iykyk which one is yours πΈ
π TEST MTPOLICYD π
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)
look at that little family tree of workers, they're literally the master and its idle babies π so cute, so functional.
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. that's it, that's the whole ritual, no cap β¨
The mtpolicyd should respond with a action like:
PREPEND X-MtScore: NO score
periodt. if you got that back, it's working π
π¬ ADD A MTPOLICYD QUERY TO YOUR POSTFIX SMTPD π¬
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. every. single. one. watch it go ππ₯
π CONGRATULATIONS π
Your mtpolicyd is now configured and running with the default configuration. you did it bestie, genuinely so proud of you π«Άπ
You may now want to continue with reading Mail::MtPolicyd::Cookbook::DefaultConfig which explains what the default configuration does. highly recommend, it's the sequel and it ate π
π¦ AUTHOR π¦
Markus Benning <ich@markusbenning.de> β the icon, the legend, the person behind all of this π
β COPYRIGHT AND LICENSE β
This software is Copyright (c) 2014 by Markus Benning <ich@markusbenning.de>.
This is free software, licensed under:
The GNU General Public License, Version 2, June 1991
and that's a wrap, bestie πβ¨ this page came from perl v5.38.2, dated 2024-05-26 β go forth, install your daemon, and stay iconic ππΈπ¦
π¦ where this page comes from
- debian trixie: mtpolicyd 2.05-1.2 Β· GPL-2.0-only
- ubuntu questing: mtpolicyd 2.05-1.2
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms