JAMES-2597 Create a Cassandra + ES + RabbitMQ + Swift + LDAP product
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/620576e1 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/620576e1 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/620576e1 Branch: refs/heads/master Commit: 620576e1104c3db1e315b4b12999a012859b554c Parents: 744c989 Author: datph <[email protected]> Authored: Tue Nov 20 15:38:04 2018 +0700 Committer: Benoit Tellier <[email protected]> Committed: Mon Nov 26 16:39:54 2018 +0700 ---------------------------------------------------------------------- .../guice/cassandra-rabbitmq-ldap-guice/pom.xml | 175 +++++++++++++++++++ .../CassandraRabbitMQLdapJamesServerMain.java | 44 +++++ .../CassandraRabbitMQLdapJamesServerTest.java | 90 ++++++++++ .../src/test/resources/dnsservice.xml | 29 +++ .../src/test/resources/domainlist.xml | 24 +++ .../test/resources/fakemailrepositorystore.xml | 31 ++++ .../src/test/resources/imapserver.xml | 54 ++++++ .../src/test/resources/keystore | Bin 0 -> 2245 bytes .../src/test/resources/ldif-files/Dockerfile | 3 + .../src/test/resources/ldif-files/populate.ldif | 11 ++ .../src/test/resources/lmtpserver.xml | 41 +++++ .../src/test/resources/mailetcontainer.xml | 111 ++++++++++++ .../src/test/resources/mailrepositorystore.xml | 31 ++++ .../src/test/resources/managesieveserver.xml | 65 +++++++ .../src/test/resources/pop3server.xml | 42 +++++ .../src/test/resources/smtpserver.xml | 102 +++++++++++ .../src/test/resources/usersrepository.xml | 31 ++++ server/container/guice/pom.xml | 7 + 18 files changed, 891 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/pom.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/pom.xml new file mode 100644 index 0000000..125adbb --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/pom.xml @@ -0,0 +1,175 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>james-server-guice</artifactId> + <groupId>org.apache.james</groupId> + <version>3.3.0-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <modelVersion>4.0.0</modelVersion> + + <name>Apache James :: Server :: Cassandra/Ldap with RabbitMQ - guice injection</name> + <description>An advanced email server - Cassandra/Ldap backend and RabbitMQ messaging with guice injection</description> + + <artifactId>james-server-cassandra-rabbitmq-ldap</artifactId> + <dependencies> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-backends-cassandra</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-backends-es</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>apache-james-backends-rabbitmq</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>blob-objectstorage</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>blob-objectstorage-guice</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-cassandra-guice</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-cassandra-ldap-guice</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-cassandra-ldap-guice</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-cassandra-rabbitmq-guice</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-cassandra-rabbitmq-guice</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-data-ldap-integration-testing</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-guice-common</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-guice-jmap</artifactId> + <type>test-jar</type> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-guice-rabbitmq</artifactId> + </dependency> + <dependency> + <groupId>org.apache.james</groupId> + <artifactId>james-server-testing</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.junit.jupiter</groupId> + <artifactId>junit-jupiter-api</artifactId> + <version>${junit.jupiter.version}</version> + <scope>test</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependencies</id> + <goals> + <goal>copy-dependencies</goal> + </goals> + <phase>package</phase> + <configuration> + <includeScope>compile</includeScope> + <includeScope>runtime</includeScope> + <outputDirectory>${project.build.directory}/${project.artifactId}.lib</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <executions> + <execution> + <id>default-jar</id> + <goals> + <goal>jar</goal> + </goals> + <configuration> + <finalName>${project.artifactId}</finalName> + <archive> + <manifest> + <addClasspath>true</addClasspath> + <classpathPrefix>${project.artifactId}.lib/</classpathPrefix> + <mainClass>org.apache.james.CassandraRabbitMQLdapJamesServerMain</mainClass> + <useUniqueVersions>false</useUniqueVersions> + </manifest> + </archive> + </configuration> + </execution> + <execution> + <id>test-jar</id> + <goals> + <goal>test-jar</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <reuseForks>true</reuseForks> + </configuration> + </plugin> + </plugins> + </build> + +</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/main/java/org/apache/james/CassandraRabbitMQLdapJamesServerMain.java ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/main/java/org/apache/james/CassandraRabbitMQLdapJamesServerMain.java b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/main/java/org/apache/james/CassandraRabbitMQLdapJamesServerMain.java new file mode 100644 index 0000000..0b59069 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/main/java/org/apache/james/CassandraRabbitMQLdapJamesServerMain.java @@ -0,0 +1,44 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.james; + +import org.apache.james.data.LdapUsersRepositoryModule; +import org.apache.james.modules.server.JMXServerModule; +import org.apache.james.server.core.configuration.Configuration; + +import com.google.inject.Module; +import com.google.inject.util.Modules; + +public class CassandraRabbitMQLdapJamesServerMain { + public static final Module MODULES = Modules + .override(CassandraRabbitMQJamesServerMain.MODULES) + .with(new LdapUsersRepositoryModule()); + + public static void main(String[] args) throws Exception { + Configuration configuration = Configuration.builder() + .useWorkingDirectoryEnvProperty() + .build(); + + GuiceJamesServer server = GuiceJamesServer.forConfiguration(configuration) + .combineWith(MODULES, new JMXServerModule()); + + server.start(); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/java/org/apache/james/CassandraRabbitMQLdapJamesServerTest.java ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/java/org/apache/james/CassandraRabbitMQLdapJamesServerTest.java b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/java/org/apache/james/CassandraRabbitMQLdapJamesServerTest.java new file mode 100644 index 0000000..2ed0203 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/java/org/apache/james/CassandraRabbitMQLdapJamesServerTest.java @@ -0,0 +1,90 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.james; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.awaitility.Duration.ONE_HUNDRED_MILLISECONDS; + +import java.io.IOException; + +import org.apache.commons.net.imap.IMAPClient; +import org.apache.james.core.Domain; +import org.apache.james.modules.RabbitMQExtension; +import org.apache.james.modules.SwiftBlobStoreExtension; +import org.apache.james.modules.TestJMAPServerModule; +import org.apache.james.modules.protocols.ImapGuiceProbe; +import org.apache.james.modules.protocols.SmtpGuiceProbe; +import org.apache.james.utils.IMAPMessageReader; +import org.apache.james.utils.SMTPMessageSender; +import org.apache.james.utils.SpoolerProbe; +import org.awaitility.Awaitility; +import org.awaitility.Duration; +import org.awaitility.core.ConditionFactory; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.RegisterExtension; + +public class CassandraRabbitMQLdapJamesServerTest implements JmapJamesServerContract { + private static final int LIMIT_TO_10_MESSAGES = 10; + private static final String JAMES_USER = "james-user"; + private static final String PASSWORD = "secret"; + private static Duration slowPacedPollInterval = ONE_HUNDRED_MILLISECONDS; + private static ConditionFactory calmlyAwait = Awaitility + .with().pollInterval(slowPacedPollInterval) + .and().with().pollDelay(slowPacedPollInterval) + .await(); + private IMAPClient imapClient = new IMAPClient(); + + @RegisterExtension + IMAPMessageReader imapMessageReader = new IMAPMessageReader(); + SMTPMessageSender messageSender = new SMTPMessageSender(Domain.LOCALHOST.asString()); + + @RegisterExtension + static JamesServerExtension testExtension = new JamesServerExtensionBuilder() + .extension(new EmbeddedElasticSearchExtension()) + .extension(new CassandraExtension()) + .extension(new RabbitMQExtension()) + .extension(new LdapTestExtention()) + .extension(new SwiftBlobStoreExtension()) + .server(configuration -> GuiceJamesServer.forConfiguration(configuration) + .combineWith(CassandraRabbitMQLdapJamesServerMain.MODULES) + .overrideWith(new TestJMAPServerModule(LIMIT_TO_10_MESSAGES)) + .overrideWith(DOMAIN_LIST_CONFIGURATION_MODULE)) + .build(); + + @Test + void userFromLdapShouldLoginViaImapProtocol(GuiceJamesServer server) throws IOException { + imapClient.connect(JAMES_SERVER_HOST, server.getProbe(ImapGuiceProbe.class).getImapPort()); + + assertThat(imapClient.login(JAMES_USER, PASSWORD)).isTrue(); + } + + @Test + void mailsShouldBeWellReceivedBeforeFirstUserConnectionWithLdap(GuiceJamesServer server) throws Exception { + messageSender.connect(JAMES_SERVER_HOST, server.getProbe(SmtpGuiceProbe.class).getSmtpPort()) + .sendMessage("[email protected]", JAMES_USER + "@localhost"); + + calmlyAwait.until(() -> server.getProbe(SpoolerProbe.class).processingFinished()); + + imapMessageReader.connect(JAMES_SERVER_HOST, server.getProbe(ImapGuiceProbe.class).getImapPort()) + .login(JAMES_USER, PASSWORD) + .select("INBOX") + .awaitMessage(calmlyAwait); + } +} http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/dnsservice.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/dnsservice.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/dnsservice.xml new file mode 100644 index 0000000..0978a00 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/dnsservice.xml @@ -0,0 +1,29 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<dnsservice> + <servers> + <server>8.8.8.8</server> + <server>62.210.16.6</server> + </servers> + <autodiscover>false</autodiscover> + <authoritative>false</authoritative> + <maxcachesize>50000</maxcachesize> +</dnsservice> http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/domainlist.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/domainlist.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/domainlist.xml new file mode 100644 index 0000000..fe17431 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/domainlist.xml @@ -0,0 +1,24 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<domainlist> + <autodetect>false</autodetect> + <autodetectIP>false</autodetectIP> +</domainlist> http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/fakemailrepositorystore.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/fakemailrepositorystore.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/fakemailrepositorystore.xml new file mode 100644 index 0000000..2d19a80 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/fakemailrepositorystore.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<mailrepositorystore> + <mailrepositories> + <mailrepository class="org.apache.james.mailrepository.None"> + <protocols> + <protocol>file</protocol> + </protocols> + <config FIFO="false" CACHEKEYS="true"/> + </mailrepository> + </mailrepositories> +</mailrepositorystore> http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/imapserver.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/imapserver.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/imapserver.xml new file mode 100644 index 0000000..509fdb3 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/imapserver.xml @@ -0,0 +1,54 @@ +<?xml version="1.0"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + + +<imapservers> + <imapserver enabled="true"> + <jmxName>imapserver</jmxName> + <bind>0.0.0.0:0</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <!-- To create a new keystore execute: + keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore + --> + <keystore>classpath://keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + </tls> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + </imapserver> + <imapserver enabled="true"> + <jmxName>imapserver-ssl</jmxName> + <bind>0.0.0.0:0</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="true"> + <!-- To create a new keystore execute: + keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore + --> + <keystore>classpath://keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + </tls> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + </imapserver> +</imapservers> http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/keystore ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/keystore b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/keystore new file mode 100644 index 0000000..536a6c7 Binary files /dev/null and b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/keystore differ http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/ldif-files/Dockerfile ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/ldif-files/Dockerfile b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/ldif-files/Dockerfile new file mode 100644 index 0000000..d889a35 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/ldif-files/Dockerfile @@ -0,0 +1,3 @@ +FROM dinkel/openldap:latest + +COPY populate.ldif /etc/ldap/prepopulate/prepop.ldif http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/ldif-files/populate.ldif ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/ldif-files/populate.ldif b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/ldif-files/populate.ldif new file mode 100644 index 0000000..9376a6c --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/ldif-files/populate.ldif @@ -0,0 +1,11 @@ +dn: ou=people, dc=james,dc=org +ou: people +objectClass: organizationalUnit + +dn: uid=james-user, ou=people, dc=james,dc=org +objectClass: inetOrgPerson +uid: james-user +cn: james-user +sn: james-user +userPassword: secret +description: James user http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/lmtpserver.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/lmtpserver.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/lmtpserver.xml new file mode 100644 index 0000000..7739071 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/lmtpserver.xml @@ -0,0 +1,41 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<lmtpservers> + + <lmtpserver enabled="true"> + <jmxName>lmtpserver</jmxName> + <!-- LMTP should not be reachable from outside your network so bind it to loopback--> + <bind>127.0.0.1:0</bind> + <connectionBacklog>200</connectionBacklog> + <connectiontimeout>1200</connectiontimeout> + <!-- Set the maximum simultaneous incoming connections for this service --> + <connectionLimit>0</connectionLimit> + <!-- Set the maximum simultaneous incoming connections per IP for this service --> + <connectionLimitPerIP>0</connectionLimitPerIP> + <!-- This sets the maximum allowed message size (in kilobytes) for this --> + <!-- LMTP service. If unspecified, the value defaults to 0, which means no limit. --> + <maxmessagesize>0</maxmessagesize> + <handlerchain> + <handler class="org.apache.james.lmtpserver.CoreCmdHandlerLoader"/> + </handlerchain> + </lmtpserver> + +</lmtpservers> http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailetcontainer.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailetcontainer.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailetcontainer.xml new file mode 100644 index 0000000..69d03e2 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailetcontainer.xml @@ -0,0 +1,111 @@ +<?xml version="1.0"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<mailetcontainer enableJmx="false"> + + <context> + <postmaster>[email protected]</postmaster> + </context> + + <spooler> + <threads>20</threads> + </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> + </processor> + + <processor state="error" enableJmx="false"> + <mailet match="All" class="Bounce"/> + <mailet match="All" class="ToRepository"> + <repositoryPath>file://var/mail/error/</repositoryPath> + </mailet> + </processor> + + + <processor state="transport" enableJmx="false"> + <matcher name="relay-allowed" match="org.apache.james.mailetcontainer.impl.matchers.Or"> + <matcher match="SMTPAuthSuccessful"/> + <matcher match="SMTPIsAuthNetwork"/> + <matcher match="SentByMailet"/> + <matcher match="org.apache.james.jmap.mailet.SentByJmap"/> + </matcher> + + <mailet match="All" class="RemoveMimeHeader"> + <name>bcc</name> + </mailet> + <mailet match="All" class="RecipientRewriteTable" /> + <mailet match="RecipientIsLocal" class="org.apache.james.jmap.mailet.VacationMailet"/> + <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> + <delayTime>5000, 100000, 500000</delayTime> + <maxRetries>25</maxRetries> + <maxDnsProblemRetries>0</maxDnsProblemRetries> + <deliveryThreads>10</deliveryThreads> + <sendpartial>true</sendpartial> + <bounceProcessor>bounces</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> + <mailet match="All" class="ToRepository"> + <repositoryPath>file://var/mail/address-error/</repositoryPath> + </mailet> + </processor> + + <processor state="relay-denied" enableJmx="false"> + <mailet match="All" class="Bounce"> + <attachment>none</attachment> + </mailet> + <mailet match="All" class="ToRepository"> + <repositoryPath>file://var/mail/relay-denied/</repositoryPath> + <notice>Warning: You are sending an e-mail to a remote server. You must be authentified to perform such an operation</notice> + </mailet> + </processor> + + <processor state="bounces" enableJmx="false"> + <mailet match="All" class="DSNBounce"> + <passThrough>false</passThrough> + </mailet> + </processor> + + </processors> + +</mailetcontainer> + + http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailrepositorystore.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailrepositorystore.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailrepositorystore.xml new file mode 100644 index 0000000..3ca4a1d --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/mailrepositorystore.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<mailrepositorystore> + <mailrepositories> + <mailrepository class="org.apache.james.mailrepository.file.FileMailRepository"> + <protocols> + <protocol>file</protocol> + </protocols> + <config FIFO="false" CACHEKEYS="true"/> + </mailrepository> + </mailrepositories> +</mailrepositorystore> http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/managesieveserver.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/managesieveserver.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/managesieveserver.xml new file mode 100644 index 0000000..eee4052 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/managesieveserver.xml @@ -0,0 +1,65 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<!-- + This template file can be used as example for James Server configuration + DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS +--> + +<!-- See http://james.apache.org/server/3/config.html for usage --> + +<managesieveservers> + + <managesieveserver enabled="true"> + + <jmxName>managesieveserver</jmxName> + + <bind>0.0.0.0:0</bind> + + <connectionBacklog>200</connectionBacklog> + + <tls socketTLS="false" startTLS="false"> + <!-- To create a new keystore execute: + keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore + --> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + <!-- The algorithm is optional and only needs to be specified when using something other + than the Sun JCE provider - You could use IbmX509 with IBM Java runtime. --> + <algorithm>SunX509</algorithm> + </tls> + + <!-- connection timeout in secconds --> + <connectiontimeout>360</connectiontimeout> + + <!-- Set the maximum simultaneous incoming connections for this service --> + <connectionLimit>0</connectionLimit> + + <!-- Set the maximum simultaneous incoming connections per IP for this service --> + <connectionLimitPerIP>0</connectionLimitPerIP> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + + </managesieveserver> + +</managesieveservers> + + http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/pop3server.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/pop3server.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/pop3server.xml new file mode 100644 index 0000000..595c313 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/pop3server.xml @@ -0,0 +1,42 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + + +<pop3servers> + <pop3server enabled="true"> + <jmxName>pop3server</jmxName> + <bind>0.0.0.0:0</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <!-- To create a new keystore execute: + keytool -genkey -alias james -keyalg RSA -keystore /path/to/james/conf/keystore + --> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + </tls> + <connectiontimeout>1200</connectiontimeout> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + <handlerchain> + <handler class="org.apache.james.pop3server.core.CoreCmdHandlerLoader"/> + </handlerchain> + </pop3server> +</pop3servers> http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/smtpserver.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/smtpserver.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/smtpserver.xml new file mode 100644 index 0000000..c348f04 --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/smtpserver.xml @@ -0,0 +1,102 @@ +<?xml version="1.0"?> + +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<smtpservers> + <smtpserver enabled="true"> + <jmxName>smtpserver-global</jmxName> + <bind>0.0.0.0:0</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + <algorithm>SunX509</algorithm> + </tls> + <connectiontimeout>360</connectiontimeout> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + <authRequired>false</authRequired> + <verifyIdentity>true</verifyIdentity> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting> + <handlerchain> + <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/> + <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/> + </handlerchain> + </smtpserver> + <smtpserver enabled="true"> + <jmxName>smtpserver-TLS</jmxName> + <bind>0.0.0.0:0</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + <algorithm>SunX509</algorithm> + </tls> + <connectiontimeout>360</connectiontimeout> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + <!-- + Authorize only local users + --> + <authRequired>true</authRequired> + <!-- Trust authenticated users --> + <verifyIdentity>false</verifyIdentity> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting> + <handlerchain> + <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/> + <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/> + </handlerchain> + </smtpserver> + <smtpserver enabled="true"> + <jmxName>smtpserver-authenticated</jmxName> + <bind>0.0.0.0:0</bind> + <connectionBacklog>200</connectionBacklog> + <tls socketTLS="false" startTLS="false"> + <keystore>file://conf/keystore</keystore> + <secret>james72laBalle</secret> + <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider> + <algorithm>SunX509</algorithm> + </tls> + <connectiontimeout>360</connectiontimeout> + <connectionLimit>0</connectionLimit> + <connectionLimitPerIP>0</connectionLimitPerIP> + <!-- + Authorize only local users + --> + <authRequired>true</authRequired> + <!-- Trust authenticated users --> + <verifyIdentity>false</verifyIdentity> + <maxmessagesize>0</maxmessagesize> + <addressBracketsEnforcement>true</addressBracketsEnforcement> + <smtpGreeting>JAMES Linagora's SMTP awesome Server</smtpGreeting> + <handlerchain> + <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/> + <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/> + </handlerchain> + </smtpserver> +</smtpservers> + + http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/usersrepository.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/usersrepository.xml b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/usersrepository.xml new file mode 100644 index 0000000..6b94f9a --- /dev/null +++ b/server/container/guice/cassandra-rabbitmq-ldap-guice/src/test/resources/usersrepository.xml @@ -0,0 +1,31 @@ +<?xml version="1.0"?> +<!-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + --> + +<!-- Read-Only LDAP based UsersRepository --> +<usersrepository name="LocalUsers" + ldapHost="ldap://myldapserver:389" + principal="cn=admin,dc=james,dc=org" + credentials="mysecretpassword" + userBase="ou=People,dc=james,dc=org" + userIdAttribute="uid" + maxRetries="4" + retryStartInterval="0" + retryMaxInterval="8" + retryIntervalScale="1000"/> http://git-wip-us.apache.org/repos/asf/james-project/blob/620576e1/server/container/guice/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/pom.xml b/server/container/guice/pom.xml index 114154f..3d2d561 100644 --- a/server/container/guice/pom.xml +++ b/server/container/guice/pom.xml @@ -38,6 +38,7 @@ <module>cassandra-guice</module> <module>cassandra-ldap-guice</module> <module>cassandra-rabbitmq-guice</module> + <module>cassandra-rabbitmq-ldap-guice</module> <module>configuration</module> <module>custom-mailets</module> <module>es-metric-reporter</module> @@ -76,6 +77,12 @@ <dependencies> <dependency> <groupId>${james.groupId}</groupId> + <artifactId>james-server-cassandra-ldap-guice</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + </dependency> + <dependency> + <groupId>${james.groupId}</groupId> <artifactId>james-server-guice-configuration</artifactId> <version>${project.version}</version> </dependency> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
