faking a test message to a milter?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

faking a test message to a milter?

pg151
I'm starting to work on writing my own outbound milter for a Postfix instance.

While working on it, I'll want to test with message submissions "to" it.

Is there a good example of manually submitting a robust -- i.e., exactly as from a running, Postfix instance -- message example to a milter?

Without a Postfix instance around,  just 'echo' a message to the milter listener?



Reply | Threaded
Open this post in threaded view
|

Re: faking a test message to a milter?

Wietse Venema
[hidden email]:
> I'm starting to work on writing my own outbound milter for a Postfix instance.
>
> While working on it, I'll want to test with message submissions "to" it.

Use Postfix XCLIENT to impersonate any client IP address.
http://www.postfix.org/XCLIENT_README.html

You can use a production or 'test' Postfix instance for these tests.

> Is there a good example of manually submitting a robust -- i.e.,
> exactly as from a running, Postfix instance -- message example to
> a milter?
>
> Without a Postfix instance around,  just 'echo' a message to the
> milter listener?

Nope. Milters speak a binary protocol. You can't just echo an email
message into it.

I think it would be easier to implement your tests with SMTP, using
XCLIENT to impersonate any IP address, and to have Postfix do the
translation to the Milter protocol for you.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: faking a test message to a milter?

pg151
> > Without a Postfix instance around,  just 'echo' a message to the
> > milter listener?
>
> Nope. Milters speak a binary protocol. You can't just echo an email
> message into it.
>
> I think it would be easier to implement your tests with SMTP, using
> XCLIENT to impersonate any IP address, and to have Postfix do the
> translation to the Milter protocol for you.

I'll take that advice, thanks.

Probably useful too to RE-discover how to spin up _just_ an absolutely minimal-for-the-job Postfix 'test' instance.

I've been building & running my 'full' production instances of Postfix for so long, THAT felt like overkill here.

Reply | Threaded
Open this post in threaded view
|

Re: faking a test message to a milter?

Scott Kitterman-4
In reply to this post by pg151
On Friday, November 02, 2018 10:23:04 AM [hidden email] wrote:

> I'm starting to work on writing my own outbound milter for a Postfix
> instance.
>
> While working on it, I'll want to test with message submissions "to" it.
>
> Is there a good example of manually submitting a robust -- i.e., exactly as
> from a running, Postfix instance -- message example to a milter?
>
> Without a Postfix instance around,  just 'echo' a message to the milter
> listener?

If you still want to go down this path, OpenDKIM has a miltertest component to
drive it's test suite without an MTA present.  I have not looked into how
extensible it might be for other purposes.

Scott K
Reply | Threaded
Open this post in threaded view
|

Re: faking a test message to a milter?

pg151
Hi

On Fri, Nov 2, 2018, at 12:28 PM, Scott Kitterman wrote:
> > Without a Postfix instance around,  just 'echo' a message to the milter
> > listener?
>
> If you still want to go down this path, OpenDKIM has a miltertest component to
> drive it's test suite without an MTA present.  I have not looked into how
> extensible it might be for other purposes.

Thanks for the reference!

I need something that works for me, and I can rely on.  So I'm basically done with Opendkim.

I'm starting to poke around with a number of milters, including a dkim signer for myself; I just needed a simple method of creating reliable/predictable message feeds to it.

Per Wietse's advice  -- after a quick re-RTFM -- I got a test instance of Postfix setup.  A pretty trivial exercise, actually.

So now I've a 'real' Postfix->milter communication to rely on, and avoid creating problems for myself trying to correctly 'fake' a message.