From 7c03c89f08e177648e51b62f8479219b2faebd6a Mon Sep 17 00:00:00 2001 From: Stefan Negru Date: Mon, 11 Jan 2021 16:01:23 +0200 Subject: [PATCH 1/4] update to sshd-sftp 2.6.0 --- pom.xml | 2 +- .../nbis/lega/inbox/configuration/SFTPConfiguration.java | 4 ++-- .../java/se/nbis/lega/inbox/s3/S3SftpEventListener.java | 2 +- .../se/nbis/lega/inbox/sftp/InboxSftpEventListener.java | 8 ++++---- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pom.xml b/pom.xml index 8866080..4b58888 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ org.apache.sshd sshd-sftp - 2.5.1 + 2.6.0 commons-io diff --git a/src/main/java/se/nbis/lega/inbox/configuration/SFTPConfiguration.java b/src/main/java/se/nbis/lega/inbox/configuration/SFTPConfiguration.java index e64f535..0c816b3 100644 --- a/src/main/java/se/nbis/lega/inbox/configuration/SFTPConfiguration.java +++ b/src/main/java/se/nbis/lega/inbox/configuration/SFTPConfiguration.java @@ -9,8 +9,8 @@ import org.apache.sshd.server.auth.pubkey.PublickeyAuthenticator; import org.apache.sshd.server.auth.pubkey.UserAuthPublicKeyFactory; import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; -import org.apache.sshd.server.subsystem.sftp.SftpEventListener; -import org.apache.sshd.server.subsystem.sftp.SftpSubsystemFactory; +import org.apache.sshd.sftp.server.SftpEventListener; +import org.apache.sshd.sftp.server.SftpSubsystemFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; diff --git a/src/main/java/se/nbis/lega/inbox/s3/S3SftpEventListener.java b/src/main/java/se/nbis/lega/inbox/s3/S3SftpEventListener.java index 2f5338b..cedc4e1 100644 --- a/src/main/java/se/nbis/lega/inbox/s3/S3SftpEventListener.java +++ b/src/main/java/se/nbis/lega/inbox/s3/S3SftpEventListener.java @@ -2,7 +2,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.sshd.server.session.ServerSession; -import org.apache.sshd.server.subsystem.sftp.Handle; +import org.apache.sshd.sftp.server.Handle; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression; import org.springframework.stereotype.Component; diff --git a/src/main/java/se/nbis/lega/inbox/sftp/InboxSftpEventListener.java b/src/main/java/se/nbis/lega/inbox/sftp/InboxSftpEventListener.java index 3bafc72..586fa76 100644 --- a/src/main/java/se/nbis/lega/inbox/sftp/InboxSftpEventListener.java +++ b/src/main/java/se/nbis/lega/inbox/sftp/InboxSftpEventListener.java @@ -7,9 +7,9 @@ import org.apache.commons.io.FilenameUtils; import org.apache.http.entity.ContentType; import org.apache.sshd.server.session.ServerSession; -import org.apache.sshd.server.subsystem.sftp.FileHandle; -import org.apache.sshd.server.subsystem.sftp.Handle; -import org.apache.sshd.server.subsystem.sftp.SftpEventListener; +import org.apache.sshd.sftp.server.FileHandle; +import org.apache.sshd.sftp.server.Handle; +import org.apache.sshd.sftp.server.SftpEventListener; import org.springframework.amqp.rabbit.core.RabbitTemplate; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; @@ -124,7 +124,7 @@ public void linked(ServerSession session, Path source, Path target, boolean symL */ @Override public void modifiedAttributes(ServerSession session, Path path, Map attrs, Throwable thrown) { - log.info("User {} modified attributes of {}: ", session.getUsername(), path, attrs); + log.info("User {} modified attributes of {} {}: ", session.getUsername(), path, attrs); } /** From 1981825c4c26e9022ec001eb991f927727e6600a Mon Sep 17 00:00:00 2001 From: Stefan Negru Date: Mon, 11 Jan 2021 17:04:17 +0200 Subject: [PATCH 2/4] update github actions versions --- .github/workflows/test.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index cb4e0af..a3e5499 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,14 +14,14 @@ jobs: steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v2 - name: Set up JDK 13 uses: actions/setup-java@v1 with: java-version: 13 - - uses: actions/cache@v1 + - uses: actions/cache@v2 with: path: ~/.m2/repository key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} From ec01a8d535cf27bd896ff118513f20c95adb4db9 Mon Sep 17 00:00:00 2001 From: Stefan Negru Date: Wed, 13 Jan 2021 21:35:09 +0200 Subject: [PATCH 3/4] remove support for DSA/ssh-dss --- pom.xml | 13 ++++++++----- .../java/se/nbis/lega/inbox/pojo/KeyAlgorithm.java | 2 +- .../lega/inbox/sftp/InboxAuthenticatorTest.java | 11 +---------- src/test/resources/dss.sec | 12 ------------ src/test/resources/dss.ssh | 1 - 5 files changed, 10 insertions(+), 29 deletions(-) delete mode 100644 src/test/resources/dss.sec delete mode 100644 src/test/resources/dss.ssh diff --git a/pom.xml b/pom.xml index 4b58888..4dc5b2c 100644 --- a/pom.xml +++ b/pom.xml @@ -26,9 +26,12 @@ - net.i2p.crypto - eddsa - 0.3.0 + + + + org.c02e.jpgpj + jpgpj + 1.0 org.springframework.boot @@ -100,7 +103,7 @@ org.bouncycastle bcprov-jdk15on - 1.67 + 1.68 @@ -131,7 +134,7 @@ io.findify - s3mock_2.12 + s3mock_2.13 0.2.6 test diff --git a/src/main/java/se/nbis/lega/inbox/pojo/KeyAlgorithm.java b/src/main/java/se/nbis/lega/inbox/pojo/KeyAlgorithm.java index 8c7419c..387c222 100644 --- a/src/main/java/se/nbis/lega/inbox/pojo/KeyAlgorithm.java +++ b/src/main/java/se/nbis/lega/inbox/pojo/KeyAlgorithm.java @@ -5,6 +5,6 @@ */ public enum KeyAlgorithm { - RSA, DSS, ED25519 + RSA, ED25519 } diff --git a/src/test/java/se/nbis/lega/inbox/sftp/InboxAuthenticatorTest.java b/src/test/java/se/nbis/lega/inbox/sftp/InboxAuthenticatorTest.java index b0637f6..f818e45 100644 --- a/src/test/java/se/nbis/lega/inbox/sftp/InboxAuthenticatorTest.java +++ b/src/test/java/se/nbis/lega/inbox/sftp/InboxAuthenticatorTest.java @@ -81,15 +81,6 @@ public void authenticatePublicKeyRSA() throws IOException, URISyntaxException { assertNotNull(ssh.newSFTPClient()); } - @Test - public void authenticatePublicKeyDSS() throws IOException, URISyntaxException { - mockCEGAEndpoint(username, password, PasswordHashingAlgorithm.BLOWFISH, KeyAlgorithm.DSS, HttpStatus.OK); - ClassLoader classloader = Thread.currentThread().getContextClassLoader(); - File privateKey = new File(classloader.getResource(KeyAlgorithm.DSS.name().toLowerCase() + ".sec").toURI()); - ssh.authPublickey(username, privateKey.getPath()); - assertNotNull(ssh.newSFTPClient()); - } - @Test public void authenticatePublicKeyED25519() throws IOException, URISyntaxException { mockCEGAEndpoint(username, password, PasswordHashingAlgorithm.BLOWFISH, KeyAlgorithm.ED25519, HttpStatus.OK); @@ -103,7 +94,7 @@ public void authenticatePublicKeyED25519() throws IOException, URISyntaxExceptio public void authenticatePublicKeyFail() throws IOException, URISyntaxException { mockCEGAEndpoint(username, password, PasswordHashingAlgorithm.BLOWFISH, KeyAlgorithm.RSA, HttpStatus.OK); ClassLoader classloader = Thread.currentThread().getContextClassLoader(); - File privateKey = new File(classloader.getResource("dss.sec").toURI()); + File privateKey = new File(classloader.getResource("rsa.sec").toURI()); ssh.authPublickey(username, privateKey.getPath()); assertNotNull(ssh.newSFTPClient()); } diff --git a/src/test/resources/dss.sec b/src/test/resources/dss.sec deleted file mode 100644 index b29c637..0000000 --- a/src/test/resources/dss.sec +++ /dev/null @@ -1,12 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQDLHZq04FbrOBMh0IXpShKC1bSb21PAwsQuKA1cueFH1vA/ZiTU -z0MLs8Banl3RL/Za/u+Hwp4nuUMDpCA7KU5wGLOUcZOmUnvcm7x7BjhxVGiTMI2Z -VhkQVGJd6Tptv1TEzviu2BlcpcvyQ9B9drludf9AUo3P0n7XJdwKhLW28wIVAIP6 -IU6C8CGyGevAN3tGSWsgUhZjAoGBALz2FGacbQqm/mI+38va4qT/ZvkF3XbXngFT -rSI9XF1ym6iFBuNtCMQRdIaKQGbNfw7XWTz++HIlOvqPybKBbuAVdDoLtoqWETwa -VdS0K7QQBa+M7+cJhRQGaukPkqYS7mCBNcceuNiwR8ANnuyp/+abVSN5DbTfUOFN -fws6q5luAoGAERwINHXDi4q42dsxcA59CsWQdefjSU1INa8gREaEdPjclZG8+1z+ -3n+TePR5sin2rpGLfNZYUeR0eC94z0puwqf53wmf2FCzaFV1Gfy149RjAwkHKGmO -G0eldkDNd9ZIl008THC+zbeidl9nB723Vk6aJWJWyOZvKY4e3TbZuMECFA+SkHp4 -EX8OviXE6waqQ5BZU2GV ------END DSA PRIVATE KEY----- diff --git a/src/test/resources/dss.ssh b/src/test/resources/dss.ssh deleted file mode 100644 index 7d083fc..0000000 --- a/src/test/resources/dss.ssh +++ /dev/null @@ -1 +0,0 @@ -ssh-dss AAAAB3NzaC1kc3MAAACBAMsdmrTgVus4EyHQhelKEoLVtJvbU8DCxC4oDVy54UfW8D9mJNTPQwuzwFqeXdEv9lr+74fCnie5QwOkIDspTnAYs5Rxk6ZSe9ybvHsGOHFUaJMwjZlWGRBUYl3pOm2/VMTO+K7YGVyly/JD0H12uW51/0BSjc/Sftcl3AqEtbbzAAAAFQCD+iFOgvAhshnrwDd7RklrIFIWYwAAAIEAvPYUZpxtCqb+Yj7fy9ripP9m+QXddteeAVOtIj1cXXKbqIUG420IxBF0hopAZs1/DtdZPP74ciU6+o/JsoFu4BV0Ogu2ipYRPBpV1LQrtBAFr4zv5wmFFAZq6Q+SphLuYIE1xx642LBHwA2e7Kn/5ptVI3kNtN9Q4U1/CzqrmW4AAACAERwINHXDi4q42dsxcA59CsWQdefjSU1INa8gREaEdPjclZG8+1z+3n+TePR5sin2rpGLfNZYUeR0eC94z0puwqf53wmf2FCzaFV1Gfy149RjAwkHKGmOG0eldkDNd9ZIl008THC+zbeidl9nB723Vk6aJWJWyOZvKY4e3TbZuME= From 05ae3cc589397d495e8f9493ef990177013cf25b Mon Sep 17 00:00:00 2001 From: Stefan Negru Date: Wed, 13 Jan 2021 21:43:24 +0200 Subject: [PATCH 4/4] user recommended dependency for ed25519 see https://github.com/apache/mina-sshd/blob/master/docs/files-parsing.md --- pom.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/pom.xml b/pom.xml index b2584af..fc96cf2 100644 --- a/pom.xml +++ b/pom.xml @@ -26,9 +26,6 @@ - - - org.c02e.jpgpj jpgpj 1.0