Merge branch 'stable-5.2'

* stable-5.2:
  Format lib/BUILD with buildifier
  Update Orbit to S20181128170323 for 2018-12 RC1
  Include id_ed25519 in the known default identity files
  Apache MINA sshd client: enable support for ed25519 keys
  Prepare 5.2.0-SNAPSHOT builds
  Set git environment variables for hooks
  JGit v5.2.0.201811281532-m3

Change-Id: If96adcbf35ccf8d9f4da0f5d97491f502f5a72a9
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
Matthias Sohn 2018-12-03 02:32:05 +01:00
commit 13afcf75fe
26 changed files with 92 additions and 26 deletions

View File

@ -22,6 +22,12 @@ load(
"maven_jar",
)
maven_jar(
name = "eddsa",
artifact = "net.i2p.crypto:eddsa:0.3.0",
sha1 = "1901c8d4d8bffb7d79027686cfb91e704217c3e1",
)
maven_jar(
name = "jsch",
artifact = "com.jcraft:jsch:0.1.54",

View File

@ -27,6 +27,15 @@ java_library(
exports = ["@commons-logging//jar"],
)
java_library(
name = "eddsa",
visibility = [
"//org.eclipse.jgit.ssh.apache:__pkg__",
"//org.eclipse.jgit.ssh.apache.test:__pkg__",
],
exports = ["@eddsa//jar"],
)
java_library(
name = "gson",
visibility = [
@ -163,9 +172,9 @@ java_library(
testonly = 1,
visibility = ["//visibility:public"],
exports = [
"@mockito//jar",
"@byte_buddy//jar",
"@byte_buddy_agent//jar",
"@mockito//jar",
"@objenesis//jar",
],
)

View File

@ -47,4 +47,11 @@
version="0.0.0"
unpack="false"/>
<plugin
id="net.i2p.crypto.eddsa"
download-size="0"
install-size="0"
version="0.0.0"
unpack="false"/>
</feature>

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.9-staging" sequenceNumber="1543418361">
<target name="jgit-4.9-staging" sequenceNumber="1543791695">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.11.v20180605"/>
@ -76,7 +76,7 @@
<unit id="org.apache.sshd.core.source" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp.source" version="2.0.0.v20181102-1323"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/I20181128011035/repository"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20181128170323/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>

View File

@ -1,7 +1,7 @@
target "jgit-4.9-staging" with source configurePhase
include "projects/jetty-9.4.11.tpd"
include "orbit/I20181128011035-2018-12.tpd"
include "orbit/S20181128170323-2018-12.tpd"
location "http://download.eclipse.org/staging/2018-12/" {
org.eclipse.osgi lazy

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.5" sequenceNumber="1543418280">
<target name="jgit-4.5" sequenceNumber="1543791667">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.11.v20180605"/>
@ -76,7 +76,7 @@
<unit id="org.apache.sshd.core.source" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp.source" version="2.0.0.v20181102-1323"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/I20181128011035/repository"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20181128170323/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>

View File

@ -1,7 +1,7 @@
target "jgit-4.5" with source configurePhase
include "projects/jetty-9.4.11.tpd"
include "orbit/I20181128011035-2018-12.tpd"
include "orbit/S20181128170323-2018-12.tpd"
location "http://download.eclipse.org/releases/mars/" {
org.eclipse.osgi lazy

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.6" sequenceNumber="1543418269">
<target name="jgit-4.6" sequenceNumber="1543791642">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.11.v20180605"/>
@ -76,7 +76,7 @@
<unit id="org.apache.sshd.core.source" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp.source" version="2.0.0.v20181102-1323"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/I20181128011035/repository"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20181128170323/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>

View File

@ -1,7 +1,7 @@
target "jgit-4.6" with source configurePhase
include "projects/jetty-9.4.11.tpd"
include "orbit/I20181128011035-2018-12.tpd"
include "orbit/S20181128170323-2018-12.tpd"
location "http://download.eclipse.org/releases/neon/" {
org.eclipse.osgi lazy

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.7" sequenceNumber="1543418251">
<target name="jgit-4.7" sequenceNumber="1543791619">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.11.v20180605"/>
@ -76,7 +76,7 @@
<unit id="org.apache.sshd.core.source" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp.source" version="2.0.0.v20181102-1323"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/I20181128011035/repository"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20181128170323/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>

View File

@ -1,7 +1,7 @@
target "jgit-4.7" with source configurePhase
include "projects/jetty-9.4.11.tpd"
include "orbit/I20181128011035-2018-12.tpd"
include "orbit/S20181128170323-2018-12.tpd"
location "http://download.eclipse.org/releases/oxygen/" {
org.eclipse.osgi lazy

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.8" sequenceNumber="1543418240">
<target name="jgit-4.8" sequenceNumber="1543791605">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.11.v20180605"/>
@ -76,7 +76,7 @@
<unit id="org.apache.sshd.core.source" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp.source" version="2.0.0.v20181102-1323"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/I20181128011035/repository"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20181128170323/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>

View File

@ -1,7 +1,7 @@
target "jgit-4.8" with source configurePhase
include "projects/jetty-9.4.11.tpd"
include "orbit/I20181128011035-2018-12.tpd"
include "orbit/S20181128170323-2018-12.tpd"
location "http://download.eclipse.org/releases/photon/" {
org.eclipse.osgi lazy

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<?pde?>
<!-- generated with https://github.com/eclipse-cbi/targetplatform-dsl -->
<target name="jgit-4.9" sequenceNumber="1543418232">
<target name="jgit-4.9" sequenceNumber="1543791591">
<locations>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.jetty.client" version="9.4.11.v20180605"/>
@ -76,7 +76,7 @@
<unit id="org.apache.sshd.core.source" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp" version="2.0.0.v20181102-1323"/>
<unit id="org.apache.sshd.sftp.source" version="2.0.0.v20181102-1323"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/I20181128011035/repository"/>
<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/S20181128170323/repository"/>
</location>
<location includeMode="slicer" includeAllPlatforms="false" includeSource="true" includeConfigurePhase="true" type="InstallableUnit">
<unit id="org.eclipse.osgi" version="0.0.0"/>

View File

@ -1,7 +1,7 @@
target "jgit-4.9" with source configurePhase
include "projects/jetty-9.4.11.tpd"
include "orbit/I20181128011035-2018-12.tpd"
include "orbit/S20181128170323-2018-12.tpd"
location "http://download.eclipse.org/releases/2018-09/" {
org.eclipse.osgi lazy

View File

@ -1,7 +1,7 @@
target "I20181128011035-2018-12" with source configurePhase
target "S20181128170323-2018-12" with source configurePhase
// see http://download.eclipse.org/tools/orbit/downloads/
location "http://download.eclipse.org/tools/orbit/downloads/drops/I20181128011035/repository" {
location "http://download.eclipse.org/tools/orbit/downloads/drops/S20181128170323/repository" {
org.apache.ant [1.10.5.v20180808-0324,1.10.5.v20180808-0324]
org.apache.ant.source [1.10.5.v20180808-0324,1.10.5.v20180808-0324]
org.apache.commons.codec [1.10.0.v20180409-1845,1.10.0.v20180409-1845]

View File

@ -8,6 +8,7 @@ junit_tests(
srcs = glob(["tst/**/*.java"]),
tags = ["sshd"],
deps = [
"//lib:eddsa",
"//lib:junit",
"//lib:sshd-core",
"//lib:sshd-sftp",

View File

@ -8,6 +8,7 @@ Bundle-Vendor: %Provider-Name
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: org.eclipse.jgit.internal.transport.sshd.proxy;version="[5.2.0,5.3.0)",
org.eclipse.jgit.junit;version="[5.2.0,5.3.0)",
org.eclipse.jgit.junit.ssh;version="[5.2.0,5.3.0)",
org.eclipse.jgit.lib;version="[5.2.0,5.3.0)",
org.eclipse.jgit.transport;version="[5.2.0,5.3.0)",
org.eclipse.jgit.transport.ssh;version="[5.2.0,5.3.0)",

View File

@ -53,6 +53,7 @@
import org.eclipse.jgit.transport.ssh.SshTestBase;
import org.eclipse.jgit.transport.sshd.SshdSessionFactory;
import org.eclipse.jgit.util.FS;
import org.junit.Test;
import org.junit.experimental.theories.Theories;
import org.junit.runner.RunWith;
@ -81,4 +82,24 @@ protected void installConfig(String... config) {
}
}
// Using an ed25519 (unencrypted) user key is tested in the super class in
// testSshKeys(). sshd 2.0.0 cannot yet read encrypted ed25519 keys.
@Test
public void testEd25519HostKey() throws Exception {
File newHostKey = new File(getTemporaryDirectory(), "newhostkey");
copyTestResource("id_ed25519", newHostKey);
server.addHostKey(newHostKey.toPath(), true);
File newHostKeyPub = new File(getTemporaryDirectory(),
"newhostkey.pub");
copyTestResource("id_ed25519.pub", newHostKeyPub);
createKnownHostsFile(knownHosts, "localhost", testPort, newHostKeyPub);
cloneWith("ssh://git/doesntmatter", defaultCloneDir, null, //
"Host git", //
"HostName localhost", //
"Port " + testPort, //
"User " + TEST_USER, //
"IdentityFile " + privateKey1.getAbsolutePath());
}
}

View File

@ -10,6 +10,7 @@ java_library(
resource_strip_prefix = "org.eclipse.jgit.ssh.apache/resources",
resources = RESOURCES,
deps = [
"//lib:eddsa",
"//lib:slf4j-api",
"//lib:sshd-core",
"//lib:sshd-sftp",

View File

@ -31,7 +31,8 @@ Export-Package: org.eclipse.jgit.internal.transport.sshd;version="5.2.0";x-inter
org.eclipse.jgit.util,
org.apache.sshd.client.session,
org.apache.sshd.client.keyverifier"
Import-Package: org.apache.sshd.agent;version="[2.0.0,2.1.0)",
Import-Package: net.i2p.crypto.eddsa;version="[0.3.0,0.4.0)",
org.apache.sshd.agent;version="[2.0.0,2.1.0)",
org.apache.sshd.client;version="[2.0.0,2.1.0)",
org.apache.sshd.client.auth;version="[2.0.0,2.1.0)",
org.apache.sshd.client.auth.keyboard;version="[2.0.0,2.1.0)",

View File

@ -63,6 +63,7 @@
<properties>
<translate-qualifier/>
<source-bundle-manifest>${project.build.directory}/META-INF/SOURCE-MANIFEST.MF</source-bundle-manifest>
<eddsa-version>0.3.0</eddsa-version>
</properties>
<dependencies>
@ -84,6 +85,12 @@
<version>${apache-sshd-version}</version>
</dependency>
<dependency>
<groupId>net.i2p.crypto</groupId>
<artifactId>eddsa</artifactId>
<version>${eddsa-version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>

View File

@ -80,6 +80,7 @@ public abstract class SshTestBase extends SshTestHarness {
"id_ecdsa_256", //
"id_ecdsa_384", //
"id_ecdsa_521", //
"id_ed25519", //
// And now encrypted. Passphrase is "testpass".
"id_dsa_testpass", //
"id_rsa_1024_testpass", //
@ -805,7 +806,8 @@ public void testSshKeys(String keyName) throws Exception {
// JSch fails on ECDSA 384/521 keys. Compare
// https://sourceforge.net/p/jsch/patches/10/
assumeTrue(!(getSessionFactory() instanceof JschConfigSessionFactory
&& (keyName.startsWith("id_ecdsa_384")
&& (keyName.contains("ed25519")
|| keyName.startsWith("id_ecdsa_384")
|| keyName.startsWith("id_ecdsa_521"))));
File cloned = new File(getTemporaryDirectory(), "cloned");
String keyFileName = keyName + "_key";

View File

@ -199,7 +199,8 @@ public void testRunHook() throws Exception {
assumeSupportedPlatform();
writeHookFile(PreCommitHook.NAME,
"#!/bin/sh\necho \"test $1 $2\"\nread INPUT\necho $INPUT\necho 1>&2 \"stderr\"");
"#!/bin/sh\necho \"test $1 $2\"\nread INPUT\necho $INPUT\n"
+ "echo $GIT_DIR\necho $GIT_WORK_TREE\necho 1>&2 \"stderr\"");
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
ProcessResult res = FS.DETECTED.runHookIfPresent(db,
@ -208,7 +209,9 @@ public void testRunHook() throws Exception {
"arg1", "arg2" },
new PrintStream(out), new PrintStream(err), "stdin");
assertEquals("unexpected hook output", "test arg1 arg2\nstdin\n",
assertEquals("unexpected hook output",
"test arg1 arg2\nstdin\n" + db.getDirectory().getAbsolutePath()
+ '\n' + db.getWorkTree().getAbsolutePath() + '\n',
out.toString("UTF-8"));
assertEquals("unexpected output on stderr stream", "stderr\n",
err.toString("UTF-8"));

View File

@ -197,6 +197,6 @@ private SshConstants() {
/** All known default identity file names. */
public static final String[] DEFAULT_IDENTITIES = { //
ID_RSA, ID_DSA, ID_ECDSA // , ID_ED25519 // not yet...
ID_RSA, ID_DSA, ID_ECDSA, ID_ED25519
};
}

View File

@ -1110,6 +1110,13 @@ protected ProcessResult internalRunHookIfPresent(Repository repository,
hookPath);
ProcessBuilder hookProcess = runInShell(cmd, args);
hookProcess.directory(runDirectory);
Map<String, String> environment = hookProcess.environment();
environment.put(Constants.GIT_DIR_KEY,
repository.getDirectory().getAbsolutePath());
if (!repository.isBare()) {
environment.put(Constants.GIT_WORK_TREE_KEY,
repository.getWorkTree().getAbsolutePath());
}
try {
return new ProcessResult(runProcess(hookProcess, outRedirect,
errRedirect, stdinArgs), Status.OK);