Skip to content

Commit 76691df

Browse files
authored
HADOOP-18894: upgrade sshd-core due to CVEs (apache#6060) Contributed by PJ Fanning.
Reviewed-by: He Xiaoqiao <[email protected]> Reviewed-by: Steve Loughran <[email protected]> Signed-off-by: Shilun Fan <[email protected]>
1 parent 2a1ee8d commit 76691df

File tree

5 files changed

+25
-16
lines changed

5 files changed

+25
-16
lines changed

LICENSE-binary

+3
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,9 @@ org.apache.kerby:kerby-pkix:2.0.3
335335
org.apache.kerby:kerby-util:2.0.3
336336
org.apache.kerby:kerby-xdr:2.0.3
337337
org.apache.kerby:token-provider:2.0.3
338+
org.apache.sshd:sshd-common:2.11.0
339+
org.apache.sshd:sshd-core:2.11.0
340+
org.apache.sshd:sshd-sftp:2.11.0
338341
org.apache.solr:solr-solrj:8.11.2
339342
org.apache.yetus:audience-annotations:0.5.0
340343
org.apache.zookeeper:zookeeper:3.8.3

hadoop-common-project/hadoop-common/pom.xml

+5
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,11 @@
316316
<artifactId>sshd-core</artifactId>
317317
<scope>test</scope>
318318
</dependency>
319+
<dependency>
320+
<groupId>org.apache.sshd</groupId>
321+
<artifactId>sshd-sftp</artifactId>
322+
<scope>test</scope>
323+
</dependency>
319324
<dependency>
320325
<groupId>org.apache.ftpserver</groupId>
321326
<artifactId>ftpserver-core</artifactId>

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/contract/sftp/SFTPContract.java

+3-4
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@
3131
import org.apache.hadoop.fs.Path;
3232
import org.apache.hadoop.fs.contract.AbstractFSContract;
3333
import org.apache.hadoop.fs.sftp.SFTPFileSystem;
34-
import org.apache.sshd.common.NamedFactory;
3534
import org.apache.sshd.server.SshServer;
36-
import org.apache.sshd.server.auth.UserAuth;
35+
import org.apache.sshd.server.auth.UserAuthFactory;
3736
import org.apache.sshd.server.auth.password.UserAuthPasswordFactory;
3837
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
39-
import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
38+
import org.apache.sshd.sftp.server.SftpSubsystemFactory;
4039

4140
public class SFTPContract extends AbstractFSContract {
4241

@@ -61,7 +60,7 @@ public void init() throws IOException {
6160
sshd.setPort(0);
6261
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
6362

64-
List<NamedFactory<UserAuth>> userAuthFactories = new ArrayList<>();
63+
List<UserAuthFactory> userAuthFactories = new ArrayList<>();
6564
userAuthFactories.add(new UserAuthPasswordFactory());
6665

6766
sshd.setUserAuthFactories(userAuthFactories);

hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/fs/sftp/TestSFTPFileSystem.java

+7-11
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
import java.nio.file.Files;
2323
import java.nio.file.attribute.BasicFileAttributes;
2424
import java.util.ArrayList;
25-
import java.util.Arrays;
25+
import java.util.Collections;
2626
import java.util.List;
2727

2828
import org.apache.hadoop.conf.Configuration;
@@ -35,25 +35,22 @@
3535
import org.apache.hadoop.test.GenericTestUtils;
3636

3737
import static org.apache.hadoop.test.PlatformAssumptions.assumeNotWindows;
38-
import org.apache.sshd.common.NamedFactory;
39-
import org.apache.sshd.server.Command;
4038
import org.apache.sshd.server.SshServer;
41-
import org.apache.sshd.server.auth.UserAuth;
39+
import org.apache.sshd.server.auth.UserAuthFactory;
4240
import org.apache.sshd.server.auth.password.PasswordAuthenticator;
4341
import org.apache.sshd.server.auth.password.UserAuthPasswordFactory;
4442
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
4543
import org.apache.sshd.server.session.ServerSession;
46-
import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory;
47-
48-
import org.junit.After;
49-
import org.junit.AfterClass;
44+
import org.apache.sshd.sftp.server.SftpSubsystemFactory;
5045

5146
import static org.assertj.core.api.Assertions.assertThat;
5247
import static org.junit.Assert.assertArrayEquals;
5348
import static org.junit.Assert.assertEquals;
5449
import static org.junit.Assert.assertFalse;
5550
import static org.junit.Assert.assertNotNull;
5651
import static org.junit.Assert.assertTrue;
52+
import org.junit.After;
53+
import org.junit.AfterClass;
5754
import org.junit.Before;
5855
import org.junit.BeforeClass;
5956
import org.junit.Rule;
@@ -82,8 +79,7 @@ private static void startSshdServer() throws IOException {
8279
sshd.setPort(0);
8380
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider());
8481

85-
List<NamedFactory<UserAuth>> userAuthFactories =
86-
new ArrayList<NamedFactory<UserAuth>>();
82+
List<UserAuthFactory> userAuthFactories = new ArrayList<>();
8783
userAuthFactories.add(new UserAuthPasswordFactory());
8884

8985
sshd.setUserAuthFactories(userAuthFactories);
@@ -100,7 +96,7 @@ public boolean authenticate(String username, String password,
10096
});
10197

10298
sshd.setSubsystemFactories(
103-
Arrays.<NamedFactory<Command>>asList(new SftpSubsystemFactory()));
99+
Collections.singletonList(new SftpSubsystemFactory()));
104100

105101
sshd.start();
106102
port = sshd.getPort();

hadoop-project/pom.xml

+7-1
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@
202202

203203
<swagger-annotations-version>1.5.4</swagger-annotations-version>
204204
<snakeyaml.version>2.0</snakeyaml.version>
205+
<sshd.version>2.11.0</sshd.version>
205206
<hbase.one.version>1.7.1</hbase.one.version>
206207
<hbase.two.version>2.2.4</hbase.two.version>
207208
<junit.version>4.13.2</junit.version>
@@ -1133,7 +1134,12 @@
11331134
<dependency>
11341135
<groupId>org.apache.sshd</groupId>
11351136
<artifactId>sshd-core</artifactId>
1136-
<version>1.6.0</version>
1137+
<version>${sshd.version}</version>
1138+
</dependency>
1139+
<dependency>
1140+
<groupId>org.apache.sshd</groupId>
1141+
<artifactId>sshd-sftp</artifactId>
1142+
<version>${sshd.version}</version>
11371143
</dependency>
11381144
<dependency>
11391145
<groupId>org.apache.ftpserver</groupId>

0 commit comments

Comments
 (0)