r/email • • 5d ago

Open Question Looking for a linux-based email server implementation which fully supports "Sieve pipe" and also "Sieve ereject" ... ???

I'm running Debian 13 on my local host whose domain name an A-level static domain that's been valid and active for more than a decade.

I'm wondering whether there is any email implementation that I could run solely on my local machine which supports both "Sieve pipe" and "Sieve ereject".

It turns out that I can't use a Dovecot/Postfix implementation, because "pigeonhole" for Dovecot 2.4 only supports "Sieve pipe" and not "Sieve ereject". And I can't use Stalwart, because it only supports "Sieve ereject" and not "Sieve pipe". I know that Stalwart offers other facilities that perform some (but not all) of the same kind of functionality that "Sieve pipe" offers, but it turns out that I need full "Sieve pipe" functionality in this particular, rather unique instance.

And please understand that this is not an "XY" question. I am specifically and only asking about whether there is any linux-runnable software with which I can get these exact two Sieve actions ("pipe" and "ereject"), and I am not asking for any advice about alternatives to "Sieve pipe"/"Sieve ereject". I already know about alternatives, and for the purpose of this particular question here, I do not want to discuss any of those alternatives.

And I have very specfic reasons for needing to run this on my local email server, and these reasons are irrelevant to this current question. I therefore am not wanting to discuss the drawbacks of running such a local server. I already know these drawbacks, and they don't apply to my very specific and quite unique local email server configuration.

I just want to know whether anyone might know of any linux-runnable email software that fully supports all aspects of both "Sieve pipe" and "Sieve ereject". But if no such software exists, I can live with that with no problem ... and this is why I'm not writing this message in order to discuss any alternatives (that I already know about) to using a "Sieve pipe"/"Sieve ereject" combination.

Thank you very much in advance.

1 Upvotes

13 comments sorted by

2

u/zarlo5899 5d ago edited 5d ago

you can use both have one point to the other

edit: fix typo

1

u/unselective-amnesia 5d ago edited 5d ago

Oh! ... And thank you!

Which "open" are you talking about?

Oh! Now I think you meant to type that "one" should point to the other. But I don't see how Dovecot-Sieve and Stalwart-Sieve can point to each other, especial when Stalwart Sieve is meant to use one action ("ereject") and Dovecot Sieve uses the other action ("pipe"). In Sieve, when specifying actions to invoke, they are only referred to by name, not by any kind of Sieve-implementation indicator.

Could you explain?

2

u/zarlo5899 5d ago

Alright, that was a typo. It was meant to be one not open.

1

u/unselective-amnesia 5d ago

Yes, now I understand it's a typo.

So, do you know how to get Dovecot Sieve and Stalwart Sieve to work in parallel, and for each of them to refer to an action (either "ereject" or "pipe") in the other one?

Dovecot and Stalwart cannot normally be active at the same time, because they each expect to be in control of the same ports. If one is started, the second one will not start up because of this.

1

u/ReinatouGushani67 22h ago

was thinking the same thing, just daisy chain the two locally.

2

u/Squeebee007 5d ago

You expect a different answer than nine days ago when you last asked?

1

u/unselective-amnesia 5d ago

I asked a slightly different question 9 days ago. Back then, I was originally looking for a remote email service, and I was only asking about "pipe" functionality.

But then I decided on a local server back then and thought that Stalwart would work, but just today I found out that Stalwart's pipe-like functionality does not provide complete "Sieve pipe" functionality.

This is why I'm asking this particular question here, which is different from the 9-days-ago questions.

2

u/atom1cx 5d ago

I don't believe you researched this topic very well, or actually understand how any of this works.

https://support.stalw.art/t/does-stalwart-sieve-support-the-pipe-action-and-the-ereject-action/2504

This support question was asked a week ago, and responded to with other links to Stalwart's own documentation which outlines how to handoff incoming messages to external milters or MTA hooks to accomplish the "Sieve pipe" actions during the SMTP session itself!

Worth recognizing that Stalwart's own phases of email delivery limits the scope of any SMTP session; specifically, "user scripts" are defined and executed at the user mailbox level (and not during the SMTP session)... That being said, Stalwart does support said user scripts, https://stalw.art/docs/sieve/user-scripts/

To daisy-chain prepackaged software together (e.g. running both packages together) you'd have to configure each one to not overstep each other; maybe Dovecot to process incoming then fwd/punt everything to Stalwart (this is where users read their mail), or have Stalwart process incoming then fwd/punt to Dovecot to run its actions (this is where users read their mail), or rely on Roundcube to run the rules (they support client-side managesieve), or simply implement an entirely different rules engine (milter) that adheres to Sieve Pipe -- similar to how ClamAV is an external milter for incoming mail servers.

Final point: There's a commercial package, Axigen, which has native binaries -- but I've had mixed experiences having it properly handoff to third-party hooks and milters, so I'm not recommending it right now. My own tests might be impinged due to security (everything's running as 'root' on the VM) or some other nonsense.

1

u/unselective-amnesia 5d ago edited 5d ago

Thank you very much. And based on what you have written, you have reminded me that Dovecot Sieve and Stalwart sieve can indeed co-exist, with Stalwart handling the SMTP and Dovecot managing the IMAP. And I now remember that in this case, the two can co-exist because the Dovecot IMAP processing can be configured to use a different port than the Stalwart IMAP processing, thereby avoiding the port conflicts that I mentioned above.

However, the problem that I'm facing is that Stalwart's SMTP-based system scripts cannot pass message-specific data to the Sieve user scripts. I want an SMTP-based system script to perform certain kinds of message validations that can only be performed within a linux shell script, and then pass the results of these validations to the Sieve user script, which then decides how to process the message, based upon these validation results. By "process" the message, it could mean that the Sieve user script performs an "ereject" followed by "stop", or it could mean for the Sieve user script to accept the message and to store it in a folder named "rejected" followed by "stop", or it could mean for the Sieve user script to simply process the message normally, based on whatever Sieve actions are already in place.

But since the SMTP-based system script has no way to pass an external shell script's return code and/or stdout/stderr output to a Sieve user script, this is not possible. And this is why I'm looking for some other linux-based email software which supports Sieve and which can perform both "ereject" and "pipe".

And I'm well aware of the fact that it's extremely unlikely that such linux-based email software even exists. But hope springs eternal, which is why I'm asking here, just in case someone might know of such unlikely-to-exist software.

2

u/atom1cx 5d ago

The issue isn't the existence of such a package, it's that they would not be fully conforming to the RFC specs governing SMTP sessions altogether. More on Stalwart's adoption inbound filtering scheme https://stalw.art/docs/mta/filter/

An active message relay (within a delivery SMTP session) does afford acceptance/rejection during the Milter and MTA hooks handoffs, but the execution space for user scripts is governed outside of the SMTP session exchange (because their breadth of parameters/contexts/rules are user-space dependent). Something like ClamAV gets configured as a milter (allowing for message tagging). So yes it can be done.

In your scenario, dig deeper into https://stalw.art/docs/sieve/ and https://stalw.art/docs/sieve/mail-rules/

The takeaway from their documentation is that the filing action (moveTo) is configured at the user level, gets saved/baked into the message exchange (via untrusted interpreter) but gets executed after the SMTP session has concluded. So it's configured on a per-user basis (maybe even as templated defaults) instead of a single system-wide default message processing chain...

... but this is because the filing action is strictly within the bounds of the user's mailbox (and their mailbox topography) rather than the scope of the message itself (which is the boundary for standard SMTP session)!

Ostensibly, your alternative is scripting your own MTA hook to conduct whatever it needs to (responding accordingly during the SMTP session) and also deposit the message into the appropriate user mailbox... that's messy, and exactly why it's not done as regular practice... that's a lot of system-level user mailbox manipulation!

1

u/unselective-amnesia 4d ago edited 4d ago

Thank you very much, and yes, I know that the "moveTo" is handled at the user-script level, while the running of an external executable or shell script as part of the message processing would be done at Stalwart's SMTP-script level. That's why I have been hoping that the results of the shell script's execution at the Stalwart SMTP-script level could somehow get passed to the user-level Sieve processing ... and that's what seems impossible via standard Stalwart processing, no matter whether the Sieve user script is managed via Stalwart or via Dovecot.

I know that this is quite non-standard, but this non-standard-ness doesn't bother me in the least.

And I already know that there are some ways to implement this kind of functionality, and I know that they are rather complicated. And I am able and quite willing to get this done via one or more of these other complex-to-implement methodologies.

And to repeat: if, however, a Sieve implementation which manages both "Sieve pipe" and "Sieve ereject" were available in a linux-based email service, then this functionality would be very simple and non-complicated and straightforward to implement. And also to repeat: I know that such linux-based email software is almost certainly non-existent; but I wanted to check here anyway, just in the very unlikely chance that someone might happen to know of such an almost-certainly-non-existent piece of software.

And I've also tried to make it clear that this wishful desire of mine to find linux-based email software which offers such an unlikely-to-find Sieve implementation is the one and only reason for my posting this question here.

1

u/Private-Citizen 4d ago

Or ditch doing it with sieve and go for a milter which plugs into postfix and becomes part of the SMTP transaction. You code your logic in perl which can reject or even rewrite parts of the email. Instead of piping to your logic, just build your logic into the milter perl.

https://mimedefang.org/
https://www.mailmunge.org/ <--my pick

1

u/unselective-amnesia 3d ago

As I clearly stated in the first message of this thread (which I assume you have read in its entirety, correct?), and as I have repeated more than once in other messages that I've posted here, I am NOT asking about any alternatives to using "pipe" and "ereject" in Sieve.

The one and only thing I'm asking about is whether there might be any linux-based email software which offers Sieve "pipe" and also Sieve "ereject". And I also have made it clear that I know it's extremely unlikely that such email software exists. And yet another thing that I have made clear is that I am perfectly happy to live without Sieve "pipe" and Sieve "ereject" and to use one of the several alternatives that I am well aware of, if it indeed turns out that such linux email software doesn't exist.

Thank you very much for the milter suggestion, and it's one of the alternatives that I already know about ... and which are totally off-topic to what I am asking about in this thread.

This is some of the text in the initial message of this thread that I wish people would have read before responding:

And please understand that this is not an "XY" question. I am specifically and only asking about whether there is any linux-runnable software with which I can get these exact two Sieve actions ("pipe" and "ereject"), and I am not asking for any advice about alternatives to "Sieve pipe"/"Sieve ereject". I already know about alternatives, and for the purpose of this particular question here, I do not want to discuss any of those alternatives.