From 566e49d7d39b12c785be24b8b61b4960a4b7ea17 Mon Sep 17 00:00:00 2001 From: Thomas Wolf Date: Sun, 26 Jul 2020 20:37:57 +0200 Subject: sshd: support the ProxyJump ssh config This is useful to access git repositories behind a bastion server (jump host). Add a constant for the config; rewrite the whole connection initiation to parse the value and (recursively) set up the chain of hops. Add tests for a single hop and two different ways to configure a two-hop chain. The connection timeout applies to each hop in the chain individually. Change-Id: Idd25af95aa2ec5367404587e4e530b0663c03665 Signed-off-by: Thomas Wolf --- .../org/eclipse/jgit/transport/SshConstants.java | 30 +++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/transport/SshConstants.java') diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshConstants.java b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshConstants.java index b1fac2cffb..fff2938e5d 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshConstants.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/transport/SshConstants.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2018 Thomas Wolf and others + * Copyright (C) 2018, 2020 Thomas Wolf and others * * This program and the accompanying materials are made available under the * terms of the Eclipse Distribution License v. 1.0 which is available at @@ -117,6 +117,34 @@ public final class SshConstants { /** Key in an ssh config file. */ public static final String PROXY_COMMAND = "ProxyCommand"; + /** + * Comma-separated list of jump hosts, defining a jump host chain in + * reverse order. Each jump host is a SSH URI or "[user@]host[:port]". + *

+ * Reverse order means: to connect A->B->target, one can do in + * {@code ~/.ssh/config} either of: + *

+ * + *
+	 * Host target
+	 *   ProxyJump B,A
+	 * 
+ *

+ * or + *

+ * + *
+	 * Host target
+	 *   ProxyJump B
+	 *
+	 * Host B
+	 *   ProxyJump A
+	 * 
+ * + * @since 5.10 + */ + public static final String PROXY_JUMP = "ProxyJump"; + /** Key in an ssh config file. */ public static final String REMOTE_COMMAND = "RemoteCommand"; -- cgit v1.2.3