Postfix and Mimedefang for single user?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Postfix and Mimedefang for single user?

@lbutlr
I would like postfix to send mail being delivered to a specific virtual user user on to mimedefang, but the instructions that I see on setting up mimedefang are just to set it up as a general milter.

Or do I need to configure mime defang itself to only process the mail to that user?

Also, right now it is setup with

-s /var/spool/MIMEDefang/mimedefang-multiplexor.sock

Does it need to be a port instead?

(Most the stuff I can find is a about decade old and the rest is even older, so I have little confidence)

--
Join the Bastards of Castle Black today!

Reply | Threaded
Open this post in threaded view
|

Re: Postfix and Mimedefang for single user?

Bill Cole-3
On 27 Mar 2021, at 12:49, @lbutlr wrote:

> I would like postfix to send mail being delivered to a specific
> virtual user user on to mimedefang, but the instructions that I see on
> setting up mimedefang are just to set it up as a general milter.

Milters ARE general intrinsically.  MIMEDefang is only usable as a
milter

> Or do I need to configure mime defang itself to only process the mail
> to that user?

That.

It's VERY easy to do. Your mimedefang-filter will have a subroutine for
each stage of the transaction. For each one that you enable (controlled
by options to the mimedefang daemon) after filter_sender() you have
either a single recipient (in filter_recipient())  or an array of all
extant recipients (in filter_{begin,end,multipart,wrapup}().) You can
put a check for the special user at the top of the subroutine and call
'return action_accept();' if it's not there.

Note that things can get messy when messages have multiple recipients.
Ways of dealing with that (basically: forcing one recipient per message)
are documented in the MIMEDefang docs.

> Also, right now it is setup with
>
> -s /var/spool/MIMEDefang/mimedefang-multiplexor.sock
>
> Does it need to be a port instead?

No. RTFM. The MIMEDefang package includes 9 man pages.

> (Most the stuff I can find is a about decade old and the rest is even
> older, so I have little confidence)

Yes, it is stable software. While Dianne Skoll was the MIMEDefang BDFL,
she kept scope-creep under control and wrote good code, so there has not
been a lot of novelty for users of MIMEDefang. It mostly just works. It
is not dead, and a maintenance release will be coming soon with a
handful of fairly small fixes.

--
Bill Cole
[hidden email] or [hidden email]
(AKA @grumpybozo and many *@billmail.scconsult.com addresses)
Not Currently Available For Hire
Reply | Threaded
Open this post in threaded view
|

Re: [External] Postfix and Mimedefang for single user?

Kevin A. McGrail
In reply to this post by @lbutlr

Hi LuKreme,

I believe once you hook in MIMEDefang with postfix, it's a general purpose filter that uses the milter interface to process emails at various stages of the mail dialogue and processing.  It hurts my brain to think about whether Postfix could do a filter on the recipients and then hand-off things to MIMEDefang or not :-)

If you take a look at https://mcgrail.com/downloads/The%20Perl%20Conference%202019%20-%20%20Fighting%20Spam%20with%20Perl%20using%20Apache%20SpamAssassin%20&%20MIMEDefang%20.pdf you can get a demo filter at https://drive.google.com/file/d/1yu6cnEN_22A07_9ApvBxrvLs4iiAeeW1/view which helps you see the hooks available.

You could add a function in filter_recipient to set a global variable that you don't want to do any processing unless a specific recipient is involved.  Then you could add logic elsewhere to use that variable.

Regards,

KAM

On 3/27/2021 12:49 PM, @lbutlr wrote:
I would like postfix to send mail being delivered to a specific virtual user user on to mimedefang, but the instructions that I see on setting up mimedefang are just to set it up as a general milter.

Or do I need to configure mime defang itself to only process the mail to that user?

Also, right now it is setup with

-s /var/spool/MIMEDefang/mimedefang-multiplexor.sock

Does it need to be a port instead?

(Most the stuff I can find is a about decade old and the rest is even older, so I have little confidence)




Reply | Threaded
Open this post in threaded view
|

Re: [External] Postfix and Mimedefang for single user?

@lbutlr


> On 28 Mar 2021, at 19:40, Kevin A. McGrail <[hidden email]> wrote:
>
> Hi LuKreme,
>
> I believe once you hook in MIMEDefang with postfix, it's a general purpose filter that uses the milter interface to process emails at various stages of the mail dialogue and processing.  It hurts my brain to think about whether Postfix could do a filter on the recipients and then hand-off things to MIMEDefang or not :-)

Yeah, as Bill said the way to go is to setup mimedefang properly. I am still reading man pages.,

I keep thinking someone has already done exactly what I want, but so far, not exactly.

(Basically I want to strip HTML from all messages to my list account if they have a plain text version and if not, then render the HTML into text, stripping the images and other cruft and leaving me with a plain text message.

But, of course, I don't want to alter anyone else's messages.

I thought I had this working in sieve with pip, but it fails without giving me actual information as to why (works when I pipe messages directory, but not through sieve). ¯\_(ツ)_/¯

I am so very sick of light grey 10px text on a slightly lighter grey background.

--
Let there be songs to fill the air