You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by fe...@apache.org on 2011/08/10 07:50:38 UTC
svn commit: r1156034 - in /james/hupa/trunk:
server/src/main/java/org/apache/hupa/server/
server/src/main/java/org/apache/hupa/server/guice/
server/src/main/webapp/WEB-INF/conf/
server/src/test/java/org/apache/hupa/server/integration/ src/site/ src/sit...
Author: felixk
Date: Wed Aug 10 05:50:37 2011
New Revision: 1156034
URL: http://svn.apache.org/viewvc?rev=1156034&view=rev
Log:
Add configuration possibility for custom truststore (HUPA-70)
Added:
james/hupa/trunk/src/site/fml/
james/hupa/trunk/src/site/fml/faq.fml (with props)
Modified:
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/DemoModeConstants.java
james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServerTestModule.java
james/hupa/trunk/server/src/main/webapp/WEB-INF/conf/config.properties
james/hupa/trunk/server/src/test/java/org/apache/hupa/server/integration/StoreBugTest.java
james/hupa/trunk/src/site/site.xml
james/hupa/trunk/src/site/xdoc/configuration.xml
Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java?rev=1156034&r1=1156033&r2=1156034&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/InMemoryIMAPStoreCache.java Wed Aug 10 05:50:37 2011
@@ -50,7 +50,8 @@ public class InMemoryIMAPStoreCache impl
private boolean useSSL = false;
@Inject
- public InMemoryIMAPStoreCache(Log logger, @Named("IMAPServerAddress") String address, @Named("IMAPServerPort") int port, @Named("IMAPS") boolean useSSL, @Named("IMAPConnectionPoolSize") int connectionPoolSize, @Named("IMAPConnectionPoolTimeout") int timeout, @Named("SessionDebug") boolean debug, Provider<Session> sessionProvider) {
+ public InMemoryIMAPStoreCache(Log logger, @Named("IMAPServerAddress") String address, @Named("IMAPServerPort") int port, @Named("IMAPS") boolean useSSL, @Named("IMAPConnectionPoolSize") int connectionPoolSize, @Named("IMAPConnectionPoolTimeout") int timeout, @Named("SessionDebug") boolean debug,
+ @Named("TrustStore") String truststore, @Named("TrustStorePassword") String truststorePassword, Provider<Session> sessionProvider) {
this.logger = logger;
this.address = address;
this.port = port;
@@ -68,6 +69,12 @@ public class InMemoryIMAPStoreCache impl
props.setProperty("mail.store.protocol", "imaps");
props.setProperty("mail.imaps.connectionpoolsize", connectionPoolSize +"");
props.setProperty("mail.imaps.connectionpooltimeout", timeout + "");
+ if (!truststore.isEmpty()) {
+ System.setProperty("javax.net.ssl.trustStore", truststore);
+ }
+ if (!truststorePassword.isEmpty()) {
+ System.setProperty("javax.net.ssl.trustStorePassword", truststorePassword);
+ }
} else {
props.setProperty("mail.imap.connectionpoolsize", connectionPoolSize + "");
props.setProperty("mail.imap.connectionpooltimeout", timeout + "");
Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/DemoModeConstants.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/DemoModeConstants.java?rev=1156034&r1=1156033&r2=1156034&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/DemoModeConstants.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/DemoModeConstants.java Wed Aug 10 05:50:37 2011
@@ -43,6 +43,9 @@ public class DemoModeConstants {
put("IMAPServerPort", "143");
put("IMAPS", "false");
+ put("TrustStore", "my-truststore");
+ put("TrustStorePassword", "my-truststore-password");
+
put("SMTPServerAddress", DEMO_MODE);
put("SMTPServerPort", "25");
put("SMTPS", "false");
Modified: james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServerTestModule.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServerTestModule.java?rev=1156034&r1=1156033&r2=1156034&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServerTestModule.java (original)
+++ james/hupa/trunk/server/src/main/java/org/apache/hupa/server/guice/GuiceServerTestModule.java Wed Aug 10 05:50:37 2011
@@ -154,7 +154,10 @@ public class GuiceServerTestModule exten
put("IMAPServerAddress", "localhost");
put("IMAPServerPort", "143");
- put("IMAPS", "fase");
+ put("IMAPS", "false");
+
+ put("TrustStore", "my-truststore");
+ put("TrustStorePassword", "my-truststore-password");
put("IMAPConnectionPoolSize", "4");
put("IMAPConnectionPoolTimeout", "300000");
@@ -191,7 +194,10 @@ public class GuiceServerTestModule exten
put("IMAPServerAddress", "localhost");
put("IMAPServerPort", "143");
- put("IMAPS", "fase");
+ put("IMAPS", "false");
+
+ put("TrustStore", "my-truststore");
+ put("TrustStorePassword", "my-truststore-password");
put("IMAPConnectionPoolSize", "4");
put("IMAPConnectionPoolTimeout", "300000");
@@ -229,6 +235,9 @@ public class GuiceServerTestModule exten
put("IMAPServerPort", "993");
put("IMAPS", "true");
+ put("TrustStore", "my-truststore");
+ put("TrustStorePassword", "my-truststore-password");
+
put("IMAPConnectionPoolSize", "4");
put("IMAPConnectionPoolTimeout", "300000");
Modified: james/hupa/trunk/server/src/main/webapp/WEB-INF/conf/config.properties
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/main/webapp/WEB-INF/conf/config.properties?rev=1156034&r1=1156033&r2=1156034&view=diff
==============================================================================
--- james/hupa/trunk/server/src/main/webapp/WEB-INF/conf/config.properties (original)
+++ james/hupa/trunk/server/src/main/webapp/WEB-INF/conf/config.properties Wed Aug 10 05:50:37 2011
@@ -9,6 +9,10 @@ IMAPConnectionPoolSize=4
IMAPConnectionPoolTimeout=300000
# Use SSL/TLS to connect to the IMAP server
IMAPS=true
+# The Truststore when using self-signed certificates on the server
+TrustStore=my-truststore
+# The Truststore's password
+TrustStorePassword=changeit
DefaultSentFolder=[Gmail]\Sent
DefaultTrashFolder=[Gmail]\Trash
Modified: james/hupa/trunk/server/src/test/java/org/apache/hupa/server/integration/StoreBugTest.java
URL: http://svn.apache.org/viewvc/james/hupa/trunk/server/src/test/java/org/apache/hupa/server/integration/StoreBugTest.java?rev=1156034&r1=1156033&r2=1156034&view=diff
==============================================================================
--- james/hupa/trunk/server/src/test/java/org/apache/hupa/server/integration/StoreBugTest.java (original)
+++ james/hupa/trunk/server/src/test/java/org/apache/hupa/server/integration/StoreBugTest.java Wed Aug 10 05:50:37 2011
@@ -47,12 +47,15 @@ public class StoreBugTest {
static final String imapUser = "nobody@gmail.com";
static final String imapPass = "******";
static final boolean isSSl = true;
+ static final String truststore = "";
+ static final String truststorePassword = "";
static int nthreads = 5;
static int threadTimeout = 15000;
Session session = Session.getDefaultInstance(new Properties(), null);
- static InMemoryIMAPStoreCache cache = new InMemoryIMAPStoreCache(new MockLog(), imapServer, imapPort, isSSl, 2, 60000, false, new SessionProvider());
+ static InMemoryIMAPStoreCache cache = new InMemoryIMAPStoreCache(new MockLog(), imapServer, imapPort, isSSl, 2, 60000, false,
+ truststore, truststorePassword, new SessionProvider());
static User user = new User() {
private static final long serialVersionUID = 1L;
{setName(imapUser); setPassword(imapPass);}
Added: james/hupa/trunk/src/site/fml/faq.fml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/src/site/fml/faq.fml?rev=1156034&view=auto
==============================================================================
--- james/hupa/trunk/src/site/fml/faq.fml (added)
+++ james/hupa/trunk/src/site/fml/faq.fml Wed Aug 10 05:50:37 2011
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ 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.
+-->
+<faqs xmlns="http://maven.apache.org/FML/1.0.1"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/FML/1.0.1 http://maven.apache.org/xsd/fml-1.0.1.xsd"
+ title="Frequently Asked Questions"
+ toplink="true">
+
+ <part id="general">
+ <title>General</title>
+
+ <faq id="add-cert-to-cacert">
+ <question>How do I import a public key to Java's cacert?</question>
+ <answer>
+ <p>
+ This can be done using the keytool application distributed with your Java installation:
+ </p>
+ <source>keytool -import -alias mail.yourcompany.com -keystore $JAVA_HOME/jre/lib/security/cacerts -file public-server-cert.pem</source>
+ <p>The default password for a java keystore is <code>changeit</code></p>
+ </answer>
+ </faq>
+
+ <faq id="add-cert-to-custom-truststore">
+ <question>How do I add a public key to a custom truststore?</question>
+ <answer>
+ <p>
+ This can be done using the keytool application distributed with your Java installation:
+ </p>
+ <source>keytool -import -alias mail.yourcompany.com -keystore {some-path}/your-truststore -file public-server-cert.pem</source>
+ <p>The default password for a java keystore is <code>changeit</code></p>
+ </answer>
+ </faq>
+ </part>
+</faqs>
\ No newline at end of file
Propchange: james/hupa/trunk/src/site/fml/faq.fml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: james/hupa/trunk/src/site/fml/faq.fml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Modified: james/hupa/trunk/src/site/site.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/src/site/site.xml?rev=1156034&r1=1156033&r2=1156034&view=diff
==============================================================================
--- james/hupa/trunk/src/site/site.xml (original)
+++ james/hupa/trunk/src/site/site.xml Wed Aug 10 05:50:37 2011
@@ -46,6 +46,7 @@
<item name="Overview" href="/index.html" />
<item name="Screenshots" href="/screenshots.html" />
<item name="Configuration" href="/configuration.html" />
+ <item name="FAQs" href="/faq.html" />
</menu>
<menu name="Get Involved" inherit="top">
<item name="Setup" href="/dev/environment.html" />
Modified: james/hupa/trunk/src/site/xdoc/configuration.xml
URL: http://svn.apache.org/viewvc/james/hupa/trunk/src/site/xdoc/configuration.xml?rev=1156034&r1=1156033&r2=1156034&view=diff
==============================================================================
--- james/hupa/trunk/src/site/xdoc/configuration.xml (original)
+++ james/hupa/trunk/src/site/xdoc/configuration.xml Wed Aug 10 05:50:37 2011
@@ -72,6 +72,16 @@
<td>Use SSL/TLS to connect to the IMAP server</td>
</tr>
<tr>
+ <td>TrustStore</td>
+ <td>my-truststore</td>
+ <td>The Truststore when using self-signed certificates on the server</td>
+ </tr>
+ <tr>
+ <td>TrustStorePassword</td>
+ <td>changeit</td>
+ <td>The Truststore's password</td>
+ </tr>
+ <tr>
<td>DefaultSentFolder</td>
<td>[Gmail]\Sent</td>
<td></td>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org