You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mina.apache.org by gn...@apache.org on 2014/06/16 10:25:43 UTC

git commit: [SSHD-320] The moduli file is embedded in the sshd-core jar and is not externalized at the moment

Repository: mina-sshd
Updated Branches:
  refs/heads/master b8c21ebc1 -> f3cac42ae


[SSHD-320] The moduli file is embedded in the sshd-core jar and is not externalized at the moment

Project: http://git-wip-us.apache.org/repos/asf/mina-sshd/repo
Commit: http://git-wip-us.apache.org/repos/asf/mina-sshd/commit/f3cac42a
Tree: http://git-wip-us.apache.org/repos/asf/mina-sshd/tree/f3cac42a
Diff: http://git-wip-us.apache.org/repos/asf/mina-sshd/diff/f3cac42a

Branch: refs/heads/master
Commit: f3cac42aeae0fcb3e509166191920da9af69a24e
Parents: b8c21eb
Author: Guillaume Nodet <gn...@apache.org>
Authored: Mon Jun 16 10:25:35 2014 +0200
Committer: Guillaume Nodet <gn...@apache.org>
Committed: Mon Jun 16 10:25:35 2014 +0200

----------------------------------------------------------------------
 .../java/org/apache/sshd/server/ServerFactoryManager.java   | 6 ++++++
 .../src/main/java/org/apache/sshd/server/kex/DHGEX.java     | 9 ++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/f3cac42a/sshd-core/src/main/java/org/apache/sshd/server/ServerFactoryManager.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/ServerFactoryManager.java b/sshd-core/src/main/java/org/apache/sshd/server/ServerFactoryManager.java
index 2f6a1e3..11e2d93 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/ServerFactoryManager.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/ServerFactoryManager.java
@@ -102,6 +102,12 @@ public interface ServerFactoryManager extends FactoryManager {
     public static final String REKEY_TIME_LIMIT = "rekey-time-limit";
 
     /**
+     * A URL pointing to the moduli file.
+     * If not specified, the default internal file will be used.
+     */
+    public static final String MODULI_URL = "moduli-url";
+
+    /**
      * Retrieve the list of named factories for <code>UserAuth<code> objects.
      *
      * @return a list of named <code>UserAuth</code> factories, never <code>null</code>

http://git-wip-us.apache.org/repos/asf/mina-sshd/blob/f3cac42a/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGEX.java
----------------------------------------------------------------------
diff --git a/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGEX.java b/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGEX.java
index 9353a60..b988ef9 100644
--- a/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGEX.java
+++ b/sshd-core/src/main/java/org/apache/sshd/server/kex/DHGEX.java
@@ -38,6 +38,7 @@ import org.apache.sshd.common.session.AbstractSession;
 import org.apache.sshd.common.util.Buffer;
 import org.apache.sshd.common.util.BufferUtils;
 import org.apache.sshd.common.util.SecurityUtils;
+import org.apache.sshd.server.ServerFactoryManager;
 import org.apache.sshd.server.session.ServerSession;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -218,7 +219,13 @@ public class DHGEX implements KeyExchange {
     }
 
     private DH chooseDH(int min, int prf, int max) throws Exception {
-        URL moduli = getClass().getResource("/org/apache/sshd/moduli");
+        URL moduli;
+        String moduliStr = session.getFactoryManager().getProperties().get(ServerFactoryManager.MODULI_URL);
+        if (moduliStr != null) {
+            moduli = new URL(moduliStr);
+        } else {
+            moduli = getClass().getResource("/org/apache/sshd/moduli");
+        }
         List<Moduli.DhGroup> groups = Moduli.parseModuli(moduli);
 
         min = Math.max(min, 1024);