0 votes

I just brought up a new ClearOS 7.8and in general it does its job.

Short version of my question:
- how can I setup postfix to deliver incoming emails to a remote cyrus server via lmtp port (like, without hacking Filter_Incoming.php?

Longer version for curious users:

My goal is the following infrastructure, using 2 virtual servers with the following main tasks:
* VM1: ClearOS 7.8
* ldap/user management
* smtp for incoming/outgoing emails, antivirus
* samba
* VM2: Debian testing
* latest cyrus-imapd 3.2 with carddav, caldav, webdav and whatever services

The system described above seems working as proof-of-concept, except a small but important problem:
I had to change one line in Filter_Incoming.php to be able to deliver the incoming emails to the remote cyrus server as shown below.

[root@clear78 libraries]# diff -u Filter_Incoming.php-original Filter_Incoming.php
--- Filter_Incoming.php-original 2020-11-27 10:30:44.990507247 +0100
+++ Filter_Incoming.php 2020-11-27 10:31:20.654371379 +0100
@@ -149,7 +149,8 @@

/* Route mail to where it needs to go. */

- $host = "localhost";
+ #$host = "localhost";
+ $host = "";
$port = 2003;

$transport = $this->_getTransport($host, $port);

I did it, because the postfix setting uses this parameter: mailbox_transport = mailpostfilter which is technically a php program written by ClearOS team and I did not want to break the ClearOS way how to handle emails.

So, I did not test the system by removing this mail transport and use an other (lmtp:host:port) because I assume there is a standard ClearOS way, how to handle this kind of task.

I also read some php classes, but I did not dig further to figure out, where clearos will read or other configurations to decide, where to deliver emails.

So, the question again:
- how can I setup postfix to deliver incoming emails to a remote cyrus server via lmtp port (like, without hacking Filter_Incoming.php?

Thanks, István
Friday, November 27 2020, 09:43 AM
Share this post:

Accepted Answer

Friday, November 27 2020, 03:11 PM - #Permalink
0 votes
There should be a much simpler way. Use the Mail Forwarding part of the SMTP Server configuration. The main thing to look out for is the Mail Forwarding Domain should not be the same as the Mail Domain (tip: if you have just the one domain, make the Mail Domain a subdomain of your of your Mail Forwarding Domain). Then all you need is a basic SMTP server on your cyrus.example.tld server.
The reply is currently minimized Show
Responses (2)
  • Accepted Answer

    Saturday, November 28 2020, 02:16 PM - #Permalink
    0 votes
    Thank you Nick for your hint!
    I already have a postfix in the cyrus.example.tld, so, your solution could work perfectly. I just did not think about this way :)

    As I had to edit the config of the postfix anyway (crypto settings), for me editing config files do not cause headache for me.

    Anyway, as you mentioned, there is a comfortable way to do the job without touching ClearOS config files and using only ClearOS web gui.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, November 27 2020, 02:33 PM - #Permalink
    0 votes
    Ok, it seems this simple settings in did the trick:

    # Mail routing
    -mailbox_transport = mailpostfilter
    +#mailbox_transport = mailpostfilter
    +mailbox_transport = lmtp:inet:cyrus.example.tld:2003
    content_filter = mailprefilter

    Where cyrus.example.tld is a resolvable server in the LAN.

    And restart postfix of course.

    The original content of the Filter_Incoming.php restored, so, probably the upgrade later will not break this solution.

    I consider this issue solved by the above changes in the, because any kind of checking happened earlier (antivirus etc.), so, the final delivery to the mailbox happens here.

    You could confirm it does not break ClearOS, but I think, it is ok.
    The reply is currently minimized Show
Your Reply