You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/02/02 08:17:49 UTC

[james-project] branch master updated (d4e3782 -> 6b4fca0)

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git.


    from d4e3782  [ADR] JMAP PUSH over WebSockets
     new aaeee02  [TEST SPEED] Minimize configuration to optimize boot time
     new 8c337b2  JAMES-3496 Update ActiveMQ and Artemis
     new 6c5f4a5  JAMES-2114 Improve MDC logging context for SMTP LMTP and POP3
     new 6b4fca0  JAMES-3444 Perform JMAP TransportChecks only when JMAP is enabled

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 pom.xml                                            |  4 +-
 .../james/imap/processor/LoginProcessor.java       |  2 +-
 .../protocols/netty/ProtocolMDCContextFactory.java |  3 +-
 .../protocols/smtp/core/SMTPMDCContextFactory.java |  4 +-
 .../modules/server/CamelMailetContainerModule.java |  9 ++++
 .../org/apache/james/jmap/draft/JMAPModule.java    | 37 ++++++++++-----
 .../src/test/resources/listeners.xml               | 24 ----------
 .../src/test/resources/mailetcontainer.xml         | 53 ++--------------------
 8 files changed, 45 insertions(+), 91 deletions(-)


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


[james-project] 03/04: JAMES-2114 Improve MDC logging context for SMTP LMTP and POP3

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 6c5f4a5fe218984b65175cdf903afb5ec4ad4748
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Jan 29 18:20:53 2021 +0700

    JAMES-2114 Improve MDC logging context for SMTP LMTP and POP3
---
 .../src/main/java/org/apache/james/imap/processor/LoginProcessor.java | 2 +-
 .../org/apache/james/protocols/netty/ProtocolMDCContextFactory.java   | 3 ++-
 .../org/apache/james/protocols/smtp/core/SMTPMDCContextFactory.java   | 4 +++-
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
index 568a245..b5df53c 100644
--- a/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
+++ b/protocols/imap/src/main/java/org/apache/james/imap/processor/LoginProcessor.java
@@ -72,7 +72,7 @@ public class LoginProcessor extends AbstractAuthProcessor<LoginRequest> implemen
     protected Closeable addContextToMDC(LoginRequest request) {
         return MDCBuilder.create()
             .addContext(MDCBuilder.ACTION, "LOGIN")
-            .addContext(MDCBuilder.USER, request.getUserid())
+            .addContext(MDCBuilder.USER, request.getUserid().asString())
             .build();
     }
 }
diff --git a/protocols/netty/src/main/java/org/apache/james/protocols/netty/ProtocolMDCContextFactory.java b/protocols/netty/src/main/java/org/apache/james/protocols/netty/ProtocolMDCContextFactory.java
index 17a34cc..d277b08 100644
--- a/protocols/netty/src/main/java/org/apache/james/protocols/netty/ProtocolMDCContextFactory.java
+++ b/protocols/netty/src/main/java/org/apache/james/protocols/netty/ProtocolMDCContextFactory.java
@@ -24,6 +24,7 @@ import java.net.InetSocketAddress;
 import java.net.SocketAddress;
 import java.util.Optional;
 
+import org.apache.james.core.Username;
 import org.apache.james.protocols.api.Protocol;
 import org.apache.james.protocols.api.ProtocolSession;
 import org.apache.james.util.MDCBuilder;
@@ -77,7 +78,7 @@ public interface ProtocolMDCContextFactory {
         return MDCBuilder.create()
             .addContext(MDCBuilder.SESSION_ID, protocolSession.getSessionID())
             .addContext(MDCBuilder.CHARSET, protocolSession.getCharset().displayName())
-            .addContext(MDCBuilder.USER, protocolSession.getUsername());
+            .addContext(MDCBuilder.USER, Optional.ofNullable(protocolSession.getUsername()).map(Username::asString));
     }
 
 }
diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/SMTPMDCContextFactory.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/SMTPMDCContextFactory.java
index 87f7d94..58fbe85 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/SMTPMDCContextFactory.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/SMTPMDCContextFactory.java
@@ -22,6 +22,7 @@ package org.apache.james.protocols.smtp.core;
 import java.io.Closeable;
 import java.util.Optional;
 
+import org.apache.james.core.MaybeSender;
 import org.apache.james.protocols.api.Protocol;
 import org.apache.james.protocols.api.ProtocolSession;
 import org.apache.james.protocols.netty.ProtocolMDCContextFactory;
@@ -55,7 +56,8 @@ public class SMTPMDCContextFactory implements ProtocolMDCContextFactory {
     private static MDCBuilder forSMTPSession(SMTPSession smtpSession) {
         return MDCBuilder.create()
             .addContext("ehlo", smtpSession.getAttachment(SMTPSession.CURRENT_HELO_NAME, ProtocolSession.State.Connection))
-            .addContext("sender", smtpSession.getAttachment(SMTPSession.SENDER, ProtocolSession.State.Transaction))
+            .addContext("sender", smtpSession.getAttachment(SMTPSession.SENDER, ProtocolSession.State.Transaction)
+                .map(MaybeSender::asString))
             .addContext("recipients", smtpSession.getAttachment(SMTPSession.RCPT_LIST, ProtocolSession.State.Transaction));
     }
 }


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


[james-project] 01/04: [TEST SPEED] Minimize configuration to optimize boot time

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit aaeee02a363c6f266dca6d88ea8fe20240af84a3
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Jan 29 10:35:28 2021 +0700

    [TEST SPEED] Minimize configuration to optimize boot time
    
    25% speedup on my laptop, which encourages me running the wall test suite more often
    (1 minute gained)
---
 .../src/test/resources/listeners.xml               | 24 ----------
 .../src/test/resources/mailetcontainer.xml         | 53 ++--------------------
 2 files changed, 3 insertions(+), 74 deletions(-)

diff --git a/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/listeners.xml b/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/listeners.xml
index a1a139d..ddc4d9d 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/listeners.xml
+++ b/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/listeners.xml
@@ -20,30 +20,6 @@
 
 <listeners>
   <listener>
-    <class>org.apache.james.mailbox.quota.mailing.listeners.QuotaThresholdCrossingListener</class>
-    <group>QuotaThresholdCrossingListener-lower-threshold</group>
-    <configuration>
-      <thresholds>
-        <threshold>
-          <value>0.1</value>
-        </threshold>
-      </thresholds>
-      <name>first</name>
-    </configuration>
-  </listener>
-  <listener>
-    <class>org.apache.james.mailbox.quota.mailing.listeners.QuotaThresholdCrossingListener</class>
-    <group>QuotaThresholdCrossingListener-upper-threshold</group>
-    <configuration>
-      <thresholds>
-        <threshold>
-          <value>0.2</value>
-        </threshold>
-      </thresholds>
-      <name>second</name>
-    </configuration>
-  </listener>
-  <listener>
     <class>org.apache.james.jmap.event.PopulateEmailQueryViewListener</class>
     <async>true</async>
   </listener>
diff --git a/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/mailetcontainer.xml b/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/mailetcontainer.xml
index 47a6b82..d77c378 100644
--- a/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/mailetcontainer.xml
+++ b/server/protocols/jmap-rfc-8621-integration-tests/memory-jmap-rfc-8621-integration-tests/src/test/resources/mailetcontainer.xml
@@ -31,10 +31,7 @@
     </spooler>
 
     <processors>
-
         <processor state="root" enableJmx="false">
-            <mailet match="All" class="PostmasterAlias"/>
-            <mailet match="RelayLimit=30" class="Null"/>
             <mailet match="All" class="ToProcessor">
                 <processor>transport</processor>
             </mailet>
@@ -59,30 +56,15 @@
             <mailet match="All" class="RemoveMimeHeader">
                 <name>bcc</name>
             </mailet>
-            <mailet match="All" class="ICSSanitizer"/>
-            <mailet match="All" class="org.apache.james.jmap.mailet.TextCalendarBodyToAttachment"/>
             <mailet match="All" class="RecipientRewriteTable">
-                <errorProcessor>rrt-error</errorProcessor>
+                <errorProcessor>error</errorProcessor>
             </mailet>
             <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/>
             <mailet match="mdn-matcher" class="org.apache.james.jmap.mailet.ExtractMDNOriginalJMAPMessageId" >
                 <onMailetException>ignore</onMailetException>
             </mailet>
-            <mailet match="RecipientIsLocal" class="Sieve"/>
-            <mailet match="RecipientIsLocal" class="SpamAssassin">
-                <onMailetException>ignore</onMailetException>
-                <spamdHost>localhost</spamdHost>
-                <spamdPort>783</spamdPort>
-            </mailet>
-            <mailet match="IsMarkedAsSpam" class="WithStorageDirective">
-                <targetFolderName>Spam</targetFolderName>
-            </mailet>
             <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.filter.JMAPFiltering"/>
             <mailet match="RecipientIsLocal" class="LocalDelivery"/>
-            <mailet match="HostIsLocal" class="ToProcessor">
-                <processor>local-address-error</processor>
-                <notice>550 - Requested action not taken: no such user here</notice>
-            </mailet>
 
             <mailet match="relay-allowed" class="RemoteDelivery">
                 <outgoingQueue>outgoing</outgoingQueue>
@@ -91,43 +73,14 @@
                 <maxDnsProblemRetries>0</maxDnsProblemRetries>
                 <deliveryThreads>10</deliveryThreads>
                 <sendpartial>true</sendpartial>
-                <bounceProcessor>bounces</bounceProcessor>
+                <bounceProcessor>error</bounceProcessor>
             </mailet>
 
             <mailet match="All" class="ToProcessor">
-                <processor>relay-denied</processor>
-            </mailet>
-        </processor>
-
-        <processor state="local-address-error" enableJmx="false">
-            <mailet match="All" class="Bounce">
-                <attachment>none</attachment>
-            </mailet>
-        </processor>
-
-        <processor state="relay-denied" enableJmx="false">
-            <mailet match="All" class="Bounce">
-                <attachment>none</attachment>
-            </mailet>
-        </processor>
-
-        <processor state="bounces" enableJmx="false">
-            <mailet match="All" class="DSNBounce">
-                <passThrough>false</passThrough>
-            </mailet>
-        </processor>
-
-        <processor state="rrt-error" enableJmx="false">
-            <mailet match="All" class="ToRepository">
-                <repositoryPath>memory://var/mail/rrt-error/</repositoryPath>
-                <passThrough>true</passThrough>
+                <processor>error</processor>
             </mailet>
-            <mailet match="IsSenderInRRTLoop" class="Null"/>
-            <mailet match="All" class="Bounce"/>
         </processor>
-
     </processors>
-
 </mailetcontainer>
 
 


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


[james-project] 04/04: JAMES-3444 Perform JMAP TransportChecks only when JMAP is enabled

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 6b4fca05402880a69c1c39e72afaa3d32ad36550
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Jan 29 23:52:27 2021 +0700

    JAMES-3444 Perform JMAP TransportChecks only when JMAP is enabled
    
    On gitter with one of our users:
    
    https://github.com/devnewton reported:
    
    {code:java}
    Hello, I try to setup Apache James + Cassandra + LDAP following the documentation and Dockerfile configuration sample.
    
    James crash at startup because of missing something related to JMAP: Missing org.apache.james.jmap.mailet.filter.JMAPFiltering in mailets configuration (mailetcontainer -> processors -> transport).
    
    I tried to disable this protocol using enabled=false in conf/jmap.properties but it has no effect.
    {code}
    
    The short term solution for him is to had the missing mailet.
    
    But does it even make sense, when JMAP is disabled, to require
    people to configure JMAP mailets?
    
    Maybe we should relax the checks and only perform them only when
    JMAP is enabled. This should result in an easier to use mail server.
---
 .../modules/server/CamelMailetContainerModule.java |  9 ++++++
 .../org/apache/james/jmap/draft/JMAPModule.java    | 37 +++++++++++++++-------
 2 files changed, 34 insertions(+), 12 deletions(-)

diff --git a/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java b/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
index 0364045..4706a65 100644
--- a/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
+++ b/server/container/guice/mailet/src/main/java/org/apache/james/modules/server/CamelMailetContainerModule.java
@@ -241,6 +241,15 @@ public class CamelMailetContainerModule extends AbstractModule {
 
     @FunctionalInterface
     public interface ProcessorsCheck {
+        static ProcessorsCheck noCheck() {
+            return new ProcessorsCheck() {
+                @Override
+                public void check(Multimap<String, MatcherMailetPair> processors) {
+
+                }
+            };
+        }
+
         void check(Multimap<String, MatcherMailetPair> processors) throws ConfigurationException;
 
         class Or implements ProcessorsCheck {
diff --git a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPModule.java b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPModule.java
index 9c5b19c..7185537 100644
--- a/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPModule.java
+++ b/server/container/guice/protocols/jmap/src/main/java/org/apache/james/jmap/draft/JMAPModule.java
@@ -52,6 +52,7 @@ import org.apache.james.mailbox.MailboxManager;
 import org.apache.james.mailbox.MailboxManager.SearchCapabilities;
 import org.apache.james.mailbox.events.MailboxListener;
 import org.apache.james.modules.server.CamelMailetContainerModule;
+import org.apache.james.modules.server.CamelMailetContainerModule.ProcessorsCheck;
 import org.apache.james.queue.api.MailQueueItemDecoratorFactory;
 import org.apache.james.server.core.configuration.FileConfigurationProvider;
 import org.apache.james.transport.matchers.All;
@@ -86,23 +87,23 @@ public class JMAPModule extends AbstractModule {
                 throw new RuntimeException(e);
             }
         };
-    public static final CamelMailetContainerModule.ProcessorsCheck VACATION_MAILET_CHECK =
-        CamelMailetContainerModule.ProcessorsCheck.Or.of(
-            new CamelMailetContainerModule.ProcessorsCheck.Impl(
+    public static final ProcessorsCheck VACATION_MAILET_CHECK =
+        ProcessorsCheck.Or.of(
+            new ProcessorsCheck.Impl(
                 Mail.TRANSPORT,
                 RecipientIsLocal.class,
                 VacationMailet.class),
-            new CamelMailetContainerModule.ProcessorsCheck.Impl(
+            new ProcessorsCheck.Impl(
                 Mail.LOCAL_DELIVERY,
                 All.class,
                 VacationMailet.class));
-    public static final CamelMailetContainerModule.ProcessorsCheck FILTERING_MAILET_CHECK =
-        CamelMailetContainerModule.ProcessorsCheck.Or.of(
-        new CamelMailetContainerModule.ProcessorsCheck.Impl(
+    public static final ProcessorsCheck FILTERING_MAILET_CHECK =
+        ProcessorsCheck.Or.of(
+        new ProcessorsCheck.Impl(
             Mail.TRANSPORT,
             RecipientIsLocal.class,
             JMAPFiltering.class),
-        new CamelMailetContainerModule.ProcessorsCheck.Impl(
+        new ProcessorsCheck.Impl(
             Mail.LOCAL_DELIVERY,
             All.class,
             JMAPFiltering.class));
@@ -123,10 +124,6 @@ public class JMAPModule extends AbstractModule {
         bind(HtmlTextExtractor.class).to(JsoupHtmlTextExtractor.class);
         Multibinder.newSetBinder(binder(), StartUpCheck.class).addBinding().to(RequiredCapabilitiesStartUpCheck.class);
 
-        Multibinder<CamelMailetContainerModule.ProcessorsCheck> transportProcessorChecks = Multibinder.newSetBinder(binder(), CamelMailetContainerModule.ProcessorsCheck.class);
-        transportProcessorChecks.addBinding().toInstance(VACATION_MAILET_CHECK);
-        transportProcessorChecks.addBinding().toInstance(FILTERING_MAILET_CHECK);
-
         bind(MailQueueItemDecoratorFactory.class).to(PostDequeueDecoratorFactory.class).in(Scopes.SINGLETON);
 
         Multibinder.newSetBinder(binder(), MailboxListener.GroupMailboxListener.class).addBinding().to(PropagateLookupRightListener.class);
@@ -145,6 +142,22 @@ public class JMAPModule extends AbstractModule {
     }
 
     @ProvidesIntoSet
+    ProcessorsCheck vacationMailetCheck(JMAPConfiguration configuration) {
+        if (configuration.isEnabled()) {
+            return VACATION_MAILET_CHECK;
+        }
+        return ProcessorsCheck.noCheck();
+    }
+
+    @ProvidesIntoSet
+    ProcessorsCheck filteringMailetCheck(JMAPConfiguration configuration) {
+        if (configuration.isEnabled()) {
+            return FILTERING_MAILET_CHECK;
+        }
+        return ProcessorsCheck.noCheck();
+    }
+
+    @ProvidesIntoSet
     Capability coreCapability(JmapRfc8621Configuration configuration) {
         return DefaultCapabilities.coreCapability(configuration.maxUploadSize());
     }


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


[james-project] 02/04: JAMES-3496 Update ActiveMQ and Artemis

Posted by bt...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 8c337b2db3bb089884e29bc3c90167a2c0756184
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Jan 29 11:45:20 2021 +0700

    JAMES-3496 Update ActiveMQ and Artemis
    
    Several CVE had been announced by the ActiveMQ PMC, namely:
    
     - CVE-2021-26118: Flaw in ActiveMQ Artemis OpenWire support
     - CVE-2021-26117: ActiveMQ: LDAP-Authentication does not verify passwords on servers with anonymous bind
    
    We do not use these features thus JAMES server is unaffected however updating these components seems like to be a good idea to me.
---
 pom.xml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/pom.xml b/pom.xml
index dbb7bc0..b0ee013 100644
--- a/pom.xml
+++ b/pom.xml
@@ -587,7 +587,7 @@
 
         <james.groupId>org.apache.james</james.groupId>
         <james.protocols.groupId>${james.groupId}.protocols</james.protocols.groupId>
-        <activemq.version>5.15.9</activemq.version>
+        <activemq.version>5.16.1</activemq.version>
         <apache-mime4j.version>0.8.3</apache-mime4j.version>
         <apache.openjpa.version>3.1.0</apache.openjpa.version>
         <camel.version>2.24.1</camel.version>
@@ -598,7 +598,7 @@
         <javax.activation.artifactId>activation</javax.activation.artifactId>
         <jsieve.version>0.7</jsieve.version>
         <spring.version>4.3.25.RELEASE</spring.version>
-        <activmq-artemis.version>2.9.0</activmq-artemis.version>
+        <activmq-artemis.version>2.16.0</activmq-artemis.version>
         <apache-jspf-resolver.version>1.0.1</apache-jspf-resolver.version>
         <javamail.version>1.5.4</javamail.version>
         <javax-activation.version>1.1.1</javax-activation.version>


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