You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-user@james.apache.org by cryptearth <cr...@cryptearth.de> on 2019/02/03 18:55:36 UTC

Re: james and sendmail - wildcard alias for local users

So I dug through some code and found some points where I might could get 
started:

The interface org.apache.mailet.Mail offeres the methods one might could 
write a matcher and a mailet on:

String org.apache.mailet.Mail.getRemoteHost()
String org.apache.mailet.Mail.getRemoteAddr()
void org.apache.mailet.Mail.setRecipients(Collection<MailAdress>)

As one can see, the two getRemoteXXX() methods return a String. This can 
lead to java.net.InetAddress.getByName(String) and provided methods 
InetAddress.isAnyLocalAddress(), InetAddress.isLinkLocalAddress() and 
InetAddress.isLoopbackAddress(). Also one can compare 
InetAddress.getLocalHost().getHostName() or .getHostAddress().

As for the rewrite, the already mentioned SetRecipient mailet suggeted 
by Benoit could already do the trick, at least for my personal question.

What I still not undestand: How to configure a Matcher or a Mailet by 
XML syntax?

As Benoit mention:

<mailet ...>
     <recipient>...</recipient>
</mailet>

So, how I would get the value of the recipient-tag into my Matcher or 
Mailet? Reason: For modeling a Matcher and Mailet, I would like to not 
only write some lines for my specific case, but would like to make it 
configureable by what one could write in the XML. For example: specify 
for what the matcher should match, like sepcific sender, remote-host, 
maybe specific recipients - or what the Mailet should does: like remove 
any recipients and replace it only by one entry, or maybe based on the 
source set some specific recipients. I guess this should be possible as 
one could configure more or less complex rules via XML - wich then just 
had to be parsed into corresponding ruleset handling the Mail and decide 
if and how to modify it.

Thanks so far,

Matt

Am 31.01.2019 um 10:32 schrieb cryptearth:
> Hello Benoit,
>
> thanks for your enormous effort you take into trying to help us with 
> such questions.
>
> About the JIRA you filed, I guess that's what I looking for, as I 
> thought such SetRecipient(s) would already exist.
>
> I came also up with a bit simpler description about my problem: I know 
> the origin: localhost, I don't know the sender nor target, but I do 
> know, that if it comes from a specific sender (the one I set in apache 
> php.ini), it's recipient is extern and should processed normal 
> RemoteDelivery, as there is no localuser matching this specific sender.
>
> Example: in apache php.ini the sender is set to 
> webmaster@cryptearth.de - there is no localuser matching this, and the 
> recipient is external. This get's processed as usual and a copy of the 
> send mail is out into SENT folder - as I want it to. When sendmail 
> gets mails from other services, namely cron, it drops in, for example, 
> as glados@glados.cryptearth.de. Even glados.cryptearth.de is a FQHN, 
> it could also seen as sub-domain, but james thinks this is an external 
> target as galdos.cryptearth.de isn't added in the domainlist. Other 
> services instead drop like wwwrun@localhost (that's the default wehn 
> no -f paramter is set in apache php.ini). So, as there is no matching 
> domain either, it gets rejected right away.
>
> Also, it seems there is missing an "inverted" matcher wich could be 
> used for something like: "if <from> is not <xyz>" - I could only find 
> matchers for "if <from> is <xyz>". I couldn't find an example for 
> combine matchers neither: "if network is localhost AND if from is not 
> webmaster@cryptearth.de" > rewrite recipient to 
> local-services@cryptearth.de
>
> Thanks so far,
>
> Matt
>
> Am 31.01.2019 um 08:29 schrieb Benoit Tellier:
>> Don't worry, I already feel overwhelmed with a single application and
>> several collegues contributing on it with me!
>>
>> Concerning the JPAMailRepository, thank you very much for your proposal!
>>
>> I do believe it is really nice as it allows JPA users to no more rely on
>> file-system based storage API at all.
>>
>> Here is the JIRA, https://issues.apache.org/jira/browse/JAMES-2656 I
>> would be more than happy to help you implementing this!
>>
>> Cheers,
>>
>> Benoit
>>
>> On 1/31/19 1:24 PM, Garry Hurley wrote:
>>> As soon as I have gotten our Direct Project implementation to work 
>>> with James 3.x.0 (I am compilinga against the 3.2.0 release jars), I 
>>> can look at working the JPA MailRepository angle. Unfortunately, 
>>> other production issues and upgrade tasks have taken priority. You 
>>> know how it is when you help support two or three applications.
>>>
>>> Sent from my iPhone
>>>
>>>> On Jan 30, 2019, at 11:43 PM, Benoit Tellier 
>>>> <bt...@linagora.com> wrote:
>>>>
>>>> Hi Garry,
>>>>
>>>> To answer your previous email:
>>>>
>>>> At Linagora we rely on "LDAP user repository".
>>>>
>>>> Yes, we are currently limited to "a mailAddres" -> "a mailbox 
>>>> account".
>>>> Shared mailboxes is not supported so far. That being said
>>>> "RecipientRewrite tables" successfully enables concepts like "Alias",
>>>> "Mail forwarding", "Groups", "Domain redirection". The
>>>> mailAddress<->mailAccount mapping is done at that level. Note that no
>>>> implementation of LDAP based RRT is implemented so far, but such a
>>>> component would make perfect sense and could be 
>>>> implemented/contributed
>>>> in the future.
>>>>
>>>> I don't understand the "either we are moving away from file-based 
>>>> repos
>>>> or we aren't". All components have data-base alternatives. For the
>>>> example of the mailQueue that you took, there is an old-fashion file
>>>> implementation that I'd personally like to deprecate along with all 
>>>> the
>>>> other file-based-storages implemented in James. But an ActiveMQ
>>>> implementation is available as well as a RabbitMQ one.
>>>>
>>>> "Dead letter" concept for "Mail processing" is implemented via
>>>> Mail-Repositories (/var/mail/error) and full support for 
>>>> reprocessing is
>>>> granted (at least in guice products).
>>>>
>>>> (And you are right, we miss a JPA MailRepository implementation... 
>>>> This
>>>> sounds like a nice proposal of contribution!)
>>>>
>>>> So I really do think that we are, as a project, moving forward to 
>>>> newer
>>>> tech. If you think we are missing something, then this should of 
>>>> course
>>>> be discussed.
>>>>
>>>> And of course, on all these topics, all contributions are welcomed ;-)
>>>>
>>>> Cheers,
>>>>
>>>> Benoit TELLIER
>>>>
>>>>
>>>>> On 1/31/19 11:18 AM, Garry Hurley wrote:
>>>>>
>>>>> A couple of questions. First, what is your usersrepository? If you 
>>>>> store user info in the database, yes, you would have to store each 
>>>>> user in there. If you store it in LDAP, you could store each entry 
>>>>> as an inetOrgPerson object, or a subclass of that, with a mailbox 
>>>>> entry for that person. Then when you authenticate against LDAP, 
>>>>> you get the mailbox for delivery. The LDAP is easier to maintain, 
>>>>> but harder to work with and adds complexity if you don’t already 
>>>>> use it for something else. What seems like a trivial thing - a 
>>>>> user to mailbox mapping - to be implemented in the database is 
>>>>> missing. Even an ‘entity’ to mailbox mapping so that you could 
>>>>> link a mailbox to a group or an individual is missing. Also 
>>>>> missing from the database is a dead letter queue, which is still 
>>>>> file-based. I can understand the tradeoff of security for 
>>>>> compliance with old-school tech, but either we are moving away 
>>>>> from file-based repos or we aren’t.
>>>>>
>>>>> Sent from my iPhone
>>>>>
>>>>>> On Jan 30, 2019, at 11:00 PM, Benoit Tellier 
>>>>>> <bt...@linagora.com> wrote:
>>>>>>
>>>>>> Hello Matt,
>>>>>>
>>>>>> So as far as I understand your main need would be:
>>>>>>
>>>>>> ```
>>>>>> WHEN I send an email
>>>>>> THEN it is stored in *myMagicRecipient* INBOX
>>>>>> Regardless of original recipients
>>>>>> ```
>>>>>>
>>>>>> Quite surprisingly such a "Overwrite envelop" feature is missing...
>>>>>>
>>>>>> Here is the JIRA: 
>>>>>> https://issues.apache.org/jira/browse/MAILET-163 Don't
>>>>>> hesitate to PR this ;-)
>>>>>>
>>>>>> (Combined with a "not RemoteHostIs" you would achieve the 
>>>>>> rewritting you
>>>>>> need)
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Benoit TELLIER
>>>>>>
>>>>>>> On 1/30/19 4:13 PM, cryptearth wrote:
>>>>>>> Hello Benoit,
>>>>>>>
>>>>>>> let me try to re-phrase my goal:
>>>>>>>
>>>>>>> I've set up a clean install of opensuse 15.0 on my test-rig, 
>>>>>>> named it
>>>>>>> glados, assigned it to my domain cryptearth.de, set sendmail as
>>>>>>> nullclient along with james 3.2.0 and want to collect any mail 
>>>>>>> dropped
>>>>>>> by sendmail into a specific mailbox. The catch: As I also want 
>>>>>>> to use
>>>>>>> sendmail to support mail() command for php, e-mails dropped in by
>>>>>>> apache should be routed extern.
>>>>>>>
>>>>>>> So: sendmail dropps in mails depending on wich service calls it. 
>>>>>>> Cron
>>>>>>> for example uses glados@glados.cryptearth.de - apache instead
>>>>>>> wwwrun@localhost - and my guess is that other services might use 
>>>>>>> other
>>>>>>> combinations as well.
>>>>>>>
>>>>>>> Goal: When a mail is dropped by apache, wich is set to
>>>>>>> webmaster@cryptearth.de by using -f parameter in php.ini, these 
>>>>>>> mails
>>>>>>> should go out as normal to they recipient. Any other mail should 
>>>>>>> get
>>>>>>> collected into a special user, for example
>>>>>>> local-services@cryptearth.de or so.
>>>>>>>
>>>>>>> What I disconvered yet: When the domain wich is used by sendmail is
>>>>>>> not in the domain-list, james thinks it's an external domain and 
>>>>>>> tries
>>>>>>> remote delivery. If the domain is in the domain-list, but not 
>>>>>>> the user
>>>>>>> name - it fast fails to "no user". And if the user for the 
>>>>>>> domain is
>>>>>>> also added it gets delivered into inbox without double in sent. 
>>>>>>> It's
>>>>>>> that last one I want, but without adding any specific user for each
>>>>>>> services wich may use sendmail to try to local-deliver 
>>>>>>> status-mails,
>>>>>>> wich sendmail usual would drop into /var/mail or ~/mail (or what 
>>>>>>> ever
>>>>>>> it is default to).
>>>>>>>
>>>>>>> I dug through mailets and recipient rewrite and got some hints, but
>>>>>>> couldn't figure out some working yet. One think I come up with 
>>>>>>> is add
>>>>>>> some to mailetcontainer wich re-writes recipient based on 
>>>>>>> remote-host,
>>>>>>> wich for sendmail is localhost. Other idea I had: use some
>>>>>>> re-write-rule based on local hostname, but you recommended against
>>>>>>> using this way.
>>>>>>>
>>>>>>> Another possible what someone come up with: add my own few lines 
>>>>>>> into
>>>>>>> source and re-build - but I don't know where to add as it's all 
>>>>>>> very
>>>>>>> abstract and I'm not that pro of Java.
>>>>>>>
>>>>>>> Thanks to anyone in advance,
>>>>>>>
>>>>>>> Matt
>>>>>>>
>>>>>>>> Am 30.01.2019 um 05:15 schrieb Benoit Tellier:
>>>>>>>> Hi Matt,
>>>>>>>>
>>>>>>>> I read the all thread but feel quite confuse about what you try to
>>>>>>>> achieve.
>>>>>>>>
>>>>>>>> Could you describe it again? (`When ... Then ...` syntax can 
>>>>>>>> really
>>>>>>>> help!)
>>>>>>>>
>>>>>>>> Don't be using regex rewrites - I guess nobody understand what 
>>>>>>>> it does.
>>>>>>>>
>>>>>>>> Maybe you are interested by domain rewrites? Or do you want 
>>>>>>>> that all
>>>>>>>> mail received, whatever the recipient, goes to the same mailbox?
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>>
>>>>>>>> Benoit TELLIER
>>>>>>>>
>>>>>>>>> On 1/28/19 9:57 AM, cryptearth wrote:
>>>>>>>>> Hey there, Matt here again.
>>>>>>>>>
>>>>>>>>> So, I think a found a possible solution without any 
>>>>>>>>> source-file mods
>>>>>>>>> but
>>>>>>>>> only clever mailet-config in mailetcontainer.xml.
>>>>>>>>>
>>>>>>>>> As I dug through the source I found the standard mailets for
>>>>>>>>> RecipientIsLocal. Then I found RecipientIsRegex (I might need 
>>>>>>>>> some help
>>>>>>>>> here). Also there is something called RewriteTable.
>>>>>>>>>
>>>>>>>>> I set up a fresh opensuse leap 15 - cron sends mails as
>>>>>>>>> <user>@<hostname>.<domain> - so I set up a small test-script 
>>>>>>>>> and looked
>>>>>>>>> at log while running james in console mode: when the 
>>>>>>>>> domainlist doesn't
>>>>>>>>> contain <hostname>.<domain> but only <domain> james thinks that
>>>>>>>>> <hostname>.<domain> is external and tries RemoteDelivery. So I 
>>>>>>>>> added
>>>>>>>>> <hostname>.<domain> to domainlist. As I just had the domain, 
>>>>>>>>> but not
>>>>>>>>> the
>>>>>>>>> user, the mail is denied as user doesn't exists for the 
>>>>>>>>> domain. When I
>>>>>>>>> add the user as <localuser>@<hostname>.<domain> it gets local 
>>>>>>>>> delivered
>>>>>>>>> without additional copy in sent folder. So as I don't want to 
>>>>>>>>> set up a
>>>>>>>>> user for each localuser, but also want to avoid fastfail I 
>>>>>>>>> come up
>>>>>>>>> with:
>>>>>>>>> What if I could early check for <whatever>@<hostname>.<domain> 
>>>>>>>>> and
>>>>>>>>> could
>>>>>>>>> just re-write it to an existing account in form of 
>>>>>>>>> <user>@<domain>?
>>>>>>>>> When
>>>>>>>>> recipient is re-written before RecipientIsLocal is checked, 
>>>>>>>>> then this
>>>>>>>>> should trigger and just deliver any local mail from what ever
>>>>>>>>> service to
>>>>>>>>> the mailbox I want to.
>>>>>>>>>
>>>>>>>>> So I search through the source tree - but couldn't find 
>>>>>>>>> anything to
>>>>>>>>> alter the recipient by mailet. All I found was the
>>>>>>>>> recipientrewritetable.xml file and the AddRegexMapping command
>>>>>>>>> available
>>>>>>>>> in james-cli.sh. The xml-config doesn't seem to help, but the
>>>>>>>>> AddRegexMapping command looks good, but I don't understand the 
>>>>>>>>> command
>>>>>>>>> parameters:
>>>>>>>>>
>>>>>>>>> AddRegexMapping <user> <domain> <regex>
>>>>>>>>>
>>>>>>>>> Can someone get me some hint how to use this command? Or 
>>>>>>>>> where/how I
>>>>>>>>> can
>>>>>>>>> setup the recipient-rewrite before RecipientIsLocal is checked?
>>>>>>>>>
>>>>>>>>> Thanks in advance,
>>>>>>>>>
>>>>>>>>> Matt
>>>>>>>>>
>>>>>>>>>> Am 27.01.2019 um 15:20 schrieb cryptearth:
>>>>>>>>>> So, as far as I dug through the code, it seems to come down to
>>>>>>>>>> MailetContext.isLocalEmail(MailAddress) wich is checked by
>>>>>>>>>> RecipientIsLocal (wich I guess also involve somehow a check of
>>>>>>>>>> isLocalServer(Domain). In transport-processor there is the line
>>>>>>>>>>
>>>>>>>>>> <mailet match="RecipientIsLocal" class="LocalDelivery" />
>>>>>>>>>>
>>>>>>>>>> I looked into LocalDelivery.java, but I guess when this 
>>>>>>>>>> matches it's
>>>>>>>>>> to late to perform the test I want to about where the mail 
>>>>>>>>>> comes from
>>>>>>>>>> and where it should send. JamesMailetContext looks good, as it
>>>>>>>>>> contains isLocalServer(Domain), wich should also used to check
>>>>>>>>>> SenderIsLocal (wich shouldn't matter, as this test is 
>>>>>>>>>> performed by
>>>>>>>>>> source 127.0.0.1). As far as I yet could identify, it all 
>>>>>>>>>> comes down
>>>>>>>>>> to somehow tell the config, that whatever domain sendmail 
>>>>>>>>>> uses (it's
>>>>>>>>>> either hostname or hostname.domain) is considered as 
>>>>>>>>>> localServer. The
>>>>>>>>>> wild-card alias shouldn't be any harder to find or figure out 
>>>>>>>>>> as I
>>>>>>>>>> simply have to rewrite anything that comes from local and is for
>>>>>>>>>> local, but isn't in localUserList, is re-written to whatever 
>>>>>>>>>> address I
>>>>>>>>>> want.
>>>>>>>>>>
>>>>>>>>>> I'll report back when I found the lines to alter.
>>>>>>>>>>
>>>>>>>>>> Matt
>>>>>>>>>>
>>>>>>>>>>> Am 26.01.2019 um 22:57 schrieb cryptearth:
>>>>>>>>>>> Currently I'm just using out-of-the-box after clean build. 
>>>>>>>>>>> I'll have
>>>>>>>>>>> a look at the mentioned class and the mailetcontainer. Maybe 
>>>>>>>>>>> I'll
>>>>>>>>>>> find my way around. Good James is written in Java - the one 
>>>>>>>>>>> language
>>>>>>>>>>> I really know.
>>>>>>>>>>>
>>>>>>>>>>> Thanks for the point in a possible direction. I'll report 
>>>>>>>>>>> back when I
>>>>>>>>>>> got something usefull.
>>>>>>>>>>>
>>>>>>>>>>> Matt
>>>>>>>>>>>
>>>>>>>>>>> ---- Garry Hurley schrieb ----
>>>>>>>>>>>
>>>>>>>>>>> Matt, are you using a custom mailet, or working out of the 
>>>>>>>>>>> box? Take
>>>>>>>>>>> a look at the source for LocalDelivery.java
>>>>>>>>>>> <http://LocalDelivery.java>, and the configuration for local 
>>>>>>>>>>> mail in
>>>>>>>>>>> your mailetcontainer.xml <http://mailetcontainer.xml> file. 
>>>>>>>>>>> You may
>>>>>>>>>>> have to override some functionality to get the processing 
>>>>>>>>>>> you want.
>>>>>>>>>>>
>>>>>>>>>>> Sent from my iPhone
>>>>>>>>>>>
>>>>>>>>>>>> On Jan 26, 2019, at 9:36 AM, cryptearth 
>>>>>>>>>>>> <cryptearth@cryptearth.de
>>>>>>>>>>> <ma...@cryptearth.de>> wrote:
>>>>>>>>>>>> Hey there, Matt here.
>>>>>>>>>>>>
>>>>>>>>>>>> So I got sendmail working with james now (tried postfix, 
>>>>>>>>>>>> but it
>>>>>>>>>>> always complains forwarding to localhost isn't supported as 
>>>>>>>>>>> there is
>>>>>>>>>>> no option to ignore false loopback detection), and when used 
>>>>>>>>>>> from
>>>>>>>>>>> apache with additional -f parameter all works good. But as 
>>>>>>>>>>> there're
>>>>>>>>>>> other services might drop mail into local queue (crontab 
>>>>>>>>>>> specificly)
>>>>>>>>>>> I noticed, that I'm still missing something. My goal is 
>>>>>>>>>>> somesort of
>>>>>>>>>>> wildcard alias so that no matter from wich user sendmail gets a
>>>>>>>>>>> message, except the one I use for apache, it should redirect 
>>>>>>>>>>> them
>>>>>>>>>>> internally to one of the user-accounts inside james itself. 
>>>>>>>>>>> I guess
>>>>>>>>>>> there would be a simple solution if would like all mails to get
>>>>>>>>>>> forwareded, but I don't think there is a blacklist syntax so 
>>>>>>>>>>> that
>>>>>>>>>>> mails from specific services with non-local recipients got 
>>>>>>>>>>> send out.
>>>>>>>>>>>> Currently I'm using 3.2.0 <tel:3.2.0> final release commit. 
>>>>>>>>>>>> I also
>>>>>>>>>>> looked into the mailetcontainer.xml 
>>>>>>>>>>> <http://mailetcontainer.xml> file
>>>>>>>>>>> and I guess it's possible in there to specify this rule:
>>>>>>>>>>>> redirect anything local, except address set in apache 
>>>>>>>>>>>> config, to
>>>>>>>>>>> user X, otherwise when from apache with non-local target -> 
>>>>>>>>>>> transport
>>>>>>>>>>>> Could anyone maybe give me a hint?
>>>>>>>>>>>> Other solution: redirect anything local from sendmail to 
>>>>>>>>>>>> processing
>>>>>>>>>>> and with another task process the mails like some short 
>>>>>>>>>>> lines of
>>>>>>>>>>> additional Java.
>>>>>>>>>>>> Matt
>>>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>>>
>>>>>>>>>>> To unsubscribe, e-mail: 
>>>>>>>>>>> server-user-unsubscribe@james.apache.org
>>>>>>>>>>> <ma...@james.apache.org>
>>>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>>>> server-user-help@james.apache.org
>>>>>>>>>>> <ma...@james.apache.org>
>>>>>>>>>>>
>>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>>
>>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>>> For additional commands, e-mail: 
>>>>>>>>> server-user-help@james.apache.org
>>>>>>>>>
>>>>>>>> --------------------------------------------------------------------- 
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>
>>>>>>>
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>
>>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: james and sendmail - wildcard alias for local users

Posted by cryptearth <cr...@cryptearth.de>.
Hey there, Matt here.

So, I wrote a test matcher to see what the different methods return. I 
got three results:

- mail from localhost for localuser
- mail from localhost for external target
- mail from external source for localuser

I user InetAddress.getByName and as I set up sendmail as 
"nullclient,127.0.0.1", remoteHost returns localhost, remoteAddr returns 
127.0.0.1. For some strange reason, only InetAddress.isLoopbackAddress() 
returns true, but that's ok as it is what I want to check.

As for getting xml-paramters I found the 
MailetConfig.getInitParameter(String) for configure the mailet - is 
there some these lines for the MatcherConfig? Or is there another way to 
provide parameters for a Matcher?

I guess now it's just on how to correctly filter for "from localhost for 
localuser", shouldn't be that hard, and figure out what to return from 
Matcher.match() so the provided Mailet is only acted on those mails. The 
Mailet to rewrite the recipient should be as simple as just call 
Mail.setRecipients(Collection<MailAddress>).

I'll report back when I got something usefull.

Matt

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: james and sendmail - wildcard alias for local users

Posted by cryptearth <cr...@cryptearth.de>.
Ok, I got it now, surprise.

What went wrong: It worked the first time.
What's wrong with this: It shouldn't had happend and failed the first time.
Why: Cause the mailet Redirect causes a new mail to be spooled.
How I got this: The doc of Redirect mentions another mailet: Resend. The 
doc of Resend contains a very important additional information that's 
missing in the doc of Redirect:

WARNING: as the message (or a copy of it) is reinjected in the spool 
without any modification, the preceding example is very likely to cause 
a "configuration loop" in your system, unless some other mailet has 
previously modified something (a header for instance) that could force 
the resent message follow a different path so that it does not return 
here unchanged.

So, somehow the test in the VM on friday somehow altered the mail or I 
missed something in the mailet so it didn't got looped. As said: I don't 
have the original image anymore so I can't check. More important: This 
explains why the Exception is thrown and that it is indeed fully correct 
as the same Mail gets looped and looped and looped and would loop 
forever if there wouldn't be a check. The check itself is very simple: 
When a new Mail object is created its "name" is set to "Mail + 
System.currentTimeMillis() + UUID.randomUUID". Redirect alters this 
"name" by adding a suffix and checks if this exceeds some length (this 
is implemented in MailImpl itself) - and in the end throws an Exception 
and fails.
As the same Mail object is duplicated ever again this ID gets longer and 
longer and finally exceeds the limit.

I tried to play around with adding a header and catch it, but somehow 
the HasHeader matcher doesn't work as planed. So I did the easy route:

What's the main thing I want to do? Rewrite the recipient. How can I 
check if I already did this? By checking the recipient of course. So I 
added this to my mailet-block:

<matcher name="local-service" 
match="org.apache.james.mailetcontainer.impl.matchers.And">
//...
     <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
         <matcher match="RecipientIs=local-service@cryptearth.de" />
     </matcher>
</matcher>

The whole block now works like this:

- for all mail from 127.0.0.0/8
-- that are NOT smtp-auth
-- that are NOT from webmaster@cryptearth.de
-- that are NOT to local-service@cryptearth.de
-> Redirect to local-service@cryptearth.de

This way I avoid re-loop as when the duplicated mail is queued it 
matches the specified recipient and isn't redirected again > loop broken.

I guess it would be wise to add IPv6, but as I set sendmail explicit to 
IPv4 127.0.0.1 and any other code I may write will use smtp-auth I guess 
it doesn't matter.

I hope I can mark this topic finally as done.


Matt

Am 28.05.2019 um 23:48 schrieb cryptearth:
> I don't get it. I've tested as much as I could - and now always get 
> this error. Seems I got somewhat different last time it worked as I 
> can't get it to work at all now. So I guess it's really into how the 
> name gets generated - time to dig deep into code.
>
> Matt
>
> Am 28.05.2019 um 17:43 schrieb cryptearth:
>> Hey Garry,
>>
>> I appreciate your effort. I don't think any of your questions are 
>> stupid, in fact, as you said: let's go on systematically.
>>
>> About the NICs: the VM emulates a Intel PRO/1000 MT Desktop 
>> (82540EM). The physical host the VM runs on has a Intel(R) 82583V 
>> Gigabit Network Connection, the laptop has two NICs: ethernet 
>> Qualcomm Atheros QCA8172 Fast Ether and wireless Realtek RTL8188EE 
>> Wireless Network Adapter. For the tests it doesn't matter if the NICs 
>> connected or not. Also, as far as I tested it doesn't matter if the 
>> IP is set via DHCP or static, IPv4 or IPv6 or both, assignment of 
>> hostname by my router or manual set. I even went so far to clone the 
>> VM image on the laptop and vise versa - after the system fiddled a 
>> bit to bring the NICs up the Exception persist.
>>
>> The tests work so far that if I sent a mail outbound it gets 
>> delivered (for example to google, I run a back-up on a small 
>> one-board-system - wich is still on openSUSE 42.3 and James 3.1-snap 
>> from June 3rd 2018.
>>
>> What I did not had tested yet (currently prepare the VM and laptop) 
>> is a james 3.3 on opensuse 15.0. Maybe it could be something change 
>> from opensuse 15.0 to 15.1 that causes this issue. The reason why I 
>> think this could be is all tests I did so far was on opensuse 15.0 
>> with james 3.3 and 3.4-snap from master I never had this issue. I 
>> will try this next and report back after all tests complete. If it is 
>> an issue with opensuse 15.1 I still can run 15.0 on all systems until 
>> either next version of opensuse is released or somehow I could figure 
>> it out.
>>
>> So far,
>>
>> Matt
>>
>> Am 28.05.2019 um 16:54 schrieb Garry Hurley:
>>> Hey Matt
>>>
>>> Sorry I missed some of the earlier emails in the chain. However, we 
>>> can look at your VM versus real machine systematically. The obvious 
>>> first difference is the way the network cards are described and/or 
>>> used. For example, on my antsle VMs, they share through the host on 
>>> the 10.1.1 network. If I want them on one of my home networks, say 
>>> the 192.168.1.x network, I have to assign them a second ‘nic’ on 
>>> that network and set up a static IP on that nic (my configuration, 
>>> but it does work). Now, I was reading in the postfix documentation 
>>> that mail servers are supposed to have static IP addresses for 
>>> relaying purposes. So, the questions I have to ask are: Are your IP 
>>> addresses static or dynamic on the physical servers? Do you have a 
>>> DNS entry for each server? On your physical box, have you set up an 
>>> /etc/hosts file (Linux) or C:\Windows\System32\drivers\etc\hostsfile 
>>> entry (Windows) for your mail server? Have you allowed local traffic 
>>> (or actually all traffic) through on port 25 and the secure email 
>>> ports(465 I think)? Is your router firewall blocking these ports? 
>>> Yeah, I know these are stupid sounding questions but rule out 
>>> problems with the server before blaming the app. I have ended up 
>>> with egg on my face more than once because of a configuration faux 
>>> paus on my computer.
>>>
>>> Sent from my iPhone
>>>
>>>> On May 27, 2019, at 3:35 PM, cryptearth <cr...@cryptearth.de> 
>>>> wrote:
>>>>
>>>> Hey there,
>>>>
>>>> I ran another test on another real machine instead of a VM - and 
>>>> surprisingly I encountered the same issue. So it seems somethings 
>>>> different on a real machine than on a vm causing this issue. Anyone 
>>>> knows how the "name" of a mail is composed in the first place and 
>>>> how it could be valid if cloning it exceeds some limit?
>>>>
>>>> Matt
>>>>
>>>>> Am 27.05.2019 um 18:19 schrieb cryptearth:
>>>>> Hey Garry,
>>>>>
>>>>> please use webarchive or server-user-thread.<x> to download the 
>>>>> whole thread - I already explained the reason why I "somewhat have 
>>>>> to" set it up this way.
>>>>>
>>>>> Long story short: unix uses local mail as to report output of 
>>>>> background / service processes. It's up the process how this is 
>>>>> done wich results in an not-uniform combination of 
>>>>> <username>@<hostname>.<domain>. James tries to remote-deliver any 
>>>>> mail belong to a domain not listed in domainlist and fails to 
>>>>> treat root1.cryptearth.de - wich is the FQDN - as 
>>>>> <hostname>.<domain> but rather treats it as its own - and every 
>>>>> mail to a user not contained in userlist just gets rejected with 
>>>>> "no user/mailbox".
>>>>> Solution: unify each mail dropped local, not smtpauth and not 
>>>>> specified manual in some sort of exclusion list.
>>>>> As it would require huge re-write to make a database solution work 
>>>>> - and I only need one mail excluded - I just "hardwired" this one 
>>>>> and rely on smtpauth otherwise for decide between local and 
>>>>> remote-delivery.
>>>>>
>>>>> It's NOT webmaster@cryptearth.de to local-service@cryptearth.de - 
>>>>> in fact these two are excluded as used to remote-delivery - but 
>>>>> <anything>@<hostname> (vm@root1) - <anything>@<hostname>.<domain> 
>>>>> (root@root1.cryptearth.de) or any maybe not-existing 
>>>>> <anything>@<domain> (user@cryptearth.de) wich hasn't authed (wich 
>>>>> isn't possible for non exisiting users) to in fact redirect them 
>>>>> to local-service@cryptearth.de. It's this non-uniformity paired 
>>>>> with how james behave about recipients not listed in domainlist or 
>>>>> userlist require me to rewrite those "local system mail".
>>>>>
>>>>> I tested this on a VM - works like a dream - did the same to my 
>>>>> root - fails. I tried to work out where the instance of Mail gets 
>>>>> created and how the initial name is set - but wasn't able to yet. 
>>>>> It's like turning all SMTP stuff inside out to figure out how it 
>>>>> works. As james uses netty I maybe also need to dug into this 
>>>>> framework to figure out where the specific handler is called 
>>>>> forming the Mail instance from the read input after seeing 
>>>>> <CRLF>.<CRLF>. So maybe someone can point out where to start to 
>>>>> figure out how/where the initial name is set to determine why the 
>>>>> copy fails on the root although it's pretty much the same system 
>>>>> as in my VM.
>>>>>
>>>>> Matt
>>>>>
>>>>>> Am 27.05.2019 um 15:36 schrieb Garry Hurley:
>>>>>> Why are you trying to redirect the mail from 
>>>>>> ‘webmaster@mydomain.com’ to ‘a.randome.user@mydomain.com’ anyhow? 
>>>>>> Isn’tthere an alias set up? I was just configuring postfix on 
>>>>>> another machine, not my james server, and I noted a virtualiases 
>>>>>> configuration for that purpose. I am recalling an aliases file in 
>>>>>> the conf directory. Maybe I am wrong or getting my versions mixed 
>>>>>> up (if not, maybe it should be that way). I think the rewrite you 
>>>>>> are trying to do is for sending from ‘webmaster@mydomain.com’ to 
>>>>>> ‘my.other.email@otherdomain.com’ and is actually overkill for 
>>>>>> what you are doing.
>>>>>>
>>>>>> Sent from my iPhone
>>>>>>
>>>>>>> On May 26, 2019, at 3:18 PM, cryptearth 
>>>>>>> <cr...@cryptearth.de> wrote:
>>>>>>>
>>>>>>> Well, seems it doesn't work in the real world.
>>>>>>>
>>>>>>> The way I mentioned worked in a VM so far - but after I upgraded 
>>>>>>> my root-server and did the same I know get this issue:
>>>>>>>
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO 20:58:02,242 | 
>>>>>>> org.apache.james.protocols.netty.BasicChannelUpstreamHandler | 
>>>>>>> Connection established from 127.0.0.1
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO 20:58:02,300 | 
>>>>>>> org.apache.james.domainlist.lib.AbstractDomainList | Local host 
>>>>>>> is: 127.0.0.1
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO 20:58:02,423 | 
>>>>>>> org.apache.james.smtpserver.SendMailHandler | Successfully 
>>>>>>> spooled mail 
>>>>>>> Mail1558897082344-b3644bc7-10c4-46a7-b670-75cf4dc9fd94 from 
>>>>>>> MaybeSender{mailAddress=Optional[cryptearth@root1.cryptearth.de]} 
>>>>>>> on localhost/127.0.0.1 for [cryptearth@root1.cryptearth.de]
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO 20:58:02,507 | 
>>>>>>> org.apache.james.protocols.netty.BasicChannelUpstreamHandler | 
>>>>>>> Connection closed for 127.0.0.1
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | ERROR 20:58:03,024 | 
>>>>>>> org.apache.james.mailetcontainer.impl.camel.CamelProcessor | 
>>>>>>> Exception calling Redirect: Unable to create a new message name: 
>>>>>>> too long. Possible loop in config.xml.
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | 
>>>>>>> javax.mail.MessagingException: Unable to create a new message 
>>>>>>> name: too long. Possible loop in config.xml.
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.james.server.core.MailImpl.detectPossibleLoop(MailImpl.java:344)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.james.server.core.MailImpl.deriveNewName(MailImpl.java:321) 
>>>>>>>
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.james.server.core.MailImpl.duplicate(MailImpl.java:103)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.james.transport.mailets.redirect.ProcessRedirectNotify.process(ProcessRedirectNotify.java:49)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.james.transport.mailets.Redirect.service(Redirect.java:475) 
>>>>>>>
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:81)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.handleMailet(CamelMailetProcessor.java:178)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.lambda$configure$0(CamelMailetProcessor.java:155)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:715)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:638)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:248)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.Splitter.process(Splitter.java:130)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.component.direct.DirectBlockingProducer.process(DirectBlockingProducer.java:53)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:541)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:506)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369) 
>>>>>>>
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:506) 
>>>>>>>
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:168)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor.service(CamelMailetProcessor.java:68)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.service(AbstractStateCompositeProcessor.java:84)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> org.apache.james.mailetcontainer.impl.JamesMailSpooler.lambda$run$0(JamesMailSpooler.java:163)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>>> java.lang.Thread.run(Thread.java:748)
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |
>>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | INFO 20:58:03,025 | 
>>>>>>> org.apache.james.transport.mailets.ToRepository | Storing mail 
>>>>>>> fd94-!5647419-!8598886-!8671760-!8516799-!7948334-!6362370-!1064056-!8846222 
>>>>>>> in MailRepositoryUrl{value=file://var/mail/error/}
>>>>>>>
>>>>>>> This is the content of the filtered message:
>>>>>>>
>>>>>>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error> 
>>>>>>> cat 
>>>>>>> 666439342D21353634373431392D21383539383838362D21383637313736302D21383531363739392D21373934383333342D21363336323337302D21313036343035362D2138383436323232.Repository.FileStreamStore
>>>>>>> To: local-service@cryptearth.de
>>>>>>> Message-ID: <20...@root1.cryptearth.de>
>>>>>>> MIME-Version: 1.0
>>>>>>> Received: from localhost (EHLO root1.cryptearth.de) ([127.0.0.1])
>>>>>>>             by localhost (JAMES SMTP Server ) with ESMTP ID 
>>>>>>> -1238704049
>>>>>>>             for <cr...@root1.cryptearth.de>;
>>>>>>>             Sun, 26 May 2019 20:58:02 +0200 (CEST)
>>>>>>> Received: (from cryptearth@localhost)
>>>>>>>           by root1.cryptearth.de (8.15.2/8.15.2/Submit) id 
>>>>>>> x4QIw2wp003888;
>>>>>>>           Sun, 26 May 2019 20:58:02 +0200
>>>>>>> Date: Sun, 26 May 2019 20:58:02 +0200
>>>>>>> From: "(Cron Daemon)" <cr...@root1.cryptearth.de>
>>>>>>> Subject: Cron <cr...@root1> /home/cryptearth/bin/test.sh
>>>>>>> Content-Type: text/plain; charset=UTF-8
>>>>>>> Auto-Submitted: auto-generated
>>>>>>> Precedence: bulk
>>>>>>> X-Cron-Env: <XDG_SESSION_ID=4>
>>>>>>> X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/1000>
>>>>>>> X-Cron-Env: <DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus>
>>>>>>> X-Cron-Env: <LANG=de_DE.UTF-8>
>>>>>>> X-Cron-Env: <SHELL=/bin/sh>
>>>>>>> X-Cron-Env: <HOME=/home/cryptearth>
>>>>>>> X-Cron-Env: <PATH=/usr/bin:/bin>
>>>>>>> X-Cron-Env: <LOGNAME=cryptearth>
>>>>>>> X-Cron-Env: <USER=cryptearth>
>>>>>>>
>>>>>>> test
>>>>>>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error>
>>>>>>>
>>>>>>> So, the redirect seems to work as far to change the recipient, 
>>>>>>> but then it can't be sent to the local user account. I'm unsure 
>>>>>>> if it's maybe some DNS/IP error as the way I re-installed the 
>>>>>>> system isn't supported by OVH. So maybe I made an error 
>>>>>>> somewhere. What's bothering me that the hostname sometimes keep 
>>>>>>> change back to localhost although it's correctly set anywhere.
>>>>>>>
>>>>>>> Maybe I get in touch with OVH support
>>>>>>>
>>>>>>> Matt
>>>>>>>
>>>>>>>> Am 24.05.2019 um 01:58 schrieb cryptearth:
>>>>>>>> Hey there, Matt here again.
>>>>>>>>
>>>>>>>> Long time since my last update on this topic, but now I got a 
>>>>>>>> pretty easy solution.
>>>>>>>>
>>>>>>>> On May 22nd OpenSUSE 15.1 was released, and with this new 
>>>>>>>> update I again looked at my "problem" about how to deal with 
>>>>>>>> apache and other local mail. Instead of my initial thoughts I 
>>>>>>>> hadn't to implement any myself, but james also comes with 
>>>>>>>> anything needed. The two keywords here are the CompositeMatcher 
>>>>>>>> and the Redirect mailet.
>>>>>>>>
>>>>>>>> To recap: basically I want to filter any local mail to a 
>>>>>>>> special service user except those from authed smtp and apache 
>>>>>>>> (wich is set to webmaster@cryptearth.de in php.ini).
>>>>>>>>
>>>>>>>> CompositeMatcher offers a way to easy implement this filter rule:
>>>>>>>>
>>>>>>>> <matcher name="local-service" 
>>>>>>>> match="org.apache.james.mailetcontainer.impl.matchers.And">
>>>>>>>>       <matcher match="RemoteAddrInNetwork=127.0.0.0/8" />
>>>>>>>>       <matcher 
>>>>>>>> match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>>>>>>           <matcher match="SMTPAuthSuccessful" />
>>>>>>>>       </matcher>
>>>>>>>>       <matcher 
>>>>>>>> match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>>>>>>           <matcher match="SenderIs=webmaster@cryptearth.de" />
>>>>>>>>       </matcher>
>>>>>>>> </matcher>
>>>>>>>>
>>>>>>>> I guess this speaks for itself, at least I guess anyone 
>>>>>>>> subscribed to this mailing-list should understand what this 
>>>>>>>> basic logic does.
>>>>>>>> One side-note: on start up the code that creates the config 
>>>>>>>> only looks for Matchers and Mailets in 
>>>>>>>> org.apache.james.transport.matchers.* - so any other classes 
>>>>>>>> has to be referenced by its FQN.
>>>>>>>>
>>>>>>>> As I now have all those mails I want to filter into the special 
>>>>>>>> mailbox an easy Redirect does the trick about rewriting the 
>>>>>>>> recipient:
>>>>>>>>
>>>>>>>> <mailet match="local-service" class="Redirect">
>>>>>>>> <to>local-service@cryptearth.de</to>
>>>>>>>> </mailet>
>>>>>>>>
>>>>>>>> The very convenient thing for apache is that every outgoing 
>>>>>>>> mail is also saved automatic in SENT as for any existing local 
>>>>>>>> user.
>>>>>>>>
>>>>>>>> I only came up with this as I started to dig my way around the 
>>>>>>>> github and wasn't satisfied with this compilcated way of 
>>>>>>>> looking up the API. So I quickly asked google about creating a 
>>>>>>>> complete javadoc - mvn javadoc:aggregate-jar did it. So I got 
>>>>>>>> an easy browsable api-doc.
>>>>>>>> About placement I inserted it right at top of root processor, 
>>>>>>>> even above the postmaster mailet. As it works it can't be that 
>>>>>>>> wrong, but if there is a better spot than right at top please 
>>>>>>>> tell me.
>>>>>>>>
>>>>>>>> So, this concludes my question about how to combine james with 
>>>>>>>> sendmail in a way sendmail is only the dumb nullclient 
>>>>>>>> forwarding all local generated mail to james. As the Redirect 
>>>>>>>> mailet also offers other rewrites of the headers I guess it 
>>>>>>>> could be used to do a bit more with a bit more work on the 
>>>>>>>> configs.
>>>>>>>>
>>>>>>>> Thanks for anyone helped about this topic - a huge help was the 
>>>>>>>> last reply from Benoit about using the RemoteAddrInNetwork class.
>>>>>>>>
>>>>>>>>
>>>>>>>> So long,
>>>>>>>>
>>>>>>>> Matt
>>>>>>>> <truncated>
>>>>>>> --------------------------------------------------------------------- 
>>>>>>>
>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: james and sendmail - wildcard alias for local users

Posted by cryptearth <cr...@cryptearth.de>.
I don't get it. I've tested as much as I could - and now always get this 
error. Seems I got somewhat different last time it worked as I can't get 
it to work at all now. So I guess it's really into how the name gets 
generated - time to dig deep into code.

Matt

Am 28.05.2019 um 17:43 schrieb cryptearth:
> Hey Garry,
>
> I appreciate your effort. I don't think any of your questions are 
> stupid, in fact, as you said: let's go on systematically.
>
> About the NICs: the VM emulates a Intel PRO/1000 MT Desktop (82540EM). 
> The physical host the VM runs on has a Intel(R) 82583V Gigabit Network 
> Connection, the laptop has two NICs: ethernet Qualcomm Atheros QCA8172 
> Fast Ether and wireless Realtek RTL8188EE Wireless Network Adapter. 
> For the tests it doesn't matter if the NICs connected or not. Also, as 
> far as I tested it doesn't matter if the IP is set via DHCP or static, 
> IPv4 or IPv6 or both, assignment of hostname by my router or manual 
> set. I even went so far to clone the VM image on the laptop and vise 
> versa - after the system fiddled a bit to bring the NICs up the 
> Exception persist.
>
> The tests work so far that if I sent a mail outbound it gets delivered 
> (for example to google, I run a back-up on a small one-board-system - 
> wich is still on openSUSE 42.3 and James 3.1-snap from June 3rd 2018.
>
> What I did not had tested yet (currently prepare the VM and laptop) is 
> a james 3.3 on opensuse 15.0. Maybe it could be something change from 
> opensuse 15.0 to 15.1 that causes this issue. The reason why I think 
> this could be is all tests I did so far was on opensuse 15.0 with 
> james 3.3 and 3.4-snap from master I never had this issue. I will try 
> this next and report back after all tests complete. If it is an issue 
> with opensuse 15.1 I still can run 15.0 on all systems until either 
> next version of opensuse is released or somehow I could figure it out.
>
> So far,
>
> Matt
>
> Am 28.05.2019 um 16:54 schrieb Garry Hurley:
>> Hey Matt
>>
>> Sorry I missed some of the earlier emails in the chain. However, we 
>> can look at your VM versus real machine systematically. The obvious 
>> first difference is the way the network cards are described and/or 
>> used. For example, on my antsle VMs, they share through the host on 
>> the 10.1.1 network. If I want them on one of my home networks, say 
>> the 192.168.1.x network, I have to assign them a second ‘nic’ on that 
>> network and set up a static IP on that nic (my configuration, but it 
>> does work). Now, I was reading in the postfix documentation that mail 
>> servers are supposed to have static IP addresses for relaying 
>> purposes. So, the questions I have to ask are: Are your IP addresses 
>> static or dynamic on the physical servers? Do you have a DNS entry 
>> for each server? On your physical box, have you set up an /etc/hosts 
>> file (Linux) or C:\Windows\System32\drivers\etc\hostsfile entry 
>> (Windows) for your mail server? Have you allowed local traffic (or 
>> actually all traffic) through on port 25 and the secure email 
>> ports(465 I think)? Is your router firewall blocking these ports? 
>> Yeah,  I know these are stupid sounding questions but rule out 
>> problems with the server before blaming the app. I have ended up with 
>> egg on my face more than once because of a configuration faux paus on 
>> my computer.
>>
>> Sent from my iPhone
>>
>>> On May 27, 2019, at 3:35 PM, cryptearth <cr...@cryptearth.de> 
>>> wrote:
>>>
>>> Hey there,
>>>
>>> I ran another test on another real machine instead of a VM - and 
>>> surprisingly I encountered the same issue. So it seems somethings 
>>> different on a real machine than on a vm causing this issue. Anyone 
>>> knows how the "name" of a mail is composed in the first place and 
>>> how it could be valid if cloning it exceeds some limit?
>>>
>>> Matt
>>>
>>>> Am 27.05.2019 um 18:19 schrieb cryptearth:
>>>> Hey Garry,
>>>>
>>>> please use webarchive or server-user-thread.<x> to download the 
>>>> whole thread - I already explained the reason why I "somewhat have 
>>>> to" set it up this way.
>>>>
>>>> Long story short: unix uses local mail as to report output of 
>>>> background / service processes. It's up the process how this is 
>>>> done wich results in an not-uniform combination of 
>>>> <username>@<hostname>.<domain>. James tries to remote-deliver any 
>>>> mail belong to a domain not listed in domainlist and fails to treat 
>>>> root1.cryptearth.de - wich is the FQDN - as <hostname>.<domain> but 
>>>> rather treats it as its own - and every mail to a user not 
>>>> contained in userlist just gets rejected with "no user/mailbox".
>>>> Solution: unify each mail dropped local, not smtpauth and not 
>>>> specified manual in some sort of exclusion list.
>>>> As it would require huge re-write to make a database solution work 
>>>> - and I only need one mail excluded - I just "hardwired" this one 
>>>> and rely on smtpauth otherwise for decide between local and 
>>>> remote-delivery.
>>>>
>>>> It's NOT webmaster@cryptearth.de to local-service@cryptearth.de - 
>>>> in fact these two are excluded as used to remote-delivery - but 
>>>> <anything>@<hostname> (vm@root1) - <anything>@<hostname>.<domain> 
>>>> (root@root1.cryptearth.de) or any maybe not-existing 
>>>> <anything>@<domain> (user@cryptearth.de) wich hasn't authed (wich 
>>>> isn't possible for non exisiting users) to in fact redirect them to 
>>>> local-service@cryptearth.de. It's this non-uniformity paired with 
>>>> how james behave about recipients not listed in domainlist or 
>>>> userlist require me to rewrite those "local system mail".
>>>>
>>>> I tested this on a VM - works like a dream - did the same to my 
>>>> root - fails. I tried to work out where the instance of Mail gets 
>>>> created and how the initial name is set - but wasn't able to yet. 
>>>> It's like turning all SMTP stuff inside out to figure out how it 
>>>> works. As james uses netty I maybe also need to dug into this 
>>>> framework to figure out where the specific handler is called 
>>>> forming the Mail instance from the read input after seeing 
>>>> <CRLF>.<CRLF>. So maybe someone can point out where to start to 
>>>> figure out how/where the initial name is set to determine why the 
>>>> copy fails on the root although it's pretty much the same system as 
>>>> in my VM.
>>>>
>>>> Matt
>>>>
>>>>> Am 27.05.2019 um 15:36 schrieb Garry Hurley:
>>>>> Why are you trying to redirect the mail from 
>>>>> ‘webmaster@mydomain.com’ to ‘a.randome.user@mydomain.com’ anyhow? 
>>>>> Isn’tthere an alias set up? I was just configuring postfix on 
>>>>> another machine, not my james server, and I noted a virtualiases 
>>>>> configuration for that purpose. I am recalling an aliases file in 
>>>>> the conf directory. Maybe I am wrong or getting my versions mixed 
>>>>> up (if not, maybe it should be that way). I think the rewrite you 
>>>>> are trying to do is for sending from ‘webmaster@mydomain.com’ to 
>>>>> ‘my.other.email@otherdomain.com’ and is actually overkill for what 
>>>>> you are doing.
>>>>>
>>>>> Sent from my iPhone
>>>>>
>>>>>> On May 26, 2019, at 3:18 PM, cryptearth 
>>>>>> <cr...@cryptearth.de> wrote:
>>>>>>
>>>>>> Well, seems it doesn't work in the real world.
>>>>>>
>>>>>> The way I mentioned worked in a VM so far - but after I upgraded 
>>>>>> my root-server and did the same I know get this issue:
>>>>>>
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO 20:58:02,242 | 
>>>>>> org.apache.james.protocols.netty.BasicChannelUpstreamHandler | 
>>>>>> Connection established from 127.0.0.1
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO 20:58:02,300 | 
>>>>>> org.apache.james.domainlist.lib.AbstractDomainList | Local host 
>>>>>> is: 127.0.0.1
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO 20:58:02,423 | 
>>>>>> org.apache.james.smtpserver.SendMailHandler | Successfully 
>>>>>> spooled mail 
>>>>>> Mail1558897082344-b3644bc7-10c4-46a7-b670-75cf4dc9fd94 from 
>>>>>> MaybeSender{mailAddress=Optional[cryptearth@root1.cryptearth.de]} 
>>>>>> on localhost/127.0.0.1 for [cryptearth@root1.cryptearth.de]
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO 20:58:02,507 | 
>>>>>> org.apache.james.protocols.netty.BasicChannelUpstreamHandler | 
>>>>>> Connection closed for 127.0.0.1
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | ERROR 20:58:03,024 | 
>>>>>> org.apache.james.mailetcontainer.impl.camel.CamelProcessor | 
>>>>>> Exception calling Redirect: Unable to create a new message name: 
>>>>>> too long. Possible loop in config.xml.
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | 
>>>>>> javax.mail.MessagingException: Unable to create a new message 
>>>>>> name: too long. Possible loop in config.xml.
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.james.server.core.MailImpl.detectPossibleLoop(MailImpl.java:344)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.james.server.core.MailImpl.deriveNewName(MailImpl.java:321) 
>>>>>>
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.james.server.core.MailImpl.duplicate(MailImpl.java:103)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.james.transport.mailets.redirect.ProcessRedirectNotify.process(ProcessRedirectNotify.java:49)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.james.transport.mailets.Redirect.service(Redirect.java:475) 
>>>>>>
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:81)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.handleMailet(CamelMailetProcessor.java:178)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.lambda$configure$0(CamelMailetProcessor.java:155)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:715)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:638)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:248)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.Splitter.process(Splitter.java:130)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.component.direct.DirectBlockingProducer.process(DirectBlockingProducer.java:53)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:541)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:506)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369) 
>>>>>>
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:506) 
>>>>>>
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:168)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor.service(CamelMailetProcessor.java:68)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.service(AbstractStateCompositeProcessor.java:84)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> org.apache.james.mailetcontainer.impl.JamesMailSpooler.lambda$run$0(JamesMailSpooler.java:163)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>>>>> java.lang.Thread.run(Thread.java:748)
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |
>>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | INFO 20:58:03,025 | 
>>>>>> org.apache.james.transport.mailets.ToRepository | Storing mail 
>>>>>> fd94-!5647419-!8598886-!8671760-!8516799-!7948334-!6362370-!1064056-!8846222 
>>>>>> in MailRepositoryUrl{value=file://var/mail/error/}
>>>>>>
>>>>>> This is the content of the filtered message:
>>>>>>
>>>>>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error> cat 
>>>>>> 666439342D21353634373431392D21383539383838362D21383637313736302D21383531363739392D21373934383333342D21363336323337302D21313036343035362D2138383436323232.Repository.FileStreamStore
>>>>>> To: local-service@cryptearth.de
>>>>>> Message-ID: <20...@root1.cryptearth.de>
>>>>>> MIME-Version: 1.0
>>>>>> Received: from localhost (EHLO root1.cryptearth.de) ([127.0.0.1])
>>>>>>             by localhost (JAMES SMTP Server ) with ESMTP ID 
>>>>>> -1238704049
>>>>>>             for <cr...@root1.cryptearth.de>;
>>>>>>             Sun, 26 May 2019 20:58:02 +0200 (CEST)
>>>>>> Received: (from cryptearth@localhost)
>>>>>>           by root1.cryptearth.de (8.15.2/8.15.2/Submit) id 
>>>>>> x4QIw2wp003888;
>>>>>>           Sun, 26 May 2019 20:58:02 +0200
>>>>>> Date: Sun, 26 May 2019 20:58:02 +0200
>>>>>> From: "(Cron Daemon)" <cr...@root1.cryptearth.de>
>>>>>> Subject: Cron <cr...@root1> /home/cryptearth/bin/test.sh
>>>>>> Content-Type: text/plain; charset=UTF-8
>>>>>> Auto-Submitted: auto-generated
>>>>>> Precedence: bulk
>>>>>> X-Cron-Env: <XDG_SESSION_ID=4>
>>>>>> X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/1000>
>>>>>> X-Cron-Env: <DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus>
>>>>>> X-Cron-Env: <LANG=de_DE.UTF-8>
>>>>>> X-Cron-Env: <SHELL=/bin/sh>
>>>>>> X-Cron-Env: <HOME=/home/cryptearth>
>>>>>> X-Cron-Env: <PATH=/usr/bin:/bin>
>>>>>> X-Cron-Env: <LOGNAME=cryptearth>
>>>>>> X-Cron-Env: <USER=cryptearth>
>>>>>>
>>>>>> test
>>>>>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error>
>>>>>>
>>>>>> So, the redirect seems to work as far to change the recipient, 
>>>>>> but then it can't be sent to the local user account. I'm unsure 
>>>>>> if it's maybe some DNS/IP error as the way I re-installed the 
>>>>>> system isn't supported by OVH. So maybe I made an error 
>>>>>> somewhere. What's bothering me that the hostname sometimes keep 
>>>>>> change back to localhost although it's correctly set anywhere.
>>>>>>
>>>>>> Maybe I get in touch with OVH support
>>>>>>
>>>>>> Matt
>>>>>>
>>>>>>> Am 24.05.2019 um 01:58 schrieb cryptearth:
>>>>>>> Hey there, Matt here again.
>>>>>>>
>>>>>>> Long time since my last update on this topic, but now I got a 
>>>>>>> pretty easy solution.
>>>>>>>
>>>>>>> On May 22nd OpenSUSE 15.1 was released, and with this new update 
>>>>>>> I again looked at my "problem" about how to deal with apache and 
>>>>>>> other local mail. Instead of my initial thoughts I hadn't to 
>>>>>>> implement any myself, but james also comes with anything needed. 
>>>>>>> The two keywords here are the CompositeMatcher and the Redirect 
>>>>>>> mailet.
>>>>>>>
>>>>>>> To recap: basically I want to filter any local mail to a special 
>>>>>>> service user except those from authed smtp and apache (wich is 
>>>>>>> set to webmaster@cryptearth.de in php.ini).
>>>>>>>
>>>>>>> CompositeMatcher offers a way to easy implement this filter rule:
>>>>>>>
>>>>>>> <matcher name="local-service" 
>>>>>>> match="org.apache.james.mailetcontainer.impl.matchers.And">
>>>>>>>       <matcher match="RemoteAddrInNetwork=127.0.0.0/8" />
>>>>>>>       <matcher 
>>>>>>> match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>>>>>           <matcher match="SMTPAuthSuccessful" />
>>>>>>>       </matcher>
>>>>>>>       <matcher 
>>>>>>> match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>>>>>           <matcher match="SenderIs=webmaster@cryptearth.de" />
>>>>>>>       </matcher>
>>>>>>> </matcher>
>>>>>>>
>>>>>>> I guess this speaks for itself, at least I guess anyone 
>>>>>>> subscribed to this mailing-list should understand what this 
>>>>>>> basic logic does.
>>>>>>> One side-note: on start up the code that creates the config only 
>>>>>>> looks for Matchers and Mailets in 
>>>>>>> org.apache.james.transport.matchers.* - so any other classes has 
>>>>>>> to be referenced by its FQN.
>>>>>>>
>>>>>>> As I now have all those mails I want to filter into the special 
>>>>>>> mailbox an easy Redirect does the trick about rewriting the 
>>>>>>> recipient:
>>>>>>>
>>>>>>> <mailet match="local-service" class="Redirect">
>>>>>>>       <to>local-service@cryptearth.de</to>
>>>>>>> </mailet>
>>>>>>>
>>>>>>> The very convenient thing for apache is that every outgoing mail 
>>>>>>> is also saved automatic in SENT as for any existing local user.
>>>>>>>
>>>>>>> I only came up with this as I started to dig my way around the 
>>>>>>> github and wasn't satisfied with this compilcated way of looking 
>>>>>>> up the API. So I quickly asked google about creating a complete 
>>>>>>> javadoc - mvn javadoc:aggregate-jar did it. So I got an easy 
>>>>>>> browsable api-doc.
>>>>>>> About placement I inserted it right at top of root processor, 
>>>>>>> even above the postmaster mailet. As it works it can't be that 
>>>>>>> wrong, but if there is a better spot than right at top please 
>>>>>>> tell me.
>>>>>>>
>>>>>>> So, this concludes my question about how to combine james with 
>>>>>>> sendmail in a way sendmail is only the dumb nullclient 
>>>>>>> forwarding all local generated mail to james. As the Redirect 
>>>>>>> mailet also offers other rewrites of the headers I guess it 
>>>>>>> could be used to do a bit more with a bit more work on the configs.
>>>>>>>
>>>>>>> Thanks for anyone helped about this topic - a huge help was the 
>>>>>>> last reply from Benoit about using the RemoteAddrInNetwork class.
>>>>>>>
>>>>>>>
>>>>>>> So long,
>>>>>>>
>>>>>>> Matt
>>>>>>> <truncated>
>>>>>> --------------------------------------------------------------------- 
>>>>>>
>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: james and sendmail - wildcard alias for local users

Posted by cryptearth <cr...@cryptearth.de>.
Hey Garry,

I appreciate your effort. I don't think any of your questions are 
stupid, in fact, as you said: let's go on systematically.

About the NICs: the VM emulates a Intel PRO/1000 MT Desktop (82540EM). 
The physical host the VM runs on has a Intel(R) 82583V Gigabit Network 
Connection, the laptop has two NICs: ethernet Qualcomm Atheros QCA8172 
Fast Ether and wireless Realtek RTL8188EE Wireless Network Adapter. For 
the tests it doesn't matter if the NICs connected or not. Also, as far 
as I tested it doesn't matter if the IP is set via DHCP or static, IPv4 
or IPv6 or both, assignment of hostname by my router or manual set. I 
even went so far to clone the VM image on the laptop and vise versa - 
after the system fiddled a bit to bring the NICs up the Exception persist.

The tests work so far that if I sent a mail outbound it gets delivered 
(for example to google, I run a back-up on a small one-board-system - 
wich is still on openSUSE 42.3 and James 3.1-snap from June 3rd 2018.

What I did not had tested yet (currently prepare the VM and laptop) is a 
james 3.3 on opensuse 15.0. Maybe it could be something change from 
opensuse 15.0 to 15.1 that causes this issue. The reason why I think 
this could be is all tests I did so far was on opensuse 15.0 with james 
3.3 and 3.4-snap from master I never had this issue. I will try this 
next and report back after all tests complete. If it is an issue with 
opensuse 15.1 I still can run 15.0 on all systems until either next 
version of opensuse is released or somehow I could figure it out.

So far,

Matt

Am 28.05.2019 um 16:54 schrieb Garry Hurley:
> Hey Matt
>
> Sorry I missed some of the earlier emails in the chain. However, we can look at your VM versus real machine systematically. The obvious first difference is the way the network cards are described and/or used. For example, on my antsle VMs, they share through the host on the 10.1.1 network. If I want them on one of my home networks, say the 192.168.1.x network, I have to assign them a second ‘nic’ on that network and set up a static IP on that nic (my configuration, but it does work). Now, I was reading in the postfix documentation that mail servers are supposed to have static IP addresses for relaying purposes. So, the questions I have to ask are: Are your IP addresses static or dynamic on the physical servers? Do you have a DNS entry for each server? On your physical box, have you set up an /etc/hosts file (Linux) or C:\Windows\System32\drivers\etc\hostsfile entry (Windows) for your mail server? Have you allowed local traffic (or actually all traffic) through on port 25 and the secure email ports(465 I think)? Is your router firewall blocking these ports? Yeah,  I know these are stupid sounding questions but rule out problems with the server before blaming the app. I have ended up with egg on my face more than once because of a configuration faux paus on my computer.
>
> Sent from my iPhone
>
>> On May 27, 2019, at 3:35 PM, cryptearth <cr...@cryptearth.de> wrote:
>>
>> Hey there,
>>
>> I ran another test on another real machine instead of a VM - and surprisingly I encountered the same issue. So it seems somethings different on a real machine than on a vm causing this issue. Anyone knows how the "name" of a mail is composed in the first place and how it could be valid if cloning it exceeds some limit?
>>
>> Matt
>>
>>> Am 27.05.2019 um 18:19 schrieb cryptearth:
>>> Hey Garry,
>>>
>>> please use webarchive or server-user-thread.<x> to download the whole thread - I already explained the reason why I "somewhat have to" set it up this way.
>>>
>>> Long story short: unix uses local mail as to report output of background / service processes. It's up the process how this is done wich results in an not-uniform combination of <username>@<hostname>.<domain>. James tries to remote-deliver any mail belong to a domain not listed in domainlist and fails to treat root1.cryptearth.de - wich is the FQDN - as <hostname>.<domain> but rather treats it as its own - and every mail to a user not contained in userlist just gets rejected with "no user/mailbox".
>>> Solution: unify each mail dropped local, not smtpauth and not specified manual in some sort of exclusion list.
>>> As it would require huge re-write to make a database solution work - and I only need one mail excluded - I just "hardwired" this one and rely on smtpauth otherwise for decide between local and remote-delivery.
>>>
>>> It's NOT webmaster@cryptearth.de to local-service@cryptearth.de - in fact these two are excluded as used to remote-delivery - but <anything>@<hostname> (vm@root1) - <anything>@<hostname>.<domain> (root@root1.cryptearth.de) or any maybe not-existing <anything>@<domain> (user@cryptearth.de) wich hasn't authed (wich isn't possible for non exisiting users) to in fact redirect them to local-service@cryptearth.de. It's this non-uniformity paired with how james behave about recipients not listed in domainlist or userlist require me to rewrite those "local system mail".
>>>
>>> I tested this on a VM - works like a dream - did the same to my root - fails. I tried to work out where the instance of Mail gets created and how the initial name is set - but wasn't able to yet. It's like turning all SMTP stuff inside out to figure out how it works. As james uses netty I maybe also need to dug into this framework to figure out where the specific handler is called forming the Mail instance from the read input after seeing <CRLF>.<CRLF>. So maybe someone can point out where to start to figure out how/where the initial name is set to determine why the copy fails on the root although it's pretty much the same system as in my VM.
>>>
>>> Matt
>>>
>>>> Am 27.05.2019 um 15:36 schrieb Garry Hurley:
>>>> Why are you trying to redirect the mail from ‘webmaster@mydomain.com’ to ‘a.randome.user@mydomain.com’ anyhow? Isn’tthere an alias set up? I was just configuring postfix on another machine, not my james server, and I noted a virtualiases configuration for that purpose. I am recalling an aliases file in the conf directory. Maybe I am wrong or getting my versions mixed up (if not, maybe it should be that way). I think the rewrite you are trying to do is for sending from ‘webmaster@mydomain.com’ to ‘my.other.email@otherdomain.com’ and is actually overkill for what you are doing.
>>>>
>>>> Sent from my iPhone
>>>>
>>>>> On May 26, 2019, at 3:18 PM, cryptearth <cr...@cryptearth.de> wrote:
>>>>>
>>>>> Well, seems it doesn't work in the real world.
>>>>>
>>>>> The way I mentioned worked in a VM so far - but after I upgraded my root-server and did the same I know get this issue:
>>>>>
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,242 | org.apache.james.protocols.netty.BasicChannelUpstreamHandler | Connection established from 127.0.0.1
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,300 | org.apache.james.domainlist.lib.AbstractDomainList | Local host is: 127.0.0.1
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,423 | org.apache.james.smtpserver.SendMailHandler | Successfully spooled mail Mail1558897082344-b3644bc7-10c4-46a7-b670-75cf4dc9fd94 from MaybeSender{mailAddress=Optional[cryptearth@root1.cryptearth.de]} on localhost/127.0.0.1 for [cryptearth@root1.cryptearth.de]
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,507 | org.apache.james.protocols.netty.BasicChannelUpstreamHandler | Connection closed for 127.0.0.1
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | ERROR 20:58:03,024 | org.apache.james.mailetcontainer.impl.camel.CamelProcessor | Exception calling Redirect: Unable to create a new message name: too long. Possible loop in config.xml.
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | javax.mail.MessagingException: Unable to create a new message name: too long. Possible loop in config.xml.
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.detectPossibleLoop(MailImpl.java:344)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.deriveNewName(MailImpl.java:321)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.duplicate(MailImpl.java:103)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.transport.mailets.redirect.ProcessRedirectNotify.process(ProcessRedirectNotify.java:49)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.transport.mailets.Redirect.service(Redirect.java:475)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:81)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.handleMailet(CamelMailetProcessor.java:178)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.lambda$configure$0(CamelMailetProcessor.java:155)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:715)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:638)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:248)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Splitter.process(Splitter.java:130)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.component.direct.DirectBlockingProducer.process(DirectBlockingProducer.java:53)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:541)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:506)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:506)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:168)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor.service(CamelMailetProcessor.java:68)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.service(AbstractStateCompositeProcessor.java:84)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.JamesMailSpooler.lambda$run$0(JamesMailSpooler.java:163)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.lang.Thread.run(Thread.java:748)
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |
>>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | INFO  20:58:03,025 | org.apache.james.transport.mailets.ToRepository | Storing mail fd94-!5647419-!8598886-!8671760-!8516799-!7948334-!6362370-!1064056-!8846222 in MailRepositoryUrl{value=file://var/mail/error/}
>>>>>
>>>>> This is the content of the filtered message:
>>>>>
>>>>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error> cat 666439342D21353634373431392D21383539383838362D21383637313736302D21383531363739392D21373934383333342D21363336323337302D21313036343035362D2138383436323232.Repository.FileStreamStore
>>>>> To: local-service@cryptearth.de
>>>>> Message-ID: <20...@root1.cryptearth.de>
>>>>> MIME-Version: 1.0
>>>>> Received: from localhost (EHLO root1.cryptearth.de) ([127.0.0.1])
>>>>>             by localhost (JAMES SMTP Server ) with ESMTP ID -1238704049
>>>>>             for <cr...@root1.cryptearth.de>;
>>>>>             Sun, 26 May 2019 20:58:02 +0200 (CEST)
>>>>> Received: (from cryptearth@localhost)
>>>>>           by root1.cryptearth.de (8.15.2/8.15.2/Submit) id x4QIw2wp003888;
>>>>>           Sun, 26 May 2019 20:58:02 +0200
>>>>> Date: Sun, 26 May 2019 20:58:02 +0200
>>>>> From: "(Cron Daemon)" <cr...@root1.cryptearth.de>
>>>>> Subject: Cron <cr...@root1> /home/cryptearth/bin/test.sh
>>>>> Content-Type: text/plain; charset=UTF-8
>>>>> Auto-Submitted: auto-generated
>>>>> Precedence: bulk
>>>>> X-Cron-Env: <XDG_SESSION_ID=4>
>>>>> X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/1000>
>>>>> X-Cron-Env: <DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus>
>>>>> X-Cron-Env: <LANG=de_DE.UTF-8>
>>>>> X-Cron-Env: <SHELL=/bin/sh>
>>>>> X-Cron-Env: <HOME=/home/cryptearth>
>>>>> X-Cron-Env: <PATH=/usr/bin:/bin>
>>>>> X-Cron-Env: <LOGNAME=cryptearth>
>>>>> X-Cron-Env: <USER=cryptearth>
>>>>>
>>>>> test
>>>>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error>
>>>>>
>>>>> So, the redirect seems to work as far to change the recipient, but then it can't be sent to the local user account. I'm unsure if it's maybe some DNS/IP error as the way I re-installed the system isn't supported by OVH. So maybe I made an error somewhere. What's bothering me that the hostname sometimes keep change back to localhost although it's correctly set anywhere.
>>>>>
>>>>> Maybe I get in touch with OVH support
>>>>>
>>>>> Matt
>>>>>
>>>>>> Am 24.05.2019 um 01:58 schrieb cryptearth:
>>>>>> Hey there, Matt here again.
>>>>>>
>>>>>> Long time since my last update on this topic, but now I got a pretty easy solution.
>>>>>>
>>>>>> On May 22nd OpenSUSE 15.1 was released, and with this new update I again looked at my "problem" about how to deal with apache and other local mail. Instead of my initial thoughts I hadn't to implement any myself, but james also comes with anything needed. The two keywords here are the CompositeMatcher and the Redirect mailet.
>>>>>>
>>>>>> To recap: basically I want to filter any local mail to a special service user except those from authed smtp and apache (wich is set to webmaster@cryptearth.de in php.ini).
>>>>>>
>>>>>> CompositeMatcher offers a way to easy implement this filter rule:
>>>>>>
>>>>>> <matcher name="local-service" match="org.apache.james.mailetcontainer.impl.matchers.And">
>>>>>>       <matcher match="RemoteAddrInNetwork=127.0.0.0/8" />
>>>>>>       <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>>>>           <matcher match="SMTPAuthSuccessful" />
>>>>>>       </matcher>
>>>>>>       <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>>>>           <matcher match="SenderIs=webmaster@cryptearth.de" />
>>>>>>       </matcher>
>>>>>> </matcher>
>>>>>>
>>>>>> I guess this speaks for itself, at least I guess anyone subscribed to this mailing-list should understand what this basic logic does.
>>>>>> One side-note: on start up the code that creates the config only looks for Matchers and Mailets in org.apache.james.transport.matchers.* - so any other classes has to be referenced by its FQN.
>>>>>>
>>>>>> As I now have all those mails I want to filter into the special mailbox an easy Redirect does the trick about rewriting the recipient:
>>>>>>
>>>>>> <mailet match="local-service" class="Redirect">
>>>>>>       <to>local-service@cryptearth.de</to>
>>>>>> </mailet>
>>>>>>
>>>>>> The very convenient thing for apache is that every outgoing mail is also saved automatic in SENT as for any existing local user.
>>>>>>
>>>>>> I only came up with this as I started to dig my way around the github and wasn't satisfied with this compilcated way of looking up the API. So I quickly asked google about creating a complete javadoc - mvn javadoc:aggregate-jar did it. So I got an easy browsable api-doc.
>>>>>> About placement I inserted it right at top of root processor, even above the postmaster mailet. As it works it can't be that wrong, but if there is a better spot than right at top please tell me.
>>>>>>
>>>>>> So, this concludes my question about how to combine james with sendmail in a way sendmail is only the dumb nullclient forwarding all local generated mail to james. As the Redirect mailet also offers other rewrites of the headers I guess it could be used to do a bit more with a bit more work on the configs.
>>>>>>
>>>>>> Thanks for anyone helped about this topic - a huge help was the last reply from Benoit about using the RemoteAddrInNetwork class.
>>>>>>
>>>>>>
>>>>>> So long,
>>>>>>
>>>>>> Matt
>>>>>> <truncated>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>



---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: james and sendmail - wildcard alias for local users

Posted by Garry Hurley <ga...@gmail.com>.
Hey Matt

Sorry I missed some of the earlier emails in the chain. However, we can look at your VM versus real machine systematically. The obvious first difference is the way the network cards are described and/or used. For example, on my antsle VMs, they share through the host on the 10.1.1 network. If I want them on one of my home networks, say the 192.168.1.x network, I have to assign them a second ‘nic’ on that network and set up a static IP on that nic (my configuration, but it does work). Now, I was reading in the postfix documentation that mail servers are supposed to have static IP addresses for relaying purposes. So, the questions I have to ask are: Are your IP addresses static or dynamic on the physical servers? Do you have a DNS entry for each server? On your physical box, have you set up an /etc/hosts file (Linux) or C:\Windows\System32\drivers\etc\hostsfile entry (Windows) for your mail server? Have you allowed local traffic (or actually all traffic) through on port 25 and the secure email ports(465 I think)? Is your router firewall blocking these ports? Yeah,  I know these are stupid sounding questions but rule out problems with the server before blaming the app. I have ended up with egg on my face more than once because of a configuration faux paus on my computer. 

Sent from my iPhone

> On May 27, 2019, at 3:35 PM, cryptearth <cr...@cryptearth.de> wrote:
> 
> Hey there,
> 
> I ran another test on another real machine instead of a VM - and surprisingly I encountered the same issue. So it seems somethings different on a real machine than on a vm causing this issue. Anyone knows how the "name" of a mail is composed in the first place and how it could be valid if cloning it exceeds some limit?
> 
> Matt
> 
>> Am 27.05.2019 um 18:19 schrieb cryptearth:
>> Hey Garry,
>> 
>> please use webarchive or server-user-thread.<x> to download the whole thread - I already explained the reason why I "somewhat have to" set it up this way.
>> 
>> Long story short: unix uses local mail as to report output of background / service processes. It's up the process how this is done wich results in an not-uniform combination of <username>@<hostname>.<domain>. James tries to remote-deliver any mail belong to a domain not listed in domainlist and fails to treat root1.cryptearth.de - wich is the FQDN - as <hostname>.<domain> but rather treats it as its own - and every mail to a user not contained in userlist just gets rejected with "no user/mailbox".
>> Solution: unify each mail dropped local, not smtpauth and not specified manual in some sort of exclusion list.
>> As it would require huge re-write to make a database solution work - and I only need one mail excluded - I just "hardwired" this one and rely on smtpauth otherwise for decide between local and remote-delivery.
>> 
>> It's NOT webmaster@cryptearth.de to local-service@cryptearth.de - in fact these two are excluded as used to remote-delivery - but <anything>@<hostname> (vm@root1) - <anything>@<hostname>.<domain> (root@root1.cryptearth.de) or any maybe not-existing <anything>@<domain> (user@cryptearth.de) wich hasn't authed (wich isn't possible for non exisiting users) to in fact redirect them to local-service@cryptearth.de. It's this non-uniformity paired with how james behave about recipients not listed in domainlist or userlist require me to rewrite those "local system mail".
>> 
>> I tested this on a VM - works like a dream - did the same to my root - fails. I tried to work out where the instance of Mail gets created and how the initial name is set - but wasn't able to yet. It's like turning all SMTP stuff inside out to figure out how it works. As james uses netty I maybe also need to dug into this framework to figure out where the specific handler is called forming the Mail instance from the read input after seeing <CRLF>.<CRLF>. So maybe someone can point out where to start to figure out how/where the initial name is set to determine why the copy fails on the root although it's pretty much the same system as in my VM.
>> 
>> Matt
>> 
>>> Am 27.05.2019 um 15:36 schrieb Garry Hurley:
>>> Why are you trying to redirect the mail from ‘webmaster@mydomain.com’ to ‘a.randome.user@mydomain.com’ anyhow? Isn’tthere an alias set up? I was just configuring postfix on another machine, not my james server, and I noted a virtualiases configuration for that purpose. I am recalling an aliases file in the conf directory. Maybe I am wrong or getting my versions mixed up (if not, maybe it should be that way). I think the rewrite you are trying to do is for sending from ‘webmaster@mydomain.com’ to ‘my.other.email@otherdomain.com’ and is actually overkill for what you are doing.
>>> 
>>> Sent from my iPhone
>>> 
>>>> On May 26, 2019, at 3:18 PM, cryptearth <cr...@cryptearth.de> wrote:
>>>> 
>>>> Well, seems it doesn't work in the real world.
>>>> 
>>>> The way I mentioned worked in a VM so far - but after I upgraded my root-server and did the same I know get this issue:
>>>> 
>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,242 | org.apache.james.protocols.netty.BasicChannelUpstreamHandler | Connection established from 127.0.0.1
>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,300 | org.apache.james.domainlist.lib.AbstractDomainList | Local host is: 127.0.0.1
>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,423 | org.apache.james.smtpserver.SendMailHandler | Successfully spooled mail Mail1558897082344-b3644bc7-10c4-46a7-b670-75cf4dc9fd94 from MaybeSender{mailAddress=Optional[cryptearth@root1.cryptearth.de]} on localhost/127.0.0.1 for [cryptearth@root1.cryptearth.de]
>>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,507 | org.apache.james.protocols.netty.BasicChannelUpstreamHandler | Connection closed for 127.0.0.1
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | ERROR 20:58:03,024 | org.apache.james.mailetcontainer.impl.camel.CamelProcessor | Exception calling Redirect: Unable to create a new message name: too long. Possible loop in config.xml.
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | javax.mail.MessagingException: Unable to create a new message name: too long. Possible loop in config.xml.
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.detectPossibleLoop(MailImpl.java:344)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.deriveNewName(MailImpl.java:321)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.duplicate(MailImpl.java:103)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.transport.mailets.redirect.ProcessRedirectNotify.process(ProcessRedirectNotify.java:49)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.transport.mailets.Redirect.service(Redirect.java:475)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:81)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.handleMailet(CamelMailetProcessor.java:178)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.lambda$configure$0(CamelMailetProcessor.java:155)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:715)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:638)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:248)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Splitter.process(Splitter.java:130)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.component.direct.DirectBlockingProducer.process(DirectBlockingProducer.java:53)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:541)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:506)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369) 
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:506) 
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:168)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor.service(CamelMailetProcessor.java:68)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.service(AbstractStateCompositeProcessor.java:84)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.JamesMailSpooler.lambda$run$0(JamesMailSpooler.java:163)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.lang.Thread.run(Thread.java:748)
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |
>>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | INFO  20:58:03,025 | org.apache.james.transport.mailets.ToRepository | Storing mail fd94-!5647419-!8598886-!8671760-!8516799-!7948334-!6362370-!1064056-!8846222 in MailRepositoryUrl{value=file://var/mail/error/}
>>>> 
>>>> This is the content of the filtered message:
>>>> 
>>>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error> cat 666439342D21353634373431392D21383539383838362D21383637313736302D21383531363739392D21373934383333342D21363336323337302D21313036343035362D2138383436323232.Repository.FileStreamStore
>>>> To: local-service@cryptearth.de
>>>> Message-ID: <20...@root1.cryptearth.de>
>>>> MIME-Version: 1.0
>>>> Received: from localhost (EHLO root1.cryptearth.de) ([127.0.0.1])
>>>>            by localhost (JAMES SMTP Server ) with ESMTP ID -1238704049
>>>>            for <cr...@root1.cryptearth.de>;
>>>>            Sun, 26 May 2019 20:58:02 +0200 (CEST)
>>>> Received: (from cryptearth@localhost)
>>>>          by root1.cryptearth.de (8.15.2/8.15.2/Submit) id x4QIw2wp003888;
>>>>          Sun, 26 May 2019 20:58:02 +0200
>>>> Date: Sun, 26 May 2019 20:58:02 +0200
>>>> From: "(Cron Daemon)" <cr...@root1.cryptearth.de>
>>>> Subject: Cron <cr...@root1> /home/cryptearth/bin/test.sh
>>>> Content-Type: text/plain; charset=UTF-8
>>>> Auto-Submitted: auto-generated
>>>> Precedence: bulk
>>>> X-Cron-Env: <XDG_SESSION_ID=4>
>>>> X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/1000>
>>>> X-Cron-Env: <DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus>
>>>> X-Cron-Env: <LANG=de_DE.UTF-8>
>>>> X-Cron-Env: <SHELL=/bin/sh>
>>>> X-Cron-Env: <HOME=/home/cryptearth>
>>>> X-Cron-Env: <PATH=/usr/bin:/bin>
>>>> X-Cron-Env: <LOGNAME=cryptearth>
>>>> X-Cron-Env: <USER=cryptearth>
>>>> 
>>>> test
>>>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error>
>>>> 
>>>> So, the redirect seems to work as far to change the recipient, but then it can't be sent to the local user account. I'm unsure if it's maybe some DNS/IP error as the way I re-installed the system isn't supported by OVH. So maybe I made an error somewhere. What's bothering me that the hostname sometimes keep change back to localhost although it's correctly set anywhere.
>>>> 
>>>> Maybe I get in touch with OVH support
>>>> 
>>>> Matt
>>>> 
>>>>> Am 24.05.2019 um 01:58 schrieb cryptearth:
>>>>> Hey there, Matt here again.
>>>>> 
>>>>> Long time since my last update on this topic, but now I got a pretty easy solution.
>>>>> 
>>>>> On May 22nd OpenSUSE 15.1 was released, and with this new update I again looked at my "problem" about how to deal with apache and other local mail. Instead of my initial thoughts I hadn't to implement any myself, but james also comes with anything needed. The two keywords here are the CompositeMatcher and the Redirect mailet.
>>>>> 
>>>>> To recap: basically I want to filter any local mail to a special service user except those from authed smtp and apache (wich is set to webmaster@cryptearth.de in php.ini).
>>>>> 
>>>>> CompositeMatcher offers a way to easy implement this filter rule:
>>>>> 
>>>>> <matcher name="local-service" match="org.apache.james.mailetcontainer.impl.matchers.And">
>>>>>      <matcher match="RemoteAddrInNetwork=127.0.0.0/8" />
>>>>>      <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>>>          <matcher match="SMTPAuthSuccessful" />
>>>>>      </matcher>
>>>>>      <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>>>          <matcher match="SenderIs=webmaster@cryptearth.de" />
>>>>>      </matcher>
>>>>> </matcher>
>>>>> 
>>>>> I guess this speaks for itself, at least I guess anyone subscribed to this mailing-list should understand what this basic logic does.
>>>>> One side-note: on start up the code that creates the config only looks for Matchers and Mailets in org.apache.james.transport.matchers.* - so any other classes has to be referenced by its FQN.
>>>>> 
>>>>> As I now have all those mails I want to filter into the special mailbox an easy Redirect does the trick about rewriting the recipient:
>>>>> 
>>>>> <mailet match="local-service" class="Redirect">
>>>>>      <to>local-service@cryptearth.de</to>
>>>>> </mailet>
>>>>> 
>>>>> The very convenient thing for apache is that every outgoing mail is also saved automatic in SENT as for any existing local user.
>>>>> 
>>>>> I only came up with this as I started to dig my way around the github and wasn't satisfied with this compilcated way of looking up the API. So I quickly asked google about creating a complete javadoc - mvn javadoc:aggregate-jar did it. So I got an easy browsable api-doc.
>>>>> About placement I inserted it right at top of root processor, even above the postmaster mailet. As it works it can't be that wrong, but if there is a better spot than right at top please tell me.
>>>>> 
>>>>> So, this concludes my question about how to combine james with sendmail in a way sendmail is only the dumb nullclient forwarding all local generated mail to james. As the Redirect mailet also offers other rewrites of the headers I guess it could be used to do a bit more with a bit more work on the configs.
>>>>> 
>>>>> Thanks for anyone helped about this topic - a huge help was the last reply from Benoit about using the RemoteAddrInNetwork class.
>>>>> 
>>>>> 
>>>>> So long,
>>>>> 
>>>>> Matt
>>>>> <truncated>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>> For additional commands, e-mail: server-user-help@james.apache.org
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: james and sendmail - wildcard alias for local users

Posted by cryptearth <cr...@cryptearth.de>.
Hey there,

I ran another test on another real machine instead of a VM - and 
surprisingly I encountered the same issue. So it seems somethings 
different on a real machine than on a vm causing this issue. Anyone 
knows how the "name" of a mail is composed in the first place and how it 
could be valid if cloning it exceeds some limit?

Matt

Am 27.05.2019 um 18:19 schrieb cryptearth:
> Hey Garry,
>
> please use webarchive or server-user-thread.<x> to download the whole 
> thread - I already explained the reason why I "somewhat have to" set 
> it up this way.
>
> Long story short: unix uses local mail as to report output of 
> background / service processes. It's up the process how this is done 
> wich results in an not-uniform combination of 
> <username>@<hostname>.<domain>. James tries to remote-deliver any mail 
> belong to a domain not listed in domainlist and fails to treat 
> root1.cryptearth.de - wich is the FQDN - as <hostname>.<domain> but 
> rather treats it as its own - and every mail to a user not contained 
> in userlist just gets rejected with "no user/mailbox".
> Solution: unify each mail dropped local, not smtpauth and not 
> specified manual in some sort of exclusion list.
> As it would require huge re-write to make a database solution work - 
> and I only need one mail excluded - I just "hardwired" this one and 
> rely on smtpauth otherwise for decide between local and remote-delivery.
>
> It's NOT webmaster@cryptearth.de to local-service@cryptearth.de - in 
> fact these two are excluded as used to remote-delivery - but 
> <anything>@<hostname> (vm@root1) - <anything>@<hostname>.<domain> 
> (root@root1.cryptearth.de) or any maybe not-existing 
> <anything>@<domain> (user@cryptearth.de) wich hasn't authed (wich 
> isn't possible for non exisiting users) to in fact redirect them to 
> local-service@cryptearth.de. It's this non-uniformity paired with how 
> james behave about recipients not listed in domainlist or userlist 
> require me to rewrite those "local system mail".
>
> I tested this on a VM - works like a dream - did the same to my root - 
> fails. I tried to work out where the instance of Mail gets created and 
> how the initial name is set - but wasn't able to yet. It's like 
> turning all SMTP stuff inside out to figure out how it works. As james 
> uses netty I maybe also need to dug into this framework to figure out 
> where the specific handler is called forming the Mail instance from 
> the read input after seeing <CRLF>.<CRLF>. So maybe someone can point 
> out where to start to figure out how/where the initial name is set to 
> determine why the copy fails on the root although it's pretty much the 
> same system as in my VM.
>
> Matt
>
> Am 27.05.2019 um 15:36 schrieb Garry Hurley:
>> Why are you trying to redirect the mail from ‘webmaster@mydomain.com’ 
>> to ‘a.randome.user@mydomain.com’ anyhow? Isn’tthere an alias set up? 
>> I was just configuring postfix on another machine, not my james 
>> server, and I noted a virtualiases configuration for that purpose. I 
>> am recalling an aliases file in the conf directory. Maybe I am wrong 
>> or getting my versions mixed up (if not, maybe it should be that 
>> way). I think the rewrite you are trying to do is for sending from 
>> ‘webmaster@mydomain.com’ to ‘my.other.email@otherdomain.com’ and is 
>> actually overkill for what you are doing.
>>
>> Sent from my iPhone
>>
>>> On May 26, 2019, at 3:18 PM, cryptearth <cr...@cryptearth.de> 
>>> wrote:
>>>
>>> Well, seems it doesn't work in the real world.
>>>
>>> The way I mentioned worked in a VM so far - but after I upgraded my 
>>> root-server and did the same I know get this issue:
>>>
>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,242 | 
>>> org.apache.james.protocols.netty.BasicChannelUpstreamHandler | 
>>> Connection established from 127.0.0.1
>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,300 | 
>>> org.apache.james.domainlist.lib.AbstractDomainList | Local host is: 
>>> 127.0.0.1
>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,423 | 
>>> org.apache.james.smtpserver.SendMailHandler | Successfully spooled 
>>> mail Mail1558897082344-b3644bc7-10c4-46a7-b670-75cf4dc9fd94 from 
>>> MaybeSender{mailAddress=Optional[cryptearth@root1.cryptearth.de]} on 
>>> localhost/127.0.0.1 for [cryptearth@root1.cryptearth.de]
>>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,507 | 
>>> org.apache.james.protocols.netty.BasicChannelUpstreamHandler | 
>>> Connection closed for 127.0.0.1
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | ERROR 20:58:03,024 | 
>>> org.apache.james.mailetcontainer.impl.camel.CamelProcessor | 
>>> Exception calling Redirect: Unable to create a new message name: too 
>>> long. Possible loop in config.xml.
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | 
>>> javax.mail.MessagingException: Unable to create a new message name: 
>>> too long. Possible loop in config.xml.
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.james.server.core.MailImpl.detectPossibleLoop(MailImpl.java:344)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.james.server.core.MailImpl.deriveNewName(MailImpl.java:321)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.james.server.core.MailImpl.duplicate(MailImpl.java:103)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.james.transport.mailets.redirect.ProcessRedirectNotify.process(ProcessRedirectNotify.java:49)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.james.transport.mailets.Redirect.service(Redirect.java:475)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:81)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.handleMailet(CamelMailetProcessor.java:178)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.lambda$configure$0(CamelMailetProcessor.java:155)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:715)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:638)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:248)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.Splitter.process(Splitter.java:130)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.component.direct.DirectBlockingProducer.process(DirectBlockingProducer.java:53)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:541)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:506)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369) 
>>>
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:506) 
>>>
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:168)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor.service(CamelMailetProcessor.java:68)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.service(AbstractStateCompositeProcessor.java:84)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> org.apache.james.mailetcontainer.impl.JamesMailSpooler.lambda$run$0(JamesMailSpooler.java:163)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
>>> java.lang.Thread.run(Thread.java:748)
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 |
>>> INFO   | jvm 1    | 2019/05/26 20:58:03 | INFO  20:58:03,025 | 
>>> org.apache.james.transport.mailets.ToRepository | Storing mail 
>>> fd94-!5647419-!8598886-!8671760-!8516799-!7948334-!6362370-!1064056-!8846222 
>>> in MailRepositoryUrl{value=file://var/mail/error/}
>>>
>>> This is the content of the filtered message:
>>>
>>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error> cat 
>>> 666439342D21353634373431392D21383539383838362D21383637313736302D21383531363739392D21373934383333342D21363336323337302D21313036343035362D2138383436323232.Repository.FileStreamStore
>>> To: local-service@cryptearth.de
>>> Message-ID: <20...@root1.cryptearth.de>
>>> MIME-Version: 1.0
>>> Received: from localhost (EHLO root1.cryptearth.de) ([127.0.0.1])
>>>            by localhost (JAMES SMTP Server ) with ESMTP ID -1238704049
>>>            for <cr...@root1.cryptearth.de>;
>>>            Sun, 26 May 2019 20:58:02 +0200 (CEST)
>>> Received: (from cryptearth@localhost)
>>>          by root1.cryptearth.de (8.15.2/8.15.2/Submit) id 
>>> x4QIw2wp003888;
>>>          Sun, 26 May 2019 20:58:02 +0200
>>> Date: Sun, 26 May 2019 20:58:02 +0200
>>> From: "(Cron Daemon)" <cr...@root1.cryptearth.de>
>>> Subject: Cron <cr...@root1> /home/cryptearth/bin/test.sh
>>> Content-Type: text/plain; charset=UTF-8
>>> Auto-Submitted: auto-generated
>>> Precedence: bulk
>>> X-Cron-Env: <XDG_SESSION_ID=4>
>>> X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/1000>
>>> X-Cron-Env: <DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus>
>>> X-Cron-Env: <LANG=de_DE.UTF-8>
>>> X-Cron-Env: <SHELL=/bin/sh>
>>> X-Cron-Env: <HOME=/home/cryptearth>
>>> X-Cron-Env: <PATH=/usr/bin:/bin>
>>> X-Cron-Env: <LOGNAME=cryptearth>
>>> X-Cron-Env: <USER=cryptearth>
>>>
>>> test
>>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error>
>>>
>>> So, the redirect seems to work as far to change the recipient, but 
>>> then it can't be sent to the local user account. I'm unsure if it's 
>>> maybe some DNS/IP error as the way I re-installed the system isn't 
>>> supported by OVH. So maybe I made an error somewhere. What's 
>>> bothering me that the hostname sometimes keep change back to 
>>> localhost although it's correctly set anywhere.
>>>
>>> Maybe I get in touch with OVH support
>>>
>>> Matt
>>>
>>>> Am 24.05.2019 um 01:58 schrieb cryptearth:
>>>> Hey there, Matt here again.
>>>>
>>>> Long time since my last update on this topic, but now I got a 
>>>> pretty easy solution.
>>>>
>>>> On May 22nd OpenSUSE 15.1 was released, and with this new update I 
>>>> again looked at my "problem" about how to deal with apache and 
>>>> other local mail. Instead of my initial thoughts I hadn't to 
>>>> implement any myself, but james also comes with anything needed. 
>>>> The two keywords here are the CompositeMatcher and the Redirect 
>>>> mailet.
>>>>
>>>> To recap: basically I want to filter any local mail to a special 
>>>> service user except those from authed smtp and apache (wich is set 
>>>> to webmaster@cryptearth.de in php.ini).
>>>>
>>>> CompositeMatcher offers a way to easy implement this filter rule:
>>>>
>>>> <matcher name="local-service" 
>>>> match="org.apache.james.mailetcontainer.impl.matchers.And">
>>>>      <matcher match="RemoteAddrInNetwork=127.0.0.0/8" />
>>>>      <matcher 
>>>> match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>>          <matcher match="SMTPAuthSuccessful" />
>>>>      </matcher>
>>>>      <matcher 
>>>> match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>>          <matcher match="SenderIs=webmaster@cryptearth.de" />
>>>>      </matcher>
>>>> </matcher>
>>>>
>>>> I guess this speaks for itself, at least I guess anyone subscribed 
>>>> to this mailing-list should understand what this basic logic does.
>>>> One side-note: on start up the code that creates the config only 
>>>> looks for Matchers and Mailets in 
>>>> org.apache.james.transport.matchers.* - so any other classes has to 
>>>> be referenced by its FQN.
>>>>
>>>> As I now have all those mails I want to filter into the special 
>>>> mailbox an easy Redirect does the trick about rewriting the recipient:
>>>>
>>>> <mailet match="local-service" class="Redirect">
>>>>      <to>local-service@cryptearth.de</to>
>>>> </mailet>
>>>>
>>>> The very convenient thing for apache is that every outgoing mail is 
>>>> also saved automatic in SENT as for any existing local user.
>>>>
>>>> I only came up with this as I started to dig my way around the 
>>>> github and wasn't satisfied with this compilcated way of looking up 
>>>> the API. So I quickly asked google about creating a complete 
>>>> javadoc - mvn javadoc:aggregate-jar did it. So I got an easy 
>>>> browsable api-doc.
>>>> About placement I inserted it right at top of root processor, even 
>>>> above the postmaster mailet. As it works it can't be that wrong, 
>>>> but if there is a better spot than right at top please tell me.
>>>>
>>>> So, this concludes my question about how to combine james with 
>>>> sendmail in a way sendmail is only the dumb nullclient forwarding 
>>>> all local generated mail to james. As the Redirect mailet also 
>>>> offers other rewrites of the headers I guess it could be used to do 
>>>> a bit more with a bit more work on the configs.
>>>>
>>>> Thanks for anyone helped about this topic - a huge help was the 
>>>> last reply from Benoit about using the RemoteAddrInNetwork class.
>>>>
>>>>
>>>> So long,
>>>>
>>>> Matt
>>>> <truncated>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: james and sendmail - wildcard alias for local users

Posted by cryptearth <cr...@cryptearth.de>.
Hey Garry,

please use webarchive or server-user-thread.<x> to download the whole 
thread - I already explained the reason why I "somewhat have to" set it 
up this way.

Long story short: unix uses local mail as to report output of background 
/ service processes. It's up the process how this is done wich results 
in an not-uniform combination of <username>@<hostname>.<domain>. James 
tries to remote-deliver any mail belong to a domain not listed in 
domainlist and fails to treat root1.cryptearth.de - wich is the FQDN - 
as <hostname>.<domain> but rather treats it as its own - and every mail 
to a user not contained in userlist just gets rejected with "no 
user/mailbox".
Solution: unify each mail dropped local, not smtpauth and not specified 
manual in some sort of exclusion list.
As it would require huge re-write to make a database solution work - and 
I only need one mail excluded - I just "hardwired" this one and rely on 
smtpauth otherwise for decide between local and remote-delivery.

It's NOT webmaster@cryptearth.de to local-service@cryptearth.de - in 
fact these two are excluded as used to remote-delivery - but 
<anything>@<hostname> (vm@root1) - <anything>@<hostname>.<domain> 
(root@root1.cryptearth.de) or any maybe not-existing <anything>@<domain> 
(user@cryptearth.de) wich hasn't authed (wich isn't possible for non 
exisiting users) to in fact redirect them to 
local-service@cryptearth.de. It's this non-uniformity paired with how 
james behave about recipients not listed in domainlist or userlist 
require me to rewrite those "local system mail".

I tested this on a VM - works like a dream - did the same to my root - 
fails. I tried to work out where the instance of Mail gets created and 
how the initial name is set - but wasn't able to yet. It's like turning 
all SMTP stuff inside out to figure out how it works. As james uses 
netty I maybe also need to dug into this framework to figure out where 
the specific handler is called forming the Mail instance from the read 
input after seeing <CRLF>.<CRLF>. So maybe someone can point out where 
to start to figure out how/where the initial name is set to determine 
why the copy fails on the root although it's pretty much the same system 
as in my VM.

Matt

Am 27.05.2019 um 15:36 schrieb Garry Hurley:
> Why are you trying to redirect the mail from ‘webmaster@mydomain.com’ to ‘a.randome.user@mydomain.com’ anyhow? Isn’tthere an alias set up? I was just configuring postfix on another machine, not my james server, and I noted a virtualiases configuration for that purpose. I am recalling an aliases file in the conf directory. Maybe I am wrong or getting my versions mixed up (if not, maybe it should be that way). I think the rewrite you are trying to do is for sending from ‘webmaster@mydomain.com’ to ‘my.other.email@otherdomain.com’ and is actually overkill for what you are doing.
>
> Sent from my iPhone
>
>> On May 26, 2019, at 3:18 PM, cryptearth <cr...@cryptearth.de> wrote:
>>
>> Well, seems it doesn't work in the real world.
>>
>> The way I mentioned worked in a VM so far - but after I upgraded my root-server and did the same I know get this issue:
>>
>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,242 | org.apache.james.protocols.netty.BasicChannelUpstreamHandler | Connection established from 127.0.0.1
>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,300 | org.apache.james.domainlist.lib.AbstractDomainList | Local host is: 127.0.0.1
>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,423 | org.apache.james.smtpserver.SendMailHandler | Successfully spooled mail Mail1558897082344-b3644bc7-10c4-46a7-b670-75cf4dc9fd94 from MaybeSender{mailAddress=Optional[cryptearth@root1.cryptearth.de]} on localhost/127.0.0.1 for [cryptearth@root1.cryptearth.de]
>> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,507 | org.apache.james.protocols.netty.BasicChannelUpstreamHandler | Connection closed for 127.0.0.1
>> INFO   | jvm 1    | 2019/05/26 20:58:03 | ERROR 20:58:03,024 | org.apache.james.mailetcontainer.impl.camel.CamelProcessor | Exception calling Redirect: Unable to create a new message name: too long. Possible loop in config.xml.
>> INFO   | jvm 1    | 2019/05/26 20:58:03 | javax.mail.MessagingException: Unable to create a new message name: too long. Possible loop in config.xml.
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.detectPossibleLoop(MailImpl.java:344)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.deriveNewName(MailImpl.java:321)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.duplicate(MailImpl.java:103)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.transport.mailets.redirect.ProcessRedirectNotify.process(ProcessRedirectNotify.java:49)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.transport.mailets.Redirect.service(Redirect.java:475)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:81)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.handleMailet(CamelMailetProcessor.java:178)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.lambda$configure$0(CamelMailetProcessor.java:155)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:715)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:638)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:248)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Splitter.process(Splitter.java:130)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.component.direct.DirectBlockingProducer.process(DirectBlockingProducer.java:53)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:541)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:506)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:506)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:168)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor.service(CamelMailetProcessor.java:68)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.service(AbstractStateCompositeProcessor.java:84)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.JamesMailSpooler.lambda$run$0(JamesMailSpooler.java:163)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.lang.Thread.run(Thread.java:748)
>> INFO   | jvm 1    | 2019/05/26 20:58:03 |
>> INFO   | jvm 1    | 2019/05/26 20:58:03 | INFO  20:58:03,025 | org.apache.james.transport.mailets.ToRepository | Storing mail fd94-!5647419-!8598886-!8671760-!8516799-!7948334-!6362370-!1064056-!8846222 in MailRepositoryUrl{value=file://var/mail/error/}
>>
>> This is the content of the filtered message:
>>
>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error> cat 666439342D21353634373431392D21383539383838362D21383637313736302D21383531363739392D21373934383333342D21363336323337302D21313036343035362D2138383436323232.Repository.FileStreamStore
>> To: local-service@cryptearth.de
>> Message-ID: <20...@root1.cryptearth.de>
>> MIME-Version: 1.0
>> Received: from localhost (EHLO root1.cryptearth.de) ([127.0.0.1])
>>            by localhost (JAMES SMTP Server ) with ESMTP ID -1238704049
>>            for <cr...@root1.cryptearth.de>;
>>            Sun, 26 May 2019 20:58:02 +0200 (CEST)
>> Received: (from cryptearth@localhost)
>>          by root1.cryptearth.de (8.15.2/8.15.2/Submit) id x4QIw2wp003888;
>>          Sun, 26 May 2019 20:58:02 +0200
>> Date: Sun, 26 May 2019 20:58:02 +0200
>> From: "(Cron Daemon)" <cr...@root1.cryptearth.de>
>> Subject: Cron <cr...@root1> /home/cryptearth/bin/test.sh
>> Content-Type: text/plain; charset=UTF-8
>> Auto-Submitted: auto-generated
>> Precedence: bulk
>> X-Cron-Env: <XDG_SESSION_ID=4>
>> X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/1000>
>> X-Cron-Env: <DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus>
>> X-Cron-Env: <LANG=de_DE.UTF-8>
>> X-Cron-Env: <SHELL=/bin/sh>
>> X-Cron-Env: <HOME=/home/cryptearth>
>> X-Cron-Env: <PATH=/usr/bin:/bin>
>> X-Cron-Env: <LOGNAME=cryptearth>
>> X-Cron-Env: <USER=cryptearth>
>>
>> test
>> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error>
>>
>> So, the redirect seems to work as far to change the recipient, but then it can't be sent to the local user account. I'm unsure if it's maybe some DNS/IP error as the way I re-installed the system isn't supported by OVH. So maybe I made an error somewhere. What's bothering me that the hostname sometimes keep change back to localhost although it's correctly set anywhere.
>>
>> Maybe I get in touch with OVH support
>>
>> Matt
>>
>>> Am 24.05.2019 um 01:58 schrieb cryptearth:
>>> Hey there, Matt here again.
>>>
>>> Long time since my last update on this topic, but now I got a pretty easy solution.
>>>
>>> On May 22nd OpenSUSE 15.1 was released, and with this new update I again looked at my "problem" about how to deal with apache and other local mail. Instead of my initial thoughts I hadn't to implement any myself, but james also comes with anything needed. The two keywords here are the CompositeMatcher and the Redirect mailet.
>>>
>>> To recap: basically I want to filter any local mail to a special service user except those from authed smtp and apache (wich is set to webmaster@cryptearth.de in php.ini).
>>>
>>> CompositeMatcher offers a way to easy implement this filter rule:
>>>
>>> <matcher name="local-service" match="org.apache.james.mailetcontainer.impl.matchers.And">
>>>      <matcher match="RemoteAddrInNetwork=127.0.0.0/8" />
>>>      <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>          <matcher match="SMTPAuthSuccessful" />
>>>      </matcher>
>>>      <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>>          <matcher match="SenderIs=webmaster@cryptearth.de" />
>>>      </matcher>
>>> </matcher>
>>>
>>> I guess this speaks for itself, at least I guess anyone subscribed to this mailing-list should understand what this basic logic does.
>>> One side-note: on start up the code that creates the config only looks for Matchers and Mailets in org.apache.james.transport.matchers.* - so any other classes has to be referenced by its FQN.
>>>
>>> As I now have all those mails I want to filter into the special mailbox an easy Redirect does the trick about rewriting the recipient:
>>>
>>> <mailet match="local-service" class="Redirect">
>>>      <to>local-service@cryptearth.de</to>
>>> </mailet>
>>>
>>> The very convenient thing for apache is that every outgoing mail is also saved automatic in SENT as for any existing local user.
>>>
>>> I only came up with this as I started to dig my way around the github and wasn't satisfied with this compilcated way of looking up the API. So I quickly asked google about creating a complete javadoc - mvn javadoc:aggregate-jar did it. So I got an easy browsable api-doc.
>>> About placement I inserted it right at top of root processor, even above the postmaster mailet. As it works it can't be that wrong, but if there is a better spot than right at top please tell me.
>>>
>>> So, this concludes my question about how to combine james with sendmail in a way sendmail is only the dumb nullclient forwarding all local generated mail to james. As the Redirect mailet also offers other rewrites of the headers I guess it could be used to do a bit more with a bit more work on the configs.
>>>
>>> Thanks for anyone helped about this topic - a huge help was the last reply from Benoit about using the RemoteAddrInNetwork class.
>>>
>>>
>>> So long,
>>>
>>> Matt
>>> <truncated>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: james and sendmail - wildcard alias for local users

Posted by Garry Hurley <ga...@gmail.com>.
Why are you trying to redirect the mail from ‘webmaster@mydomain.com’ to ‘a.randome.user@mydomain.com’ anyhow? Isn’tthere an alias set up? I was just configuring postfix on another machine, not my james server, and I noted a virtualiases configuration for that purpose. I am recalling an aliases file in the conf directory. Maybe I am wrong or getting my versions mixed up (if not, maybe it should be that way). I think the rewrite you are trying to do is for sending from ‘webmaster@mydomain.com’ to ‘my.other.email@otherdomain.com’ and is actually overkill for what you are doing. 

Sent from my iPhone

> On May 26, 2019, at 3:18 PM, cryptearth <cr...@cryptearth.de> wrote:
> 
> Well, seems it doesn't work in the real world.
> 
> The way I mentioned worked in a VM so far - but after I upgraded my root-server and did the same I know get this issue:
> 
> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,242 | org.apache.james.protocols.netty.BasicChannelUpstreamHandler | Connection established from 127.0.0.1
> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,300 | org.apache.james.domainlist.lib.AbstractDomainList | Local host is: 127.0.0.1
> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,423 | org.apache.james.smtpserver.SendMailHandler | Successfully spooled mail Mail1558897082344-b3644bc7-10c4-46a7-b670-75cf4dc9fd94 from MaybeSender{mailAddress=Optional[cryptearth@root1.cryptearth.de]} on localhost/127.0.0.1 for [cryptearth@root1.cryptearth.de]
> INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,507 | org.apache.james.protocols.netty.BasicChannelUpstreamHandler | Connection closed for 127.0.0.1
> INFO   | jvm 1    | 2019/05/26 20:58:03 | ERROR 20:58:03,024 | org.apache.james.mailetcontainer.impl.camel.CamelProcessor | Exception calling Redirect: Unable to create a new message name: too long. Possible loop in config.xml.
> INFO   | jvm 1    | 2019/05/26 20:58:03 | javax.mail.MessagingException: Unable to create a new message name: too long. Possible loop in config.xml.
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.detectPossibleLoop(MailImpl.java:344)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.deriveNewName(MailImpl.java:321)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.server.core.MailImpl.duplicate(MailImpl.java:103)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.transport.mailets.redirect.ProcessRedirectNotify.process(ProcessRedirectNotify.java:49)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.transport.mailets.Redirect.service(Redirect.java:475)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:81)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.handleMailet(CamelMailetProcessor.java:178)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.lambda$configure$0(CamelMailetProcessor.java:155)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:715)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:638)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:248)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Splitter.process(Splitter.java:130)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.component.direct.DirectBlockingProducer.process(DirectBlockingProducer.java:53)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:541)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:506)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:506)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:168)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor.service(CamelMailetProcessor.java:68)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.service(AbstractStateCompositeProcessor.java:84)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at org.apache.james.mailetcontainer.impl.JamesMailSpooler.lambda$run$0(JamesMailSpooler.java:163)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |       at java.lang.Thread.run(Thread.java:748)
> INFO   | jvm 1    | 2019/05/26 20:58:03 |
> INFO   | jvm 1    | 2019/05/26 20:58:03 | INFO  20:58:03,025 | org.apache.james.transport.mailets.ToRepository | Storing mail fd94-!5647419-!8598886-!8671760-!8516799-!7948334-!6362370-!1064056-!8846222 in MailRepositoryUrl{value=file://var/mail/error/}
> 
> This is the content of the filtered message:
> 
> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error> cat 666439342D21353634373431392D21383539383838362D21383637313736302D21383531363739392D21373934383333342D21363336323337302D21313036343035362D2138383436323232.Repository.FileStreamStore
> To: local-service@cryptearth.de
> Message-ID: <20...@root1.cryptearth.de>
> MIME-Version: 1.0
> Received: from localhost (EHLO root1.cryptearth.de) ([127.0.0.1])
>           by localhost (JAMES SMTP Server ) with ESMTP ID -1238704049
>           for <cr...@root1.cryptearth.de>;
>           Sun, 26 May 2019 20:58:02 +0200 (CEST)
> Received: (from cryptearth@localhost)
>         by root1.cryptearth.de (8.15.2/8.15.2/Submit) id x4QIw2wp003888;
>         Sun, 26 May 2019 20:58:02 +0200
> Date: Sun, 26 May 2019 20:58:02 +0200
> From: "(Cron Daemon)" <cr...@root1.cryptearth.de>
> Subject: Cron <cr...@root1> /home/cryptearth/bin/test.sh
> Content-Type: text/plain; charset=UTF-8
> Auto-Submitted: auto-generated
> Precedence: bulk
> X-Cron-Env: <XDG_SESSION_ID=4>
> X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/1000>
> X-Cron-Env: <DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus>
> X-Cron-Env: <LANG=de_DE.UTF-8>
> X-Cron-Env: <SHELL=/bin/sh>
> X-Cron-Env: <HOME=/home/cryptearth>
> X-Cron-Env: <PATH=/usr/bin:/bin>
> X-Cron-Env: <LOGNAME=cryptearth>
> X-Cron-Env: <USER=cryptearth>
> 
> test
> cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error>
> 
> So, the redirect seems to work as far to change the recipient, but then it can't be sent to the local user account. I'm unsure if it's maybe some DNS/IP error as the way I re-installed the system isn't supported by OVH. So maybe I made an error somewhere. What's bothering me that the hostname sometimes keep change back to localhost although it's correctly set anywhere.
> 
> Maybe I get in touch with OVH support
> 
> Matt
> 
>> Am 24.05.2019 um 01:58 schrieb cryptearth:
>> Hey there, Matt here again.
>> 
>> Long time since my last update on this topic, but now I got a pretty easy solution.
>> 
>> On May 22nd OpenSUSE 15.1 was released, and with this new update I again looked at my "problem" about how to deal with apache and other local mail. Instead of my initial thoughts I hadn't to implement any myself, but james also comes with anything needed. The two keywords here are the CompositeMatcher and the Redirect mailet.
>> 
>> To recap: basically I want to filter any local mail to a special service user except those from authed smtp and apache (wich is set to webmaster@cryptearth.de in php.ini).
>> 
>> CompositeMatcher offers a way to easy implement this filter rule:
>> 
>> <matcher name="local-service" match="org.apache.james.mailetcontainer.impl.matchers.And">
>>     <matcher match="RemoteAddrInNetwork=127.0.0.0/8" />
>>     <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>         <matcher match="SMTPAuthSuccessful" />
>>     </matcher>
>>     <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
>>         <matcher match="SenderIs=webmaster@cryptearth.de" />
>>     </matcher>
>> </matcher>
>> 
>> I guess this speaks for itself, at least I guess anyone subscribed to this mailing-list should understand what this basic logic does.
>> One side-note: on start up the code that creates the config only looks for Matchers and Mailets in org.apache.james.transport.matchers.* - so any other classes has to be referenced by its FQN.
>> 
>> As I now have all those mails I want to filter into the special mailbox an easy Redirect does the trick about rewriting the recipient:
>> 
>> <mailet match="local-service" class="Redirect">
>>     <to>local-service@cryptearth.de</to>
>> </mailet>
>> 
>> The very convenient thing for apache is that every outgoing mail is also saved automatic in SENT as for any existing local user.
>> 
>> I only came up with this as I started to dig my way around the github and wasn't satisfied with this compilcated way of looking up the API. So I quickly asked google about creating a complete javadoc - mvn javadoc:aggregate-jar did it. So I got an easy browsable api-doc.
>> About placement I inserted it right at top of root processor, even above the postmaster mailet. As it works it can't be that wrong, but if there is a better spot than right at top please tell me.
>> 
>> So, this concludes my question about how to combine james with sendmail in a way sendmail is only the dumb nullclient forwarding all local generated mail to james. As the Redirect mailet also offers other rewrites of the headers I guess it could be used to do a bit more with a bit more work on the configs.
>> 
>> Thanks for anyone helped about this topic - a huge help was the last reply from Benoit about using the RemoteAddrInNetwork class.
>> 
>> 
>> So long,
>> 
>> Matt
>> <truncated>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: Re: james and sendmail - wildcard alias for local users

Posted by cryptearth <cr...@cryptearth.de>.
Well, seems it doesn't work in the real world.

The way I mentioned worked in a VM so far - but after I upgraded my 
root-server and did the same I know get this issue:

INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,242 | 
org.apache.james.protocols.netty.BasicChannelUpstreamHandler | 
Connection established from 127.0.0.1
INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,300 | 
org.apache.james.domainlist.lib.AbstractDomainList | Local host is: 
127.0.0.1
INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,423 | 
org.apache.james.smtpserver.SendMailHandler | Successfully spooled mail 
Mail1558897082344-b3644bc7-10c4-46a7-b670-75cf4dc9fd94 from 
MaybeSender{mailAddress=Optional[cryptearth@root1.cryptearth.de]} on 
localhost/127.0.0.1 for [cryptearth@root1.cryptearth.de]
INFO   | jvm 1    | 2019/05/26 20:58:02 | INFO  20:58:02,507 | 
org.apache.james.protocols.netty.BasicChannelUpstreamHandler | 
Connection closed for 127.0.0.1
INFO   | jvm 1    | 2019/05/26 20:58:03 | ERROR 20:58:03,024 | 
org.apache.james.mailetcontainer.impl.camel.CamelProcessor | Exception 
calling Redirect: Unable to create a new message name: too long. 
Possible loop in config.xml.
INFO   | jvm 1    | 2019/05/26 20:58:03 | javax.mail.MessagingException: 
Unable to create a new message name: too long. Possible loop in config.xml.
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.james.server.core.MailImpl.detectPossibleLoop(MailImpl.java:344)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.james.server.core.MailImpl.deriveNewName(MailImpl.java:321)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.james.server.core.MailImpl.duplicate(MailImpl.java:103)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.james.transport.mailets.redirect.ProcessRedirectNotify.process(ProcessRedirectNotify.java:49)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.james.transport.mailets.Redirect.service(Redirect.java:475)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.james.mailetcontainer.impl.camel.CamelProcessor.process(CamelProcessor.java:81)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.handleMailet(CamelMailetProcessor.java:178)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor$MailetContainerRouteBuilder.lambda$configure$0(CamelMailetProcessor.java:155)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:715)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.MulticastProcessor.doProcessSequential(MulticastProcessor.java:638)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.MulticastProcessor.process(MulticastProcessor.java:248)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.Splitter.process(Splitter.java:130)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.Pipeline.process(Pipeline.java:138)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.Pipeline.process(Pipeline.java:101)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.component.direct.DirectBlockingProducer.process(DirectBlockingProducer.java:53)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:186)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.processor.SharedCamelInternalProcessor.process(SharedCamelInternalProcessor.java:86)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:541)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.impl.ProducerCache$1.doInProducer(ProducerCache.java:506)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:369)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:506)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.impl.ProducerCache.send(ProducerCache.java:229)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:144)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:161)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:168)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.james.mailetcontainer.impl.camel.CamelMailetProcessor.service(CamelMailetProcessor.java:68)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.james.mailetcontainer.lib.AbstractStateCompositeProcessor.service(AbstractStateCompositeProcessor.java:84)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
org.apache.james.mailetcontainer.impl.JamesMailSpooler.lambda$run$0(JamesMailSpooler.java:163)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
INFO   | jvm 1    | 2019/05/26 20:58:03 |       at 
java.lang.Thread.run(Thread.java:748)
INFO   | jvm 1    | 2019/05/26 20:58:03 |
INFO   | jvm 1    | 2019/05/26 20:58:03 | INFO  20:58:03,025 | 
org.apache.james.transport.mailets.ToRepository | Storing mail 
fd94-!5647419-!8598886-!8671760-!8516799-!7948334-!6362370-!1064056-!8846222 
in MailRepositoryUrl{value=file://var/mail/error/}

This is the content of the filtered message:

cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error> cat 
666439342D21353634373431392D21383539383838362D21383637313736302D21383531363739392D21373934383333342D21363336323337302D21313036343035362D2138383436323232.Repository.FileStreamStore
To: local-service@cryptearth.de
Message-ID: <20...@root1.cryptearth.de>
MIME-Version: 1.0
Received: from localhost (EHLO root1.cryptearth.de) ([127.0.0.1])
           by localhost (JAMES SMTP Server ) with ESMTP ID -1238704049
           for <cr...@root1.cryptearth.de>;
           Sun, 26 May 2019 20:58:02 +0200 (CEST)
Received: (from cryptearth@localhost)
         by root1.cryptearth.de (8.15.2/8.15.2/Submit) id x4QIw2wp003888;
         Sun, 26 May 2019 20:58:02 +0200
Date: Sun, 26 May 2019 20:58:02 +0200
From: "(Cron Daemon)" <cr...@root1.cryptearth.de>
Subject: Cron <cr...@root1> /home/cryptearth/bin/test.sh
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
Precedence: bulk
X-Cron-Env: <XDG_SESSION_ID=4>
X-Cron-Env: <XDG_RUNTIME_DIR=/run/user/1000>
X-Cron-Env: <DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus>
X-Cron-Env: <LANG=de_DE.UTF-8>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/home/cryptearth>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=cryptearth>
X-Cron-Env: <USER=cryptearth>

test
cryptearth@localhost:~/james-server-app-3.3.0/var/mail/error>

So, the redirect seems to work as far to change the recipient, but then 
it can't be sent to the local user account. I'm unsure if it's maybe 
some DNS/IP error as the way I re-installed the system isn't supported 
by OVH. So maybe I made an error somewhere. What's bothering me that the 
hostname sometimes keep change back to localhost although it's correctly 
set anywhere.

Maybe I get in touch with OVH support

Matt

Am 24.05.2019 um 01:58 schrieb cryptearth:
> Hey there, Matt here again.
>
> Long time since my last update on this topic, but now I got a pretty 
> easy solution.
>
> On May 22nd OpenSUSE 15.1 was released, and with this new update I 
> again looked at my "problem" about how to deal with apache and other 
> local mail. Instead of my initial thoughts I hadn't to implement any 
> myself, but james also comes with anything needed. The two keywords 
> here are the CompositeMatcher and the Redirect mailet.
>
> To recap: basically I want to filter any local mail to a special 
> service user except those from authed smtp and apache (wich is set to 
> webmaster@cryptearth.de in php.ini).
>
> CompositeMatcher offers a way to easy implement this filter rule:
>
> <matcher name="local-service" 
> match="org.apache.james.mailetcontainer.impl.matchers.And">
>     <matcher match="RemoteAddrInNetwork=127.0.0.0/8" />
>     <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
>         <matcher match="SMTPAuthSuccessful" />
>     </matcher>
>     <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
>         <matcher match="SenderIs=webmaster@cryptearth.de" />
>     </matcher>
> </matcher>
>
> I guess this speaks for itself, at least I guess anyone subscribed to 
> this mailing-list should understand what this basic logic does.
> One side-note: on start up the code that creates the config only looks 
> for Matchers and Mailets in org.apache.james.transport.matchers.* - so 
> any other classes has to be referenced by its FQN.
>
> As I now have all those mails I want to filter into the special 
> mailbox an easy Redirect does the trick about rewriting the recipient:
>
> <mailet match="local-service" class="Redirect">
>     <to>local-service@cryptearth.de</to>
> </mailet>
>
> The very convenient thing for apache is that every outgoing mail is 
> also saved automatic in SENT as for any existing local user.
>
> I only came up with this as I started to dig my way around the github 
> and wasn't satisfied with this compilcated way of looking up the API. 
> So I quickly asked google about creating a complete javadoc - mvn 
> javadoc:aggregate-jar did it. So I got an easy browsable api-doc.
> About placement I inserted it right at top of root processor, even 
> above the postmaster mailet. As it works it can't be that wrong, but 
> if there is a better spot than right at top please tell me.
>
> So, this concludes my question about how to combine james with 
> sendmail in a way sendmail is only the dumb nullclient forwarding all 
> local generated mail to james. As the Redirect mailet also offers 
> other rewrites of the headers I guess it could be used to do a bit 
> more with a bit more work on the configs.
>
> Thanks for anyone helped about this topic - a huge help was the last 
> reply from Benoit about using the RemoteAddrInNetwork class.
>
>
> So long,
>
> Matt
> <truncated>

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: james and sendmail - wildcard alias for local users

Posted by cryptearth <cr...@cryptearth.de>.
Hey there, Matt here again.

Long time since my last update on this topic, but now I got a pretty 
easy solution.

On May 22nd OpenSUSE 15.1 was released, and with this new update I again 
looked at my "problem" about how to deal with apache and other local 
mail. Instead of my initial thoughts I hadn't to implement any myself, 
but james also comes with anything needed. The two keywords here are the 
CompositeMatcher and the Redirect mailet.

To recap: basically I want to filter any local mail to a special service 
user except those from authed smtp and apache (wich is set to 
webmaster@cryptearth.de in php.ini).

CompositeMatcher offers a way to easy implement this filter rule:

<matcher name="local-service" 
match="org.apache.james.mailetcontainer.impl.matchers.And">
     <matcher match="RemoteAddrInNetwork=127.0.0.0/8" />
     <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
         <matcher match="SMTPAuthSuccessful" />
     </matcher>
     <matcher match="org.apache.james.mailetcontainer.impl.matchers.Not">
         <matcher match="SenderIs=webmaster@cryptearth.de" />
     </matcher>
</matcher>

I guess this speaks for itself, at least I guess anyone subscribed to 
this mailing-list should understand what this basic logic does.
One side-note: on start up the code that creates the config only looks 
for Matchers and Mailets in org.apache.james.transport.matchers.* - so 
any other classes has to be referenced by its FQN.

As I now have all those mails I want to filter into the special mailbox 
an easy Redirect does the trick about rewriting the recipient:

<mailet match="local-service" class="Redirect">
     <to>local-service@cryptearth.de</to>
</mailet>

The very convenient thing for apache is that every outgoing mail is also 
saved automatic in SENT as for any existing local user.

I only came up with this as I started to dig my way around the github 
and wasn't satisfied with this compilcated way of looking up the API. So 
I quickly asked google about creating a complete javadoc - mvn 
javadoc:aggregate-jar did it. So I got an easy browsable api-doc.
About placement I inserted it right at top of root processor, even above 
the postmaster mailet. As it works it can't be that wrong, but if there 
is a better spot than right at top please tell me.

So, this concludes my question about how to combine james with sendmail 
in a way sendmail is only the dumb nullclient forwarding all local 
generated mail to james. As the Redirect mailet also offers other 
rewrites of the headers I guess it could be used to do a bit more with a 
bit more work on the configs.

Thanks for anyone helped about this topic - a huge help was the last 
reply from Benoit about using the RemoteAddrInNetwork class.


So long,

Matt

Am 13.02.2019 um 11:38 schrieb cryptearth:
> Hey there,
>
> I don't know if my last reply was sent, but I couldn't find it by checking web-archive. So apologies if this is a double-post.
>
> About the matchers mentioned by Benoit:
>
> I already begun to implement a RemoteAddrMatcher myself as I couldn't find any while digging through the source, but I guess RemoteAddrInNetwork will do the trick, allthough it's wired style of checking with some DNS-stuff involved confuses me. Seems it comes down how the network is defined - I'll check the documentation.
>
> About the SenderIs and SenderHostIs matchers: I already tried them, but strangely, in the 3.2.0 branch the only consider something as local when it's in the domain-list - wich I also tried but results in fastfail if I don't add the user - wich I want to avoid by overwriting the recipient so the RecipientIsLocal matches for LocalDelivery.
>
> As I dug through the source I also found those logical-combine matchers, wich can group multiple matchers with the basic logic AND, OR and NOT. So I came up with the idea of checking RemoteAddr and combine with not sender is what I set for apache. Reason: I want to use webmaster as the user part. So I made sure there is no local user matching this, this way I know if anything come from local but is not webmaster has to be some local service wich I want to rewrite the recipient for local catch.
>
> Sadly, due to long shifts at work I hadn't time to test this yet.
>
> I'll report back after I got some time to implement a SetRecipient mailet and check if existing RemoteAddrInNetwork helps or if I also have to implement my own.
>
> So long,
>
> Matt
>
> ---- Benoit Tellier schrieb ----
>
>> Hi,
>>
>> Have a look to:
>> - SenderIsLocal (based on the mail address of the sender)
>> - SenderHostIs + SenderHostIsLocal (based on the domain of the sender)
>> - You can already do some matching on the IP of the sender using
>> RemoteAddrInNetwork. Assuming you have well defined IPs, that you can
>> configure in XML, this would do 100% the job you tried to hack.
>>
>> Best regards,
>>
>> Benoit TELLIER
>>
>> On 2/4/19 1:55 AM, cryptearth wrote:
>>> So I dug through some code and found some points where I might could get
>>> started:
>>>
>>> The interface org.apache.mailet.Mail offeres the methods one might could
>>> write a matcher and a mailet on:
>>>
>>> String org.apache.mailet.Mail.getRemoteHost()
>>> String org.apache.mailet.Mail.getRemoteAddr()
>>> void org.apache.mailet.Mail.setRecipients(Collection<MailAdress>)
>>>
>>> As one can see, the two getRemoteXXX() methods return a String. This can
>>> lead to java.net.InetAddress.getByName(String) and provided methods
>>> InetAddress.isAnyLocalAddress(), InetAddress.isLinkLocalAddress() and
>>> InetAddress.isLoopbackAddress(). Also one can compare
>>> InetAddress.getLocalHost().getHostName() or .getHostAddress().
>>>
>>> As for the rewrite, the already mentioned SetRecipient mailet suggeted
>>> by Benoit could already do the trick, at least for my personal question.
>>>
>>> What I still not undestand: How to configure a Matcher or a Mailet by
>>> XML syntax?
>>>
>>> As Benoit mention:
>>>
>>> <mailet ...>
>>>      <recipient>...</recipient>
>>> </mailet>
>>>
>>> So, how I would get the value of the recipient-tag into my Matcher or
>>> Mailet? Reason: For modeling a Matcher and Mailet, I would like to not
>>> only write some lines for my specific case, but would like to make it
>>> configureable by what one could write in the XML. For example: specify
>>> for what the matcher should match, like sepcific sender, remote-host,
>>> maybe specific recipients - or what the Mailet should does: like remove
>>> any recipients and replace it only by one entry, or maybe based on the
>>> source set some specific recipients. I guess this should be possible as
>>> one could configure more or less complex rules via XML - wich then just
>>> had to be parsed into corresponding ruleset handling the Mail and decide
>>> if and how to modify it.
>>>
>>> Thanks so far,
>>>
>>> Matt
>>>
>>> Am 31.01.2019 um 10:32 schrieb cryptearth:
>>>> Hello Benoit,
>>>>
>>>> thanks for your enormous effort you take into trying to help us with
>>>> such questions.
>>>>
>>>> About the JIRA you filed, I guess that's what I looking for, as I
>>>> thought such SetRecipient(s) would already exist.
>>>>
>>>> I came also up with a bit simpler description about my problem: I know
>>>> the origin: localhost, I don't know the sender nor target, but I do
>>>> know, that if it comes from a specific sender (the one I set in apache
>>>> php.ini), it's recipient is extern and should processed normal
>>>> RemoteDelivery, as there is no localuser matching this specific sender.
>>>>
>>>> Example: in apache php.ini the sender is set to
>>>> webmaster@cryptearth.de - there is no localuser matching this, and the
>>>> recipient is external. This get's processed as usual and a copy of the
>>>> send mail is out into SENT folder - as I want it to. When sendmail
>>>> gets mails from other services, namely cron, it drops in, for example,
>>>> as glados@glados.cryptearth.de. Even glados.cryptearth.de is a FQHN,
>>>> it could also seen as sub-domain, but james thinks this is an external
>>>> target as galdos.cryptearth.de isn't added in the domainlist. Other
>>>> services instead drop like wwwrun@localhost (that's the default wehn
>>>> no -f paramter is set in apache php.ini). So, as there is no matching
>>>> domain either, it gets rejected right away.
>>>>
>>>> Also, it seems there is missing an "inverted" matcher wich could be
>>>> used for something like: "if <from> is not <xyz>" - I could only find
>>>> matchers for "if <from> is <xyz>". I couldn't find an example for
>>>> combine matchers neither: "if network is localhost AND if from is not
>>>> webmaster@cryptearth.de" > rewrite recipient to
>>>> local-services@cryptearth.de
>>>>
>>>> Thanks so far,
>>>>
>>>> Matt
>>>>
>>>> Am 31.01.2019 um 08:29 schrieb Benoit Tellier:
>>>>> Don't worry, I already feel overwhelmed with a single application and
>>>>> several collegues contributing on it with me!
>>>>>
>>>>> Concerning the JPAMailRepository, thank you very much for your proposal!
>>>>>
>>>>> I do believe it is really nice as it allows JPA users to no more rely on
>>>>> file-system based storage API at all.
>>>>>
>>>>> Here is the JIRA, https://issues.apache.org/jira/browse/JAMES-2656 I
>>>>> would be more than happy to help you implementing this!
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Benoit
>>>>>
>>>>> On 1/31/19 1:24 PM, Garry Hurley wrote:
>>>>>> As soon as I have gotten our Direct Project implementation to work
>>>>>> with James 3.x.0 (I am compilinga against the 3.2.0 release jars), I
>>>>>> can look at working the JPA MailRepository angle. Unfortunately,
>>>>>> other production issues and upgrade tasks have taken priority. You
>>>>>> know how it is when you help support two or three applications.
>>>>>>
>>>>>> Sent from my iPhone
>>>>>>
>>>>>>> On Jan 30, 2019, at 11:43 PM, Benoit Tellier
>>>>>>> <bt...@linagora.com> wrote:
>>>>>>>
>>>>>>> Hi Garry,
>>>>>>>
>>>>>>> To answer your previous email:
>>>>>>>
>>>>>>> At Linagora we rely on "LDAP user repository".
>>>>>>>
>>>>>>> Yes, we are currently limited to "a mailAddres" -> "a mailbox
>>>>>>> account".
>>>>>>> Shared mailboxes is not supported so far. That being said
>>>>>>> "RecipientRewrite tables" successfully enables concepts like "Alias",
>>>>>>> "Mail forwarding", "Groups", "Domain redirection". The
>>>>>>> mailAddress<->mailAccount mapping is done at that level. Note that no
>>>>>>> implementation of LDAP based RRT is implemented so far, but such a
>>>>>>> component would make perfect sense and could be
>>>>>>> implemented/contributed
>>>>>>> in the future.
>>>>>>>
>>>>>>> I don't understand the "either we are moving away from file-based
>>>>>>> repos
>>>>>>> or we aren't". All components have data-base alternatives. For the
>>>>>>> example of the mailQueue that you took, there is an old-fashion file
>>>>>>> implementation that I'd personally like to deprecate along with all
>>>>>>> the
>>>>>>> other file-based-storages implemented in James. But an ActiveMQ
>>>>>>> implementation is available as well as a RabbitMQ one.
>>>>>>>
>>>>>>> "Dead letter" concept for "Mail processing" is implemented via
>>>>>>> Mail-Repositories (/var/mail/error) and full support for
>>>>>>> reprocessing is
>>>>>>> granted (at least in guice products).
>>>>>>>
>>>>>>> (And you are right, we miss a JPA MailRepository implementation...
>>>>>>> This
>>>>>>> sounds like a nice proposal of contribution!)
>>>>>>>
>>>>>>> So I really do think that we are, as a project, moving forward to
>>>>>>> newer
>>>>>>> tech. If you think we are missing something, then this should of
>>>>>>> course
>>>>>>> be discussed.
>>>>>>>
>>>>>>> And of course, on all these topics, all contributions are welcomed ;-)
>>>>>>>
>>>>>>> Cheers,
>>>>>>>
>>>>>>> Benoit TELLIER
>>>>>>>
>>>>>>>
>>>>>>>> On 1/31/19 11:18 AM, Garry Hurley wrote:
>>>>>>>>
>>>>>>>> A couple of questions. First, what is your usersrepository? If you
>>>>>>>> store user info in the database, yes, you would have to store each
>>>>>>>> user in there. If you store it in LDAP, you could store each entry
>>>>>>>> as an inetOrgPerson object, or a subclass of that, with a mailbox
>>>>>>>> entry for that person. Then when you authenticate against LDAP,
>>>>>>>> you get the mailbox for delivery. The LDAP is easier to maintain,
>>>>>>>> but harder to work with and adds complexity if you don’t already
>>>>>>>> use it for something else. What seems like a trivial thing - a
>>>>>>>> user to mailbox mapping - to be implemented in the database is
>>>>>>>> missing. Even an ‘entity’ to mailbox mapping so that you could
>>>>>>>> link a mailbox to a group or an individual is missing. Also
>>>>>>>> missing from the database is a dead letter queue, which is still
>>>>>>>> file-based. I can understand the tradeoff of security for
>>>>>>>> compliance with old-school tech, but either we are moving away
>>>>>>>> from file-based repos or we aren’t.
>>>>>>>>
>>>>>>>> Sent from my iPhone
>>>>>>>>
>>>>>>>>> On Jan 30, 2019, at 11:00 PM, Benoit Tellier
>>>>>>>>> <bt...@linagora.com> wrote:
>>>>>>>>>
>>>>>>>>> Hello Matt,
>>>>>>>>>
>>>>>>>>> So as far as I understand your main need would be:
>>>>>>>>>
>>>>>>>>> ```
>>>>>>>>> WHEN I send an email
>>>>>>>>> THEN it is stored in *myMagicRecipient* INBOX
>>>>>>>>> Regardless of original recipients
>>>>>>>>> ```
>>>>>>>>>
>>>>>>>>> Quite surprisingly such a "Overwrite envelop" feature is missing...
>>>>>>>>>
>>>>>>>>> Here is the JIRA:
>>>>>>>>> https://issues.apache.org/jira/browse/MAILET-163 Don't
>>>>>>>>> hesitate to PR this ;-)
>>>>>>>>>
>>>>>>>>> (Combined with a "not RemoteHostIs" you would achieve the
>>>>>>>>> rewritting you
>>>>>>>>> need)
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>>
>>>>>>>>> Benoit TELLIER
>>>>>>>>>
>>>>>>>>>> On 1/30/19 4:13 PM, cryptearth wrote:
>>>>>>>>>> Hello Benoit,
>>>>>>>>>>
>>>>>>>>>> let me try to re-phrase my goal:
>>>>>>>>>>
>>>>>>>>>> I've set up a clean install of opensuse 15.0 on my test-rig,
>>>>>>>>>> named it
>>>>>>>>>> glados, assigned it to my domain cryptearth.de, set sendmail as
>>>>>>>>>> nullclient along with james 3.2.0 and want to collect any mail
>>>>>>>>>> dropped
>>>>>>>>>> by sendmail into a specific mailbox. The catch: As I also want
>>>>>>>>>> to use
>>>>>>>>>> sendmail to support mail() command for php, e-mails dropped in by
>>>>>>>>>> apache should be routed extern.
>>>>>>>>>>
>>>>>>>>>> So: sendmail dropps in mails depending on wich service calls it.
>>>>>>>>>> Cron
>>>>>>>>>> for example uses glados@glados.cryptearth.de - apache instead
>>>>>>>>>> wwwrun@localhost - and my guess is that other services might use
>>>>>>>>>> other
>>>>>>>>>> combinations as well.
>>>>>>>>>>
>>>>>>>>>> Goal: When a mail is dropped by apache, wich is set to
>>>>>>>>>> webmaster@cryptearth.de by using -f parameter in php.ini, these
>>>>>>>>>> mails
>>>>>>>>>> should go out as normal to they recipient. Any other mail should
>>>>>>>>>> get
>>>>>>>>>> collected into a special user, for example
>>>>>>>>>> local-services@cryptearth.de or so.
>>>>>>>>>>
>>>>>>>>>> What I disconvered yet: When the domain wich is used by sendmail is
>>>>>>>>>> not in the domain-list, james thinks it's an external domain and
>>>>>>>>>> tries
>>>>>>>>>> remote delivery. If the domain is in the domain-list, but not
>>>>>>>>>> the user
>>>>>>>>>> name - it fast fails to "no user". And if the user for the
>>>>>>>>>> domain is
>>>>>>>>>> also added it gets delivered into inbox without double in sent.
>>>>>>>>>> It's
>>>>>>>>>> that last one I want, but without adding any specific user for each
>>>>>>>>>> services wich may use sendmail to try to local-deliver
>>>>>>>>>> status-mails,
>>>>>>>>>> wich sendmail usual would drop into /var/mail or ~/mail (or what
>>>>>>>>>> ever
>>>>>>>>>> it is default to).
>>>>>>>>>>
>>>>>>>>>> I dug through mailets and recipient rewrite and got some hints, but
>>>>>>>>>> couldn't figure out some working yet. One think I come up with
>>>>>>>>>> is add
>>>>>>>>>> some to mailetcontainer wich re-writes recipient based on
>>>>>>>>>> remote-host,
>>>>>>>>>> wich for sendmail is localhost. Other idea I had: use some
>>>>>>>>>> re-write-rule based on local hostname, but you recommended against
>>>>>>>>>> using this way.
>>>>>>>>>>
>>>>>>>>>> Another possible what someone come up with: add my own few lines
>>>>>>>>>> into
>>>>>>>>>> source and re-build - but I don't know where to add as it's all
>>>>>>>>>> very
>>>>>>>>>> abstract and I'm not that pro of Java.
>>>>>>>>>>
>>>>>>>>>> Thanks to anyone in advance,
>>>>>>>>>>
>>>>>>>>>> Matt
>>>>>>>>>>
>>>>>>>>>>> Am 30.01.2019 um 05:15 schrieb Benoit Tellier:
>>>>>>>>>>> Hi Matt,
>>>>>>>>>>>
>>>>>>>>>>> I read the all thread but feel quite confuse about what you try to
>>>>>>>>>>> achieve.
>>>>>>>>>>>
>>>>>>>>>>> Could you describe it again? (`When ... Then ...` syntax can
>>>>>>>>>>> really
>>>>>>>>>>> help!)
>>>>>>>>>>>
>>>>>>>>>>> Don't be using regex rewrites - I guess nobody understand what
>>>>>>>>>>> it does.
>>>>>>>>>>>
>>>>>>>>>>> Maybe you are interested by domain rewrites? Or do you want
>>>>>>>>>>> that all
>>>>>>>>>>> mail received, whatever the recipient, goes to the same mailbox?
>>>>>>>>>>>
>>>>>>>>>>> Cheers,
>>>>>>>>>>>
>>>>>>>>>>> Benoit TELLIER
>>>>>>>>>>>
>>>>>>>>>>>> On 1/28/19 9:57 AM, cryptearth wrote:
>>>>>>>>>>>> Hey there, Matt here again.
>>>>>>>>>>>>
>>>>>>>>>>>> So, I think a found a possible solution without any
>>>>>>>>>>>> source-file mods
>>>>>>>>>>>> but
>>>>>>>>>>>> only clever mailet-config in mailetcontainer.xml.
>>>>>>>>>>>>
>>>>>>>>>>>> As I dug through the source I found the standard mailets for
>>>>>>>>>>>> RecipientIsLocal. Then I found RecipientIsRegex (I might need
>>>>>>>>>>>> some help
>>>>>>>>>>>> here). Also there is something called RewriteTable.
>>>>>>>>>>>>
>>>>>>>>>>>> I set up a fresh opensuse leap 15 - cron sends mails as
>>>>>>>>>>>> <user>@<hostname>.<domain> - so I set up a small test-script
>>>>>>>>>>>> and looked
>>>>>>>>>>>> at log while running james in console mode: when the
>>>>>>>>>>>> domainlist doesn't
>>>>>>>>>>>> contain <hostname>.<domain> but only <domain> james thinks that
>>>>>>>>>>>> <hostname>.<domain> is external and tries RemoteDelivery. So I
>>>>>>>>>>>> added
>>>>>>>>>>>> <hostname>.<domain> to domainlist. As I just had the domain,
>>>>>>>>>>>> but not
>>>>>>>>>>>> the
>>>>>>>>>>>> user, the mail is denied as user doesn't exists for the
>>>>>>>>>>>> domain. When I
>>>>>>>>>>>> add the user as <localuser>@<hostname>.<domain> it gets local
>>>>>>>>>>>> delivered
>>>>>>>>>>>> without additional copy in sent folder. So as I don't want to
>>>>>>>>>>>> set up a
>>>>>>>>>>>> user for each localuser, but also want to avoid fastfail I
>>>>>>>>>>>> come up
>>>>>>>>>>>> with:
>>>>>>>>>>>> What if I could early check for <whatever>@<hostname>.<domain>
>>>>>>>>>>>> and
>>>>>>>>>>>> could
>>>>>>>>>>>> just re-write it to an existing account in form of
>>>>>>>>>>>> <user>@<domain>?
>>>>>>>>>>>> When
>>>>>>>>>>>> recipient is re-written before RecipientIsLocal is checked,
>>>>>>>>>>>> then this
>>>>>>>>>>>> should trigger and just deliver any local mail from what ever
>>>>>>>>>>>> service to
>>>>>>>>>>>> the mailbox I want to.
>>>>>>>>>>>>
>>>>>>>>>>>> So I search through the source tree - but couldn't find
>>>>>>>>>>>> anything to
>>>>>>>>>>>> alter the recipient by mailet. All I found was the
>>>>>>>>>>>> recipientrewritetable.xml file and the AddRegexMapping command
>>>>>>>>>>>> available
>>>>>>>>>>>> in james-cli.sh. The xml-config doesn't seem to help, but the
>>>>>>>>>>>> AddRegexMapping command looks good, but I don't understand the
>>>>>>>>>>>> command
>>>>>>>>>>>> parameters:
>>>>>>>>>>>>
>>>>>>>>>>>> AddRegexMapping <user> <domain> <regex>
>>>>>>>>>>>>
>>>>>>>>>>>> Can someone get me some hint how to use this command? Or
>>>>>>>>>>>> where/how I
>>>>>>>>>>>> can
>>>>>>>>>>>> setup the recipient-rewrite before RecipientIsLocal is checked?
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks in advance,
>>>>>>>>>>>>
>>>>>>>>>>>> Matt
>>>>>>>>>>>>
>>>>>>>>>>>>> Am 27.01.2019 um 15:20 schrieb cryptearth:
>>>>>>>>>>>>> So, as far as I dug through the code, it seems to come down to
>>>>>>>>>>>>> MailetContext.isLocalEmail(MailAddress) wich is checked by
>>>>>>>>>>>>> RecipientIsLocal (wich I guess also involve somehow a check of
>>>>>>>>>>>>> isLocalServer(Domain). In transport-processor there is the line
>>>>>>>>>>>>>
>>>>>>>>>>>>> <mailet match="RecipientIsLocal" class="LocalDelivery" />
>>>>>>>>>>>>>
>>>>>>>>>>>>> I looked into LocalDelivery.java, but I guess when this
>>>>>>>>>>>>> matches it's
>>>>>>>>>>>>> to late to perform the test I want to about where the mail
>>>>>>>>>>>>> comes from
>>>>>>>>>>>>> and where it should send. JamesMailetContext looks good, as it
>>>>>>>>>>>>> contains isLocalServer(Domain), wich should also used to check
>>>>>>>>>>>>> SenderIsLocal (wich shouldn't matter, as this test is
>>>>>>>>>>>>> performed by
>>>>>>>>>>>>> source 127.0.0.1). As far as I yet could identify, it all
>>>>>>>>>>>>> comes down
>>>>>>>>>>>>> to somehow tell the config, that whatever domain sendmail
>>>>>>>>>>>>> uses (it's
>>>>>>>>>>>>> either hostname or hostname.domain) is considered as
>>>>>>>>>>>>> localServer. The
>>>>>>>>>>>>> wild-card alias shouldn't be any harder to find or figure out
>>>>>>>>>>>>> as I
>>>>>>>>>>>>> simply have to rewrite anything that comes from local and is for
>>>>>>>>>>>>> local, but isn't in localUserList, is re-written to whatever
>>>>>>>>>>>>> address I
>>>>>>>>>>>>> want.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I'll report back when I found the lines to alter.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Matt
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Am 26.01.2019 um 22:57 schrieb cryptearth:
>>>>>>>>>>>>>> Currently I'm just using out-of-the-box after clean build.
>>>>>>>>>>>>>> I'll have
>>>>>>>>>>>>>> a look at the mentioned class and the mailetcontainer. Maybe
>>>>>>>>>>>>>> I'll
>>>>>>>>>>>>>> find my way around. Good James is written in Java - the one
>>>>>>>>>>>>>> language
>>>>>>>>>>>>>> I really know.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Thanks for the point in a possible direction. I'll report
>>>>>>>>>>>>>> back when I
>>>>>>>>>>>>>> got something usefull.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Matt
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ---- Garry Hurley schrieb ----
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Matt, are you using a custom mailet, or working out of the
>>>>>>>>>>>>>> box? Take
>>>>>>>>>>>>>> a look at the source for LocalDelivery.java
>>>>>>>>>>>>>> <http://LocalDelivery.java>, and the configuration for local
>>>>>>>>>>>>>> mail in
>>>>>>>>>>>>>> your mailetcontainer.xml <http://mailetcontainer.xml> file.
>>>>>>>>>>>>>> You may
>>>>>>>>>>>>>> have to override some functionality to get the processing
>>>>>>>>>>>>>> you want.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Sent from my iPhone
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On Jan 26, 2019, at 9:36 AM, cryptearth
>>>>>>>>>>>>>>> <cryptearth@cryptearth.de
>>>>>>>>>>>>>> <ma...@cryptearth.de>> wrote:
>>>>>>>>>>>>>>> Hey there, Matt here.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> So I got sendmail working with james now (tried postfix,
>>>>>>>>>>>>>>> but it
>>>>>>>>>>>>>> always complains forwarding to localhost isn't supported as
>>>>>>>>>>>>>> there is
>>>>>>>>>>>>>> no option to ignore false loopback detection), and when used
>>>>>>>>>>>>>> from
>>>>>>>>>>>>>> apache with additional -f parameter all works good. But as
>>>>>>>>>>>>>> there're
>>>>>>>>>>>>>> other services might drop mail into local queue (crontab
>>>>>>>>>>>>>> specificly)
>>>>>>>>>>>>>> I noticed, that I'm still missing something. My goal is
>>>>>>>>>>>>>> somesort of
>>>>>>>>>>>>>> wildcard alias so that no matter from wich user sendmail gets a
>>>>>>>>>>>>>> message, except the one I use for apache, it should redirect
>>>>>>>>>>>>>> them
>>>>>>>>>>>>>> internally to one of the user-accounts inside james itself.
>>>>>>>>>>>>>> I guess
>>>>>>>>>>>>>> there would be a simple solution if would like all mails to get
>>>>>>>>>>>>>> forwareded, but I don't think there is a blacklist syntax so
>>>>>>>>>>>>>> that
>>>>>>>>>>>>>> mails from specific services with non-local recipients got
>>>>>>>>>>>>>> send out.
>>>>>>>>>>>>>>> Currently I'm using 3.2.0 <tel:3.2.0> final release commit.
>>>>>>>>>>>>>>> I also
>>>>>>>>>>>>>> looked into the mailetcontainer.xml
>>>>>>>>>>>>>> <http://mailetcontainer.xml> file
>>>>>>>>>>>>>> and I guess it's possible in there to specify this rule:
>>>>>>>>>>>>>>> redirect anything local, except address set in apache
>>>>>>>>>>>>>>> config, to
>>>>>>>>>>>>>> user X, otherwise when from apache with non-local target ->
>>>>>>>>>>>>>> transport
>>>>>>>>>>>>>>> Could anyone maybe give me a hint?
>>>>>>>>>>>>>>> Other solution: redirect anything local from sendmail to
>>>>>>>>>>>>>>> processing
>>>>>>>>>>>>>> and with another task process the mails like some short
>>>>>>>>>>>>>> lines of
>>>>>>>>>>>>>> additional Java.
>>>>>>>>>>>>>>> Matt
>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> To unsubscribe, e-mail:
>>>>>>>>>>>>>> server-user-unsubscribe@james.apache.org
>>>>>>>>>>>>>> <ma...@james.apache.org>
>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>> server-user-help@james.apache.org
>>>>>>>>>>>>>> <ma...@james.apache.org>
>>>>>>>>>>>>>>
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>
>>>>>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>> server-user-help@james.apache.org
>>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>
>>>>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>
>>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>
>>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org


Re: james and sendmail - wildcard alias for local users

Posted by cryptearth <cr...@cryptearth.de>.
Hey there,

I don't know if my last reply was sent, but I couldn't find it by checking web-archive. So apologies if this is a double-post.

About the matchers mentioned by Benoit:

I already begun to implement a RemoteAddrMatcher myself as I couldn't find any while digging through the source, but I guess RemoteAddrInNetwork will do the trick, allthough it's wired style of checking with some DNS-stuff involved confuses me. Seems it comes down how the network is defined - I'll check the documentation.

About the SenderIs and SenderHostIs matchers: I already tried them, but strangely, in the 3.2.0 branch the only consider something as local when it's in the domain-list - wich I also tried but results in fastfail if I don't add the user - wich I want to avoid by overwriting the recipient so the RecipientIsLocal matches for LocalDelivery.

As I dug through the source I also found those logical-combine matchers, wich can group multiple matchers with the basic logic AND, OR and NOT. So I came up with the idea of checking RemoteAddr and combine with not sender is what I set for apache. Reason: I want to use webmaster as the user part. So I made sure there is no local user matching this, this way I know if anything come from local but is not webmaster has to be some local service wich I want to rewrite the recipient for local catch.

Sadly, due to long shifts at work I hadn't time to test this yet.

I'll report back after I got some time to implement a SetRecipient mailet and check if existing RemoteAddrInNetwork helps or if I also have to implement my own.

So long,

Matt

---- Benoit Tellier schrieb ----

>Hi,
>
>Have a look to:
> - SenderIsLocal (based on the mail address of the sender)
> - SenderHostIs + SenderHostIsLocal (based on the domain of the sender)
> - You can already do some matching on the IP of the sender using
>RemoteAddrInNetwork. Assuming you have well defined IPs, that you can
>configure in XML, this would do 100% the job you tried to hack.
>
>Best regards,
>
>Benoit TELLIER
>
>On 2/4/19 1:55 AM, cryptearth wrote:
>> So I dug through some code and found some points where I might could get
>> started:
>> 
>> The interface org.apache.mailet.Mail offeres the methods one might could
>> write a matcher and a mailet on:
>> 
>> String org.apache.mailet.Mail.getRemoteHost()
>> String org.apache.mailet.Mail.getRemoteAddr()
>> void org.apache.mailet.Mail.setRecipients(Collection<MailAdress>)
>> 
>> As one can see, the two getRemoteXXX() methods return a String. This can
>> lead to java.net.InetAddress.getByName(String) and provided methods
>> InetAddress.isAnyLocalAddress(), InetAddress.isLinkLocalAddress() and
>> InetAddress.isLoopbackAddress(). Also one can compare
>> InetAddress.getLocalHost().getHostName() or .getHostAddress().
>> 
>> As for the rewrite, the already mentioned SetRecipient mailet suggeted
>> by Benoit could already do the trick, at least for my personal question.
>> 
>> What I still not undestand: How to configure a Matcher or a Mailet by
>> XML syntax?
>> 
>> As Benoit mention:
>> 
>> <mailet ...>
>>     <recipient>...</recipient>
>> </mailet>
>> 
>> So, how I would get the value of the recipient-tag into my Matcher or
>> Mailet? Reason: For modeling a Matcher and Mailet, I would like to not
>> only write some lines for my specific case, but would like to make it
>> configureable by what one could write in the XML. For example: specify
>> for what the matcher should match, like sepcific sender, remote-host,
>> maybe specific recipients - or what the Mailet should does: like remove
>> any recipients and replace it only by one entry, or maybe based on the
>> source set some specific recipients. I guess this should be possible as
>> one could configure more or less complex rules via XML - wich then just
>> had to be parsed into corresponding ruleset handling the Mail and decide
>> if and how to modify it.
>> 
>> Thanks so far,
>> 
>> Matt
>> 
>> Am 31.01.2019 um 10:32 schrieb cryptearth:
>>> Hello Benoit,
>>>
>>> thanks for your enormous effort you take into trying to help us with
>>> such questions.
>>>
>>> About the JIRA you filed, I guess that's what I looking for, as I
>>> thought such SetRecipient(s) would already exist.
>>>
>>> I came also up with a bit simpler description about my problem: I know
>>> the origin: localhost, I don't know the sender nor target, but I do
>>> know, that if it comes from a specific sender (the one I set in apache
>>> php.ini), it's recipient is extern and should processed normal
>>> RemoteDelivery, as there is no localuser matching this specific sender.
>>>
>>> Example: in apache php.ini the sender is set to
>>> webmaster@cryptearth.de - there is no localuser matching this, and the
>>> recipient is external. This get's processed as usual and a copy of the
>>> send mail is out into SENT folder - as I want it to. When sendmail
>>> gets mails from other services, namely cron, it drops in, for example,
>>> as glados@glados.cryptearth.de. Even glados.cryptearth.de is a FQHN,
>>> it could also seen as sub-domain, but james thinks this is an external
>>> target as galdos.cryptearth.de isn't added in the domainlist. Other
>>> services instead drop like wwwrun@localhost (that's the default wehn
>>> no -f paramter is set in apache php.ini). So, as there is no matching
>>> domain either, it gets rejected right away.
>>>
>>> Also, it seems there is missing an "inverted" matcher wich could be
>>> used for something like: "if <from> is not <xyz>" - I could only find
>>> matchers for "if <from> is <xyz>". I couldn't find an example for
>>> combine matchers neither: "if network is localhost AND if from is not
>>> webmaster@cryptearth.de" > rewrite recipient to
>>> local-services@cryptearth.de
>>>
>>> Thanks so far,
>>>
>>> Matt
>>>
>>> Am 31.01.2019 um 08:29 schrieb Benoit Tellier:
>>>> Don't worry, I already feel overwhelmed with a single application and
>>>> several collegues contributing on it with me!
>>>>
>>>> Concerning the JPAMailRepository, thank you very much for your proposal!
>>>>
>>>> I do believe it is really nice as it allows JPA users to no more rely on
>>>> file-system based storage API at all.
>>>>
>>>> Here is the JIRA, https://issues.apache.org/jira/browse/JAMES-2656 I
>>>> would be more than happy to help you implementing this!
>>>>
>>>> Cheers,
>>>>
>>>> Benoit
>>>>
>>>> On 1/31/19 1:24 PM, Garry Hurley wrote:
>>>>> As soon as I have gotten our Direct Project implementation to work
>>>>> with James 3.x.0 (I am compilinga against the 3.2.0 release jars), I
>>>>> can look at working the JPA MailRepository angle. Unfortunately,
>>>>> other production issues and upgrade tasks have taken priority. You
>>>>> know how it is when you help support two or three applications.
>>>>>
>>>>> Sent from my iPhone
>>>>>
>>>>>> On Jan 30, 2019, at 11:43 PM, Benoit Tellier
>>>>>> <bt...@linagora.com> wrote:
>>>>>>
>>>>>> Hi Garry,
>>>>>>
>>>>>> To answer your previous email:
>>>>>>
>>>>>> At Linagora we rely on "LDAP user repository".
>>>>>>
>>>>>> Yes, we are currently limited to "a mailAddres" -> "a mailbox
>>>>>> account".
>>>>>> Shared mailboxes is not supported so far. That being said
>>>>>> "RecipientRewrite tables" successfully enables concepts like "Alias",
>>>>>> "Mail forwarding", "Groups", "Domain redirection". The
>>>>>> mailAddress<->mailAccount mapping is done at that level. Note that no
>>>>>> implementation of LDAP based RRT is implemented so far, but such a
>>>>>> component would make perfect sense and could be
>>>>>> implemented/contributed
>>>>>> in the future.
>>>>>>
>>>>>> I don't understand the "either we are moving away from file-based
>>>>>> repos
>>>>>> or we aren't". All components have data-base alternatives. For the
>>>>>> example of the mailQueue that you took, there is an old-fashion file
>>>>>> implementation that I'd personally like to deprecate along with all
>>>>>> the
>>>>>> other file-based-storages implemented in James. But an ActiveMQ
>>>>>> implementation is available as well as a RabbitMQ one.
>>>>>>
>>>>>> "Dead letter" concept for "Mail processing" is implemented via
>>>>>> Mail-Repositories (/var/mail/error) and full support for
>>>>>> reprocessing is
>>>>>> granted (at least in guice products).
>>>>>>
>>>>>> (And you are right, we miss a JPA MailRepository implementation...
>>>>>> This
>>>>>> sounds like a nice proposal of contribution!)
>>>>>>
>>>>>> So I really do think that we are, as a project, moving forward to
>>>>>> newer
>>>>>> tech. If you think we are missing something, then this should of
>>>>>> course
>>>>>> be discussed.
>>>>>>
>>>>>> And of course, on all these topics, all contributions are welcomed ;-)
>>>>>>
>>>>>> Cheers,
>>>>>>
>>>>>> Benoit TELLIER
>>>>>>
>>>>>>
>>>>>>> On 1/31/19 11:18 AM, Garry Hurley wrote:
>>>>>>>
>>>>>>> A couple of questions. First, what is your usersrepository? If you
>>>>>>> store user info in the database, yes, you would have to store each
>>>>>>> user in there. If you store it in LDAP, you could store each entry
>>>>>>> as an inetOrgPerson object, or a subclass of that, with a mailbox
>>>>>>> entry for that person. Then when you authenticate against LDAP,
>>>>>>> you get the mailbox for delivery. The LDAP is easier to maintain,
>>>>>>> but harder to work with and adds complexity if you don’t already
>>>>>>> use it for something else. What seems like a trivial thing - a
>>>>>>> user to mailbox mapping - to be implemented in the database is
>>>>>>> missing. Even an ‘entity’ to mailbox mapping so that you could
>>>>>>> link a mailbox to a group or an individual is missing. Also
>>>>>>> missing from the database is a dead letter queue, which is still
>>>>>>> file-based. I can understand the tradeoff of security for
>>>>>>> compliance with old-school tech, but either we are moving away
>>>>>>> from file-based repos or we aren’t.
>>>>>>>
>>>>>>> Sent from my iPhone
>>>>>>>
>>>>>>>> On Jan 30, 2019, at 11:00 PM, Benoit Tellier
>>>>>>>> <bt...@linagora.com> wrote:
>>>>>>>>
>>>>>>>> Hello Matt,
>>>>>>>>
>>>>>>>> So as far as I understand your main need would be:
>>>>>>>>
>>>>>>>> ```
>>>>>>>> WHEN I send an email
>>>>>>>> THEN it is stored in *myMagicRecipient* INBOX
>>>>>>>> Regardless of original recipients
>>>>>>>> ```
>>>>>>>>
>>>>>>>> Quite surprisingly such a "Overwrite envelop" feature is missing...
>>>>>>>>
>>>>>>>> Here is the JIRA:
>>>>>>>> https://issues.apache.org/jira/browse/MAILET-163 Don't
>>>>>>>> hesitate to PR this ;-)
>>>>>>>>
>>>>>>>> (Combined with a "not RemoteHostIs" you would achieve the
>>>>>>>> rewritting you
>>>>>>>> need)
>>>>>>>>
>>>>>>>> Cheers,
>>>>>>>>
>>>>>>>> Benoit TELLIER
>>>>>>>>
>>>>>>>>> On 1/30/19 4:13 PM, cryptearth wrote:
>>>>>>>>> Hello Benoit,
>>>>>>>>>
>>>>>>>>> let me try to re-phrase my goal:
>>>>>>>>>
>>>>>>>>> I've set up a clean install of opensuse 15.0 on my test-rig,
>>>>>>>>> named it
>>>>>>>>> glados, assigned it to my domain cryptearth.de, set sendmail as
>>>>>>>>> nullclient along with james 3.2.0 and want to collect any mail
>>>>>>>>> dropped
>>>>>>>>> by sendmail into a specific mailbox. The catch: As I also want
>>>>>>>>> to use
>>>>>>>>> sendmail to support mail() command for php, e-mails dropped in by
>>>>>>>>> apache should be routed extern.
>>>>>>>>>
>>>>>>>>> So: sendmail dropps in mails depending on wich service calls it.
>>>>>>>>> Cron
>>>>>>>>> for example uses glados@glados.cryptearth.de - apache instead
>>>>>>>>> wwwrun@localhost - and my guess is that other services might use
>>>>>>>>> other
>>>>>>>>> combinations as well.
>>>>>>>>>
>>>>>>>>> Goal: When a mail is dropped by apache, wich is set to
>>>>>>>>> webmaster@cryptearth.de by using -f parameter in php.ini, these
>>>>>>>>> mails
>>>>>>>>> should go out as normal to they recipient. Any other mail should
>>>>>>>>> get
>>>>>>>>> collected into a special user, for example
>>>>>>>>> local-services@cryptearth.de or so.
>>>>>>>>>
>>>>>>>>> What I disconvered yet: When the domain wich is used by sendmail is
>>>>>>>>> not in the domain-list, james thinks it's an external domain and
>>>>>>>>> tries
>>>>>>>>> remote delivery. If the domain is in the domain-list, but not
>>>>>>>>> the user
>>>>>>>>> name - it fast fails to "no user". And if the user for the
>>>>>>>>> domain is
>>>>>>>>> also added it gets delivered into inbox without double in sent.
>>>>>>>>> It's
>>>>>>>>> that last one I want, but without adding any specific user for each
>>>>>>>>> services wich may use sendmail to try to local-deliver
>>>>>>>>> status-mails,
>>>>>>>>> wich sendmail usual would drop into /var/mail or ~/mail (or what
>>>>>>>>> ever
>>>>>>>>> it is default to).
>>>>>>>>>
>>>>>>>>> I dug through mailets and recipient rewrite and got some hints, but
>>>>>>>>> couldn't figure out some working yet. One think I come up with
>>>>>>>>> is add
>>>>>>>>> some to mailetcontainer wich re-writes recipient based on
>>>>>>>>> remote-host,
>>>>>>>>> wich for sendmail is localhost. Other idea I had: use some
>>>>>>>>> re-write-rule based on local hostname, but you recommended against
>>>>>>>>> using this way.
>>>>>>>>>
>>>>>>>>> Another possible what someone come up with: add my own few lines
>>>>>>>>> into
>>>>>>>>> source and re-build - but I don't know where to add as it's all
>>>>>>>>> very
>>>>>>>>> abstract and I'm not that pro of Java.
>>>>>>>>>
>>>>>>>>> Thanks to anyone in advance,
>>>>>>>>>
>>>>>>>>> Matt
>>>>>>>>>
>>>>>>>>>> Am 30.01.2019 um 05:15 schrieb Benoit Tellier:
>>>>>>>>>> Hi Matt,
>>>>>>>>>>
>>>>>>>>>> I read the all thread but feel quite confuse about what you try to
>>>>>>>>>> achieve.
>>>>>>>>>>
>>>>>>>>>> Could you describe it again? (`When ... Then ...` syntax can
>>>>>>>>>> really
>>>>>>>>>> help!)
>>>>>>>>>>
>>>>>>>>>> Don't be using regex rewrites - I guess nobody understand what
>>>>>>>>>> it does.
>>>>>>>>>>
>>>>>>>>>> Maybe you are interested by domain rewrites? Or do you want
>>>>>>>>>> that all
>>>>>>>>>> mail received, whatever the recipient, goes to the same mailbox?
>>>>>>>>>>
>>>>>>>>>> Cheers,
>>>>>>>>>>
>>>>>>>>>> Benoit TELLIER
>>>>>>>>>>
>>>>>>>>>>> On 1/28/19 9:57 AM, cryptearth wrote:
>>>>>>>>>>> Hey there, Matt here again.
>>>>>>>>>>>
>>>>>>>>>>> So, I think a found a possible solution without any
>>>>>>>>>>> source-file mods
>>>>>>>>>>> but
>>>>>>>>>>> only clever mailet-config in mailetcontainer.xml.
>>>>>>>>>>>
>>>>>>>>>>> As I dug through the source I found the standard mailets for
>>>>>>>>>>> RecipientIsLocal. Then I found RecipientIsRegex (I might need
>>>>>>>>>>> some help
>>>>>>>>>>> here). Also there is something called RewriteTable.
>>>>>>>>>>>
>>>>>>>>>>> I set up a fresh opensuse leap 15 - cron sends mails as
>>>>>>>>>>> <user>@<hostname>.<domain> - so I set up a small test-script
>>>>>>>>>>> and looked
>>>>>>>>>>> at log while running james in console mode: when the
>>>>>>>>>>> domainlist doesn't
>>>>>>>>>>> contain <hostname>.<domain> but only <domain> james thinks that
>>>>>>>>>>> <hostname>.<domain> is external and tries RemoteDelivery. So I
>>>>>>>>>>> added
>>>>>>>>>>> <hostname>.<domain> to domainlist. As I just had the domain,
>>>>>>>>>>> but not
>>>>>>>>>>> the
>>>>>>>>>>> user, the mail is denied as user doesn't exists for the
>>>>>>>>>>> domain. When I
>>>>>>>>>>> add the user as <localuser>@<hostname>.<domain> it gets local
>>>>>>>>>>> delivered
>>>>>>>>>>> without additional copy in sent folder. So as I don't want to
>>>>>>>>>>> set up a
>>>>>>>>>>> user for each localuser, but also want to avoid fastfail I
>>>>>>>>>>> come up
>>>>>>>>>>> with:
>>>>>>>>>>> What if I could early check for <whatever>@<hostname>.<domain>
>>>>>>>>>>> and
>>>>>>>>>>> could
>>>>>>>>>>> just re-write it to an existing account in form of
>>>>>>>>>>> <user>@<domain>?
>>>>>>>>>>> When
>>>>>>>>>>> recipient is re-written before RecipientIsLocal is checked,
>>>>>>>>>>> then this
>>>>>>>>>>> should trigger and just deliver any local mail from what ever
>>>>>>>>>>> service to
>>>>>>>>>>> the mailbox I want to.
>>>>>>>>>>>
>>>>>>>>>>> So I search through the source tree - but couldn't find
>>>>>>>>>>> anything to
>>>>>>>>>>> alter the recipient by mailet. All I found was the
>>>>>>>>>>> recipientrewritetable.xml file and the AddRegexMapping command
>>>>>>>>>>> available
>>>>>>>>>>> in james-cli.sh. The xml-config doesn't seem to help, but the
>>>>>>>>>>> AddRegexMapping command looks good, but I don't understand the
>>>>>>>>>>> command
>>>>>>>>>>> parameters:
>>>>>>>>>>>
>>>>>>>>>>> AddRegexMapping <user> <domain> <regex>
>>>>>>>>>>>
>>>>>>>>>>> Can someone get me some hint how to use this command? Or
>>>>>>>>>>> where/how I
>>>>>>>>>>> can
>>>>>>>>>>> setup the recipient-rewrite before RecipientIsLocal is checked?
>>>>>>>>>>>
>>>>>>>>>>> Thanks in advance,
>>>>>>>>>>>
>>>>>>>>>>> Matt
>>>>>>>>>>>
>>>>>>>>>>>> Am 27.01.2019 um 15:20 schrieb cryptearth:
>>>>>>>>>>>> So, as far as I dug through the code, it seems to come down to
>>>>>>>>>>>> MailetContext.isLocalEmail(MailAddress) wich is checked by
>>>>>>>>>>>> RecipientIsLocal (wich I guess also involve somehow a check of
>>>>>>>>>>>> isLocalServer(Domain). In transport-processor there is the line
>>>>>>>>>>>>
>>>>>>>>>>>> <mailet match="RecipientIsLocal" class="LocalDelivery" />
>>>>>>>>>>>>
>>>>>>>>>>>> I looked into LocalDelivery.java, but I guess when this
>>>>>>>>>>>> matches it's
>>>>>>>>>>>> to late to perform the test I want to about where the mail
>>>>>>>>>>>> comes from
>>>>>>>>>>>> and where it should send. JamesMailetContext looks good, as it
>>>>>>>>>>>> contains isLocalServer(Domain), wich should also used to check
>>>>>>>>>>>> SenderIsLocal (wich shouldn't matter, as this test is
>>>>>>>>>>>> performed by
>>>>>>>>>>>> source 127.0.0.1). As far as I yet could identify, it all
>>>>>>>>>>>> comes down
>>>>>>>>>>>> to somehow tell the config, that whatever domain sendmail
>>>>>>>>>>>> uses (it's
>>>>>>>>>>>> either hostname or hostname.domain) is considered as
>>>>>>>>>>>> localServer. The
>>>>>>>>>>>> wild-card alias shouldn't be any harder to find or figure out
>>>>>>>>>>>> as I
>>>>>>>>>>>> simply have to rewrite anything that comes from local and is for
>>>>>>>>>>>> local, but isn't in localUserList, is re-written to whatever
>>>>>>>>>>>> address I
>>>>>>>>>>>> want.
>>>>>>>>>>>>
>>>>>>>>>>>> I'll report back when I found the lines to alter.
>>>>>>>>>>>>
>>>>>>>>>>>> Matt
>>>>>>>>>>>>
>>>>>>>>>>>>> Am 26.01.2019 um 22:57 schrieb cryptearth:
>>>>>>>>>>>>> Currently I'm just using out-of-the-box after clean build.
>>>>>>>>>>>>> I'll have
>>>>>>>>>>>>> a look at the mentioned class and the mailetcontainer. Maybe
>>>>>>>>>>>>> I'll
>>>>>>>>>>>>> find my way around. Good James is written in Java - the one
>>>>>>>>>>>>> language
>>>>>>>>>>>>> I really know.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Thanks for the point in a possible direction. I'll report
>>>>>>>>>>>>> back when I
>>>>>>>>>>>>> got something usefull.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Matt
>>>>>>>>>>>>>
>>>>>>>>>>>>> ---- Garry Hurley schrieb ----
>>>>>>>>>>>>>
>>>>>>>>>>>>> Matt, are you using a custom mailet, or working out of the
>>>>>>>>>>>>> box? Take
>>>>>>>>>>>>> a look at the source for LocalDelivery.java
>>>>>>>>>>>>> <http://LocalDelivery.java>, and the configuration for local
>>>>>>>>>>>>> mail in
>>>>>>>>>>>>> your mailetcontainer.xml <http://mailetcontainer.xml> file.
>>>>>>>>>>>>> You may
>>>>>>>>>>>>> have to override some functionality to get the processing
>>>>>>>>>>>>> you want.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Sent from my iPhone
>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Jan 26, 2019, at 9:36 AM, cryptearth
>>>>>>>>>>>>>> <cryptearth@cryptearth.de
>>>>>>>>>>>>> <ma...@cryptearth.de>> wrote:
>>>>>>>>>>>>>> Hey there, Matt here.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> So I got sendmail working with james now (tried postfix,
>>>>>>>>>>>>>> but it
>>>>>>>>>>>>> always complains forwarding to localhost isn't supported as
>>>>>>>>>>>>> there is
>>>>>>>>>>>>> no option to ignore false loopback detection), and when used
>>>>>>>>>>>>> from
>>>>>>>>>>>>> apache with additional -f parameter all works good. But as
>>>>>>>>>>>>> there're
>>>>>>>>>>>>> other services might drop mail into local queue (crontab
>>>>>>>>>>>>> specificly)
>>>>>>>>>>>>> I noticed, that I'm still missing something. My goal is
>>>>>>>>>>>>> somesort of
>>>>>>>>>>>>> wildcard alias so that no matter from wich user sendmail gets a
>>>>>>>>>>>>> message, except the one I use for apache, it should redirect
>>>>>>>>>>>>> them
>>>>>>>>>>>>> internally to one of the user-accounts inside james itself.
>>>>>>>>>>>>> I guess
>>>>>>>>>>>>> there would be a simple solution if would like all mails to get
>>>>>>>>>>>>> forwareded, but I don't think there is a blacklist syntax so
>>>>>>>>>>>>> that
>>>>>>>>>>>>> mails from specific services with non-local recipients got
>>>>>>>>>>>>> send out.
>>>>>>>>>>>>>> Currently I'm using 3.2.0 <tel:3.2.0> final release commit.
>>>>>>>>>>>>>> I also
>>>>>>>>>>>>> looked into the mailetcontainer.xml
>>>>>>>>>>>>> <http://mailetcontainer.xml> file
>>>>>>>>>>>>> and I guess it's possible in there to specify this rule:
>>>>>>>>>>>>>> redirect anything local, except address set in apache
>>>>>>>>>>>>>> config, to
>>>>>>>>>>>>> user X, otherwise when from apache with non-local target ->
>>>>>>>>>>>>> transport
>>>>>>>>>>>>>> Could anyone maybe give me a hint?
>>>>>>>>>>>>>> Other solution: redirect anything local from sendmail to
>>>>>>>>>>>>>> processing
>>>>>>>>>>>>> and with another task process the mails like some short
>>>>>>>>>>>>> lines of
>>>>>>>>>>>>> additional Java.
>>>>>>>>>>>>>> Matt
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>
>>>>>>>>>>>>> To unsubscribe, e-mail:
>>>>>>>>>>>>> server-user-unsubscribe@james.apache.org
>>>>>>>>>>>>> <ma...@james.apache.org>
>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>> server-user-help@james.apache.org
>>>>>>>>>>>>> <ma...@james.apache.org>
>>>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>
>>>>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>> server-user-help@james.apache.org
>>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>
>>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>
>>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>> 
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>For additional commands, e-mail: server-user-help@james.apache.org
>

Re: james and sendmail - wildcard alias for local users

Posted by Benoit Tellier <bt...@linagora.com>.
Hi,

Have a look to:
 - SenderIsLocal (based on the mail address of the sender)
 - SenderHostIs + SenderHostIsLocal (based on the domain of the sender)
 - You can already do some matching on the IP of the sender using
RemoteAddrInNetwork. Assuming you have well defined IPs, that you can
configure in XML, this would do 100% the job you tried to hack.

Best regards,

Benoit TELLIER

On 2/4/19 1:55 AM, cryptearth wrote:
> So I dug through some code and found some points where I might could get
> started:
> 
> The interface org.apache.mailet.Mail offeres the methods one might could
> write a matcher and a mailet on:
> 
> String org.apache.mailet.Mail.getRemoteHost()
> String org.apache.mailet.Mail.getRemoteAddr()
> void org.apache.mailet.Mail.setRecipients(Collection<MailAdress>)
> 
> As one can see, the two getRemoteXXX() methods return a String. This can
> lead to java.net.InetAddress.getByName(String) and provided methods
> InetAddress.isAnyLocalAddress(), InetAddress.isLinkLocalAddress() and
> InetAddress.isLoopbackAddress(). Also one can compare
> InetAddress.getLocalHost().getHostName() or .getHostAddress().
> 
> As for the rewrite, the already mentioned SetRecipient mailet suggeted
> by Benoit could already do the trick, at least for my personal question.
> 
> What I still not undestand: How to configure a Matcher or a Mailet by
> XML syntax?
> 
> As Benoit mention:
> 
> <mailet ...>
>     <recipient>...</recipient>
> </mailet>
> 
> So, how I would get the value of the recipient-tag into my Matcher or
> Mailet? Reason: For modeling a Matcher and Mailet, I would like to not
> only write some lines for my specific case, but would like to make it
> configureable by what one could write in the XML. For example: specify
> for what the matcher should match, like sepcific sender, remote-host,
> maybe specific recipients - or what the Mailet should does: like remove
> any recipients and replace it only by one entry, or maybe based on the
> source set some specific recipients. I guess this should be possible as
> one could configure more or less complex rules via XML - wich then just
> had to be parsed into corresponding ruleset handling the Mail and decide
> if and how to modify it.
> 
> Thanks so far,
> 
> Matt
> 
> Am 31.01.2019 um 10:32 schrieb cryptearth:
>> Hello Benoit,
>>
>> thanks for your enormous effort you take into trying to help us with
>> such questions.
>>
>> About the JIRA you filed, I guess that's what I looking for, as I
>> thought such SetRecipient(s) would already exist.
>>
>> I came also up with a bit simpler description about my problem: I know
>> the origin: localhost, I don't know the sender nor target, but I do
>> know, that if it comes from a specific sender (the one I set in apache
>> php.ini), it's recipient is extern and should processed normal
>> RemoteDelivery, as there is no localuser matching this specific sender.
>>
>> Example: in apache php.ini the sender is set to
>> webmaster@cryptearth.de - there is no localuser matching this, and the
>> recipient is external. This get's processed as usual and a copy of the
>> send mail is out into SENT folder - as I want it to. When sendmail
>> gets mails from other services, namely cron, it drops in, for example,
>> as glados@glados.cryptearth.de. Even glados.cryptearth.de is a FQHN,
>> it could also seen as sub-domain, but james thinks this is an external
>> target as galdos.cryptearth.de isn't added in the domainlist. Other
>> services instead drop like wwwrun@localhost (that's the default wehn
>> no -f paramter is set in apache php.ini). So, as there is no matching
>> domain either, it gets rejected right away.
>>
>> Also, it seems there is missing an "inverted" matcher wich could be
>> used for something like: "if <from> is not <xyz>" - I could only find
>> matchers for "if <from> is <xyz>". I couldn't find an example for
>> combine matchers neither: "if network is localhost AND if from is not
>> webmaster@cryptearth.de" > rewrite recipient to
>> local-services@cryptearth.de
>>
>> Thanks so far,
>>
>> Matt
>>
>> Am 31.01.2019 um 08:29 schrieb Benoit Tellier:
>>> Don't worry, I already feel overwhelmed with a single application and
>>> several collegues contributing on it with me!
>>>
>>> Concerning the JPAMailRepository, thank you very much for your proposal!
>>>
>>> I do believe it is really nice as it allows JPA users to no more rely on
>>> file-system based storage API at all.
>>>
>>> Here is the JIRA, https://issues.apache.org/jira/browse/JAMES-2656 I
>>> would be more than happy to help you implementing this!
>>>
>>> Cheers,
>>>
>>> Benoit
>>>
>>> On 1/31/19 1:24 PM, Garry Hurley wrote:
>>>> As soon as I have gotten our Direct Project implementation to work
>>>> with James 3.x.0 (I am compilinga against the 3.2.0 release jars), I
>>>> can look at working the JPA MailRepository angle. Unfortunately,
>>>> other production issues and upgrade tasks have taken priority. You
>>>> know how it is when you help support two or three applications.
>>>>
>>>> Sent from my iPhone
>>>>
>>>>> On Jan 30, 2019, at 11:43 PM, Benoit Tellier
>>>>> <bt...@linagora.com> wrote:
>>>>>
>>>>> Hi Garry,
>>>>>
>>>>> To answer your previous email:
>>>>>
>>>>> At Linagora we rely on "LDAP user repository".
>>>>>
>>>>> Yes, we are currently limited to "a mailAddres" -> "a mailbox
>>>>> account".
>>>>> Shared mailboxes is not supported so far. That being said
>>>>> "RecipientRewrite tables" successfully enables concepts like "Alias",
>>>>> "Mail forwarding", "Groups", "Domain redirection". The
>>>>> mailAddress<->mailAccount mapping is done at that level. Note that no
>>>>> implementation of LDAP based RRT is implemented so far, but such a
>>>>> component would make perfect sense and could be
>>>>> implemented/contributed
>>>>> in the future.
>>>>>
>>>>> I don't understand the "either we are moving away from file-based
>>>>> repos
>>>>> or we aren't". All components have data-base alternatives. For the
>>>>> example of the mailQueue that you took, there is an old-fashion file
>>>>> implementation that I'd personally like to deprecate along with all
>>>>> the
>>>>> other file-based-storages implemented in James. But an ActiveMQ
>>>>> implementation is available as well as a RabbitMQ one.
>>>>>
>>>>> "Dead letter" concept for "Mail processing" is implemented via
>>>>> Mail-Repositories (/var/mail/error) and full support for
>>>>> reprocessing is
>>>>> granted (at least in guice products).
>>>>>
>>>>> (And you are right, we miss a JPA MailRepository implementation...
>>>>> This
>>>>> sounds like a nice proposal of contribution!)
>>>>>
>>>>> So I really do think that we are, as a project, moving forward to
>>>>> newer
>>>>> tech. If you think we are missing something, then this should of
>>>>> course
>>>>> be discussed.
>>>>>
>>>>> And of course, on all these topics, all contributions are welcomed ;-)
>>>>>
>>>>> Cheers,
>>>>>
>>>>> Benoit TELLIER
>>>>>
>>>>>
>>>>>> On 1/31/19 11:18 AM, Garry Hurley wrote:
>>>>>>
>>>>>> A couple of questions. First, what is your usersrepository? If you
>>>>>> store user info in the database, yes, you would have to store each
>>>>>> user in there. If you store it in LDAP, you could store each entry
>>>>>> as an inetOrgPerson object, or a subclass of that, with a mailbox
>>>>>> entry for that person. Then when you authenticate against LDAP,
>>>>>> you get the mailbox for delivery. The LDAP is easier to maintain,
>>>>>> but harder to work with and adds complexity if you don’t already
>>>>>> use it for something else. What seems like a trivial thing - a
>>>>>> user to mailbox mapping - to be implemented in the database is
>>>>>> missing. Even an ‘entity’ to mailbox mapping so that you could
>>>>>> link a mailbox to a group or an individual is missing. Also
>>>>>> missing from the database is a dead letter queue, which is still
>>>>>> file-based. I can understand the tradeoff of security for
>>>>>> compliance with old-school tech, but either we are moving away
>>>>>> from file-based repos or we aren’t.
>>>>>>
>>>>>> Sent from my iPhone
>>>>>>
>>>>>>> On Jan 30, 2019, at 11:00 PM, Benoit Tellier
>>>>>>> <bt...@linagora.com> wrote:
>>>>>>>
>>>>>>> Hello Matt,
>>>>>>>
>>>>>>> So as far as I understand your main need would be:
>>>>>>>
>>>>>>> ```
>>>>>>> WHEN I send an email
>>>>>>> THEN it is stored in *myMagicRecipient* INBOX
>>>>>>> Regardless of original recipients
>>>>>>> ```
>>>>>>>
>>>>>>> Quite surprisingly such a "Overwrite envelop" feature is missing...
>>>>>>>
>>>>>>> Here is the JIRA:
>>>>>>> https://issues.apache.org/jira/browse/MAILET-163 Don't
>>>>>>> hesitate to PR this ;-)
>>>>>>>
>>>>>>> (Combined with a "not RemoteHostIs" you would achieve the
>>>>>>> rewritting you
>>>>>>> need)
>>>>>>>
>>>>>>> Cheers,
>>>>>>>
>>>>>>> Benoit TELLIER
>>>>>>>
>>>>>>>> On 1/30/19 4:13 PM, cryptearth wrote:
>>>>>>>> Hello Benoit,
>>>>>>>>
>>>>>>>> let me try to re-phrase my goal:
>>>>>>>>
>>>>>>>> I've set up a clean install of opensuse 15.0 on my test-rig,
>>>>>>>> named it
>>>>>>>> glados, assigned it to my domain cryptearth.de, set sendmail as
>>>>>>>> nullclient along with james 3.2.0 and want to collect any mail
>>>>>>>> dropped
>>>>>>>> by sendmail into a specific mailbox. The catch: As I also want
>>>>>>>> to use
>>>>>>>> sendmail to support mail() command for php, e-mails dropped in by
>>>>>>>> apache should be routed extern.
>>>>>>>>
>>>>>>>> So: sendmail dropps in mails depending on wich service calls it.
>>>>>>>> Cron
>>>>>>>> for example uses glados@glados.cryptearth.de - apache instead
>>>>>>>> wwwrun@localhost - and my guess is that other services might use
>>>>>>>> other
>>>>>>>> combinations as well.
>>>>>>>>
>>>>>>>> Goal: When a mail is dropped by apache, wich is set to
>>>>>>>> webmaster@cryptearth.de by using -f parameter in php.ini, these
>>>>>>>> mails
>>>>>>>> should go out as normal to they recipient. Any other mail should
>>>>>>>> get
>>>>>>>> collected into a special user, for example
>>>>>>>> local-services@cryptearth.de or so.
>>>>>>>>
>>>>>>>> What I disconvered yet: When the domain wich is used by sendmail is
>>>>>>>> not in the domain-list, james thinks it's an external domain and
>>>>>>>> tries
>>>>>>>> remote delivery. If the domain is in the domain-list, but not
>>>>>>>> the user
>>>>>>>> name - it fast fails to "no user". And if the user for the
>>>>>>>> domain is
>>>>>>>> also added it gets delivered into inbox without double in sent.
>>>>>>>> It's
>>>>>>>> that last one I want, but without adding any specific user for each
>>>>>>>> services wich may use sendmail to try to local-deliver
>>>>>>>> status-mails,
>>>>>>>> wich sendmail usual would drop into /var/mail or ~/mail (or what
>>>>>>>> ever
>>>>>>>> it is default to).
>>>>>>>>
>>>>>>>> I dug through mailets and recipient rewrite and got some hints, but
>>>>>>>> couldn't figure out some working yet. One think I come up with
>>>>>>>> is add
>>>>>>>> some to mailetcontainer wich re-writes recipient based on
>>>>>>>> remote-host,
>>>>>>>> wich for sendmail is localhost. Other idea I had: use some
>>>>>>>> re-write-rule based on local hostname, but you recommended against
>>>>>>>> using this way.
>>>>>>>>
>>>>>>>> Another possible what someone come up with: add my own few lines
>>>>>>>> into
>>>>>>>> source and re-build - but I don't know where to add as it's all
>>>>>>>> very
>>>>>>>> abstract and I'm not that pro of Java.
>>>>>>>>
>>>>>>>> Thanks to anyone in advance,
>>>>>>>>
>>>>>>>> Matt
>>>>>>>>
>>>>>>>>> Am 30.01.2019 um 05:15 schrieb Benoit Tellier:
>>>>>>>>> Hi Matt,
>>>>>>>>>
>>>>>>>>> I read the all thread but feel quite confuse about what you try to
>>>>>>>>> achieve.
>>>>>>>>>
>>>>>>>>> Could you describe it again? (`When ... Then ...` syntax can
>>>>>>>>> really
>>>>>>>>> help!)
>>>>>>>>>
>>>>>>>>> Don't be using regex rewrites - I guess nobody understand what
>>>>>>>>> it does.
>>>>>>>>>
>>>>>>>>> Maybe you are interested by domain rewrites? Or do you want
>>>>>>>>> that all
>>>>>>>>> mail received, whatever the recipient, goes to the same mailbox?
>>>>>>>>>
>>>>>>>>> Cheers,
>>>>>>>>>
>>>>>>>>> Benoit TELLIER
>>>>>>>>>
>>>>>>>>>> On 1/28/19 9:57 AM, cryptearth wrote:
>>>>>>>>>> Hey there, Matt here again.
>>>>>>>>>>
>>>>>>>>>> So, I think a found a possible solution without any
>>>>>>>>>> source-file mods
>>>>>>>>>> but
>>>>>>>>>> only clever mailet-config in mailetcontainer.xml.
>>>>>>>>>>
>>>>>>>>>> As I dug through the source I found the standard mailets for
>>>>>>>>>> RecipientIsLocal. Then I found RecipientIsRegex (I might need
>>>>>>>>>> some help
>>>>>>>>>> here). Also there is something called RewriteTable.
>>>>>>>>>>
>>>>>>>>>> I set up a fresh opensuse leap 15 - cron sends mails as
>>>>>>>>>> <user>@<hostname>.<domain> - so I set up a small test-script
>>>>>>>>>> and looked
>>>>>>>>>> at log while running james in console mode: when the
>>>>>>>>>> domainlist doesn't
>>>>>>>>>> contain <hostname>.<domain> but only <domain> james thinks that
>>>>>>>>>> <hostname>.<domain> is external and tries RemoteDelivery. So I
>>>>>>>>>> added
>>>>>>>>>> <hostname>.<domain> to domainlist. As I just had the domain,
>>>>>>>>>> but not
>>>>>>>>>> the
>>>>>>>>>> user, the mail is denied as user doesn't exists for the
>>>>>>>>>> domain. When I
>>>>>>>>>> add the user as <localuser>@<hostname>.<domain> it gets local
>>>>>>>>>> delivered
>>>>>>>>>> without additional copy in sent folder. So as I don't want to
>>>>>>>>>> set up a
>>>>>>>>>> user for each localuser, but also want to avoid fastfail I
>>>>>>>>>> come up
>>>>>>>>>> with:
>>>>>>>>>> What if I could early check for <whatever>@<hostname>.<domain>
>>>>>>>>>> and
>>>>>>>>>> could
>>>>>>>>>> just re-write it to an existing account in form of
>>>>>>>>>> <user>@<domain>?
>>>>>>>>>> When
>>>>>>>>>> recipient is re-written before RecipientIsLocal is checked,
>>>>>>>>>> then this
>>>>>>>>>> should trigger and just deliver any local mail from what ever
>>>>>>>>>> service to
>>>>>>>>>> the mailbox I want to.
>>>>>>>>>>
>>>>>>>>>> So I search through the source tree - but couldn't find
>>>>>>>>>> anything to
>>>>>>>>>> alter the recipient by mailet. All I found was the
>>>>>>>>>> recipientrewritetable.xml file and the AddRegexMapping command
>>>>>>>>>> available
>>>>>>>>>> in james-cli.sh. The xml-config doesn't seem to help, but the
>>>>>>>>>> AddRegexMapping command looks good, but I don't understand the
>>>>>>>>>> command
>>>>>>>>>> parameters:
>>>>>>>>>>
>>>>>>>>>> AddRegexMapping <user> <domain> <regex>
>>>>>>>>>>
>>>>>>>>>> Can someone get me some hint how to use this command? Or
>>>>>>>>>> where/how I
>>>>>>>>>> can
>>>>>>>>>> setup the recipient-rewrite before RecipientIsLocal is checked?
>>>>>>>>>>
>>>>>>>>>> Thanks in advance,
>>>>>>>>>>
>>>>>>>>>> Matt
>>>>>>>>>>
>>>>>>>>>>> Am 27.01.2019 um 15:20 schrieb cryptearth:
>>>>>>>>>>> So, as far as I dug through the code, it seems to come down to
>>>>>>>>>>> MailetContext.isLocalEmail(MailAddress) wich is checked by
>>>>>>>>>>> RecipientIsLocal (wich I guess also involve somehow a check of
>>>>>>>>>>> isLocalServer(Domain). In transport-processor there is the line
>>>>>>>>>>>
>>>>>>>>>>> <mailet match="RecipientIsLocal" class="LocalDelivery" />
>>>>>>>>>>>
>>>>>>>>>>> I looked into LocalDelivery.java, but I guess when this
>>>>>>>>>>> matches it's
>>>>>>>>>>> to late to perform the test I want to about where the mail
>>>>>>>>>>> comes from
>>>>>>>>>>> and where it should send. JamesMailetContext looks good, as it
>>>>>>>>>>> contains isLocalServer(Domain), wich should also used to check
>>>>>>>>>>> SenderIsLocal (wich shouldn't matter, as this test is
>>>>>>>>>>> performed by
>>>>>>>>>>> source 127.0.0.1). As far as I yet could identify, it all
>>>>>>>>>>> comes down
>>>>>>>>>>> to somehow tell the config, that whatever domain sendmail
>>>>>>>>>>> uses (it's
>>>>>>>>>>> either hostname or hostname.domain) is considered as
>>>>>>>>>>> localServer. The
>>>>>>>>>>> wild-card alias shouldn't be any harder to find or figure out
>>>>>>>>>>> as I
>>>>>>>>>>> simply have to rewrite anything that comes from local and is for
>>>>>>>>>>> local, but isn't in localUserList, is re-written to whatever
>>>>>>>>>>> address I
>>>>>>>>>>> want.
>>>>>>>>>>>
>>>>>>>>>>> I'll report back when I found the lines to alter.
>>>>>>>>>>>
>>>>>>>>>>> Matt
>>>>>>>>>>>
>>>>>>>>>>>> Am 26.01.2019 um 22:57 schrieb cryptearth:
>>>>>>>>>>>> Currently I'm just using out-of-the-box after clean build.
>>>>>>>>>>>> I'll have
>>>>>>>>>>>> a look at the mentioned class and the mailetcontainer. Maybe
>>>>>>>>>>>> I'll
>>>>>>>>>>>> find my way around. Good James is written in Java - the one
>>>>>>>>>>>> language
>>>>>>>>>>>> I really know.
>>>>>>>>>>>>
>>>>>>>>>>>> Thanks for the point in a possible direction. I'll report
>>>>>>>>>>>> back when I
>>>>>>>>>>>> got something usefull.
>>>>>>>>>>>>
>>>>>>>>>>>> Matt
>>>>>>>>>>>>
>>>>>>>>>>>> ---- Garry Hurley schrieb ----
>>>>>>>>>>>>
>>>>>>>>>>>> Matt, are you using a custom mailet, or working out of the
>>>>>>>>>>>> box? Take
>>>>>>>>>>>> a look at the source for LocalDelivery.java
>>>>>>>>>>>> <http://LocalDelivery.java>, and the configuration for local
>>>>>>>>>>>> mail in
>>>>>>>>>>>> your mailetcontainer.xml <http://mailetcontainer.xml> file.
>>>>>>>>>>>> You may
>>>>>>>>>>>> have to override some functionality to get the processing
>>>>>>>>>>>> you want.
>>>>>>>>>>>>
>>>>>>>>>>>> Sent from my iPhone
>>>>>>>>>>>>
>>>>>>>>>>>>> On Jan 26, 2019, at 9:36 AM, cryptearth
>>>>>>>>>>>>> <cryptearth@cryptearth.de
>>>>>>>>>>>> <ma...@cryptearth.de>> wrote:
>>>>>>>>>>>>> Hey there, Matt here.
>>>>>>>>>>>>>
>>>>>>>>>>>>> So I got sendmail working with james now (tried postfix,
>>>>>>>>>>>>> but it
>>>>>>>>>>>> always complains forwarding to localhost isn't supported as
>>>>>>>>>>>> there is
>>>>>>>>>>>> no option to ignore false loopback detection), and when used
>>>>>>>>>>>> from
>>>>>>>>>>>> apache with additional -f parameter all works good. But as
>>>>>>>>>>>> there're
>>>>>>>>>>>> other services might drop mail into local queue (crontab
>>>>>>>>>>>> specificly)
>>>>>>>>>>>> I noticed, that I'm still missing something. My goal is
>>>>>>>>>>>> somesort of
>>>>>>>>>>>> wildcard alias so that no matter from wich user sendmail gets a
>>>>>>>>>>>> message, except the one I use for apache, it should redirect
>>>>>>>>>>>> them
>>>>>>>>>>>> internally to one of the user-accounts inside james itself.
>>>>>>>>>>>> I guess
>>>>>>>>>>>> there would be a simple solution if would like all mails to get
>>>>>>>>>>>> forwareded, but I don't think there is a blacklist syntax so
>>>>>>>>>>>> that
>>>>>>>>>>>> mails from specific services with non-local recipients got
>>>>>>>>>>>> send out.
>>>>>>>>>>>>> Currently I'm using 3.2.0 <tel:3.2.0> final release commit.
>>>>>>>>>>>>> I also
>>>>>>>>>>>> looked into the mailetcontainer.xml
>>>>>>>>>>>> <http://mailetcontainer.xml> file
>>>>>>>>>>>> and I guess it's possible in there to specify this rule:
>>>>>>>>>>>>> redirect anything local, except address set in apache
>>>>>>>>>>>>> config, to
>>>>>>>>>>>> user X, otherwise when from apache with non-local target ->
>>>>>>>>>>>> transport
>>>>>>>>>>>>> Could anyone maybe give me a hint?
>>>>>>>>>>>>> Other solution: redirect anything local from sendmail to
>>>>>>>>>>>>> processing
>>>>>>>>>>>> and with another task process the mails like some short
>>>>>>>>>>>> lines of
>>>>>>>>>>>> additional Java.
>>>>>>>>>>>>> Matt
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>
>>>>>>>>>>>> To unsubscribe, e-mail:
>>>>>>>>>>>> server-user-unsubscribe@james.apache.org
>>>>>>>>>>>> <ma...@james.apache.org>
>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>> server-user-help@james.apache.org
>>>>>>>>>>>> <ma...@james.apache.org>
>>>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>
>>>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>> server-user-help@james.apache.org
>>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>
>>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>
>>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>>
>>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>>
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>>>> For additional commands, e-mail: server-user-help@james.apache.org
>>>>
>>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
>> For additional commands, e-mail: server-user-help@james.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
> For additional commands, e-mail: server-user-help@james.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: server-user-unsubscribe@james.apache.org
For additional commands, e-mail: server-user-help@james.apache.org