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 πŸ’œ


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