From 456414fc33a69c87bb4b620d8d4246cbf13fef99 Mon Sep 17 00:00:00 2001 From: Guenter Schafranek Date: Fri, 4 Nov 2022 16:43:35 +0100 Subject: [PATCH 01/12] chore(dependencies): Updated to com.github.mwiede:jsch - ... due to https://stackoverflow.com/questions/72743823/public-key-authentication-fails-with-jsch-but-work-with-openssh-with-the-same-ke - ... and Java 11 - Minor dependency updates --- Dockerfile | 2 +- cli/build.gradle | 14 ++++++------ core/build.gradle | 14 +++++------- .../ssh/connection/UserAuthentication.groovy | 22 +++++-------------- gradle/wrapper/gradle-wrapper.properties | 2 +- 5 files changed, 21 insertions(+), 33 deletions(-) diff --git a/Dockerfile b/Dockerfile index 170403be..fbaa00a6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -from java:8 +from java:11 volume /usr/src/groovy-ssh copy . /usr/src/groovy-ssh diff --git a/cli/build.gradle b/cli/build.gradle index d00ef67d..e3799f0f 100644 --- a/cli/build.gradle +++ b/cli/build.gradle @@ -5,25 +5,25 @@ plugins { } java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } mainClassName = 'org.hidetake.groovy.ssh.Main' dependencies { compile project(':core') - compile 'ch.qos.logback:logback-classic:1.1.2' + compile 'ch.qos.logback:logback-classic:1.4.4' - runtime 'commons-cli:commons-cli:1.2' + runtime 'commons-cli:commons-cli:1.5.0' testCompile project(':server-integration-test') testCompile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' - testCompile 'org.spockframework:spock-core:1.2-groovy-2.5' - testRuntime 'cglib:cglib-nodep:3.2.10' - testRuntime 'org.objenesis:objenesis:3.0.1' + testCompile 'org.spockframework:spock-core:1.3-groovy-2.5' + testRuntime 'cglib:cglib-nodep:3.3.0' + testRuntime 'org.objenesis:objenesis:3.2' } test { diff --git a/core/build.gradle b/core/build.gradle index cb8bcf81..7939a053 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -5,18 +5,16 @@ plugins { } java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_11 + targetCompatibility = JavaVersion.VERSION_11 } dependencies { - compile 'org.codehaus.groovy:groovy-all:2.5.6' - compile 'org.slf4j:slf4j-api:1.7.7' - compile 'com.jcraft:jsch:0.1.55' - compile 'com.jcraft:jsch.agentproxy.connector-factory:0.0.9' - compile 'com.jcraft:jsch.agentproxy.jsch:0.0.9' + compile 'org.codehaus.groovy:groovy-all:2.5.19' + compile 'org.slf4j:slf4j-api:1.7.36' + compile 'com.github.mwiede:jsch:0.2.4' - testCompile('org.spockframework:spock-core:1.2-groovy-2.5') { + testCompile('org.spockframework:spock-core:1.3-groovy-2.5') { exclude group: 'org.codehaus.groovy', module:'groovy-all' } testRuntime 'cglib:cglib-nodep:3.2.10' diff --git a/core/src/main/groovy/org/hidetake/groovy/ssh/connection/UserAuthentication.groovy b/core/src/main/groovy/org/hidetake/groovy/ssh/connection/UserAuthentication.groovy index 7a9d7aec..f7cbd94e 100644 --- a/core/src/main/groovy/org/hidetake/groovy/ssh/connection/UserAuthentication.groovy +++ b/core/src/main/groovy/org/hidetake/groovy/ssh/connection/UserAuthentication.groovy @@ -1,9 +1,10 @@ package org.hidetake.groovy.ssh.connection +import com.jcraft.jsch.AgentIdentityRepository +import com.jcraft.jsch.IdentityRepository import com.jcraft.jsch.JSch +import com.jcraft.jsch.SSHAgentConnector import com.jcraft.jsch.Session -import com.jcraft.jsch.agentproxy.ConnectorFactory -import com.jcraft.jsch.agentproxy.RemoteIdentityRepository import groovy.util.logging.Slf4j import org.hidetake.groovy.ssh.core.Remote @@ -25,7 +26,9 @@ trait UserAuthentication { } if (settings.agent) { - jsch.identityRepository = RemoteIdentityRepositoryLocator.get() + // Use agent authentication using https://github.com/mwiede/jsch/issues/65#issuecomment-913051572 + IdentityRepository irepo = new AgentIdentityRepository(new SSHAgentConnector()) + jsch.setIdentityRepository(irepo) log.debug("Using SSH agent authentication for $remote") } else { jsch.identityRepository = null /* null means the default repository */ @@ -42,17 +45,4 @@ trait UserAuthentication { } } } - - private static class RemoteIdentityRepositoryLocator { - private static instance = null - - static get() { - if (instance) { - instance - } else { - instance = new RemoteIdentityRepository(ConnectorFactory.default.createConnector()) - } - } - } - } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 44e7c4d1..6ce793f2 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists From fc148d5f164865a803d25fec760efdb491a2fe4f Mon Sep 17 00:00:00 2001 From: Guenter Schafranek Date: Mon, 7 Nov 2022 09:36:03 +0100 Subject: [PATCH 02/12] chore(dependencies): Updated to com.github.mwiede:jsch - Adapted unit test --- cli/gssh-example.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/gssh-example.groovy b/cli/gssh-example.groovy index 526c9e81..524db3b8 100644 --- a/cli/gssh-example.groovy +++ b/cli/gssh-example.groovy @@ -15,5 +15,5 @@ ssh.run { } assert new File('cli/build/known_hosts').readLines().any { line -> - line.startsWith('localhost ssh-rsa') + line.startsWith('localhost ecdsa-sha2-nistp256') } From 413a411a6c081d7b385d0af6c7a4b7643380e1a4 Mon Sep 17 00:00:00 2001 From: Guenter Schafranek Date: Mon, 7 Nov 2022 17:19:41 +0100 Subject: [PATCH 03/12] chore(build): Updating integration test environment - Using up-to-date sshd docker image within a remote docker instance --- .circleci/config.yml | 87 +++------------------ .circleci/docker-compose.yml | 15 ++++ core/build.gradle | 9 ++- os-integration-test/build.gradle | 7 +- os-integration-test/etc/ssh/authorized_keys | 3 + os-integration-test/run-sshd.sh | 9 +-- server-integration-test/build.gradle | 19 +++-- 7 files changed, 50 insertions(+), 99 deletions(-) create mode 100644 .circleci/docker-compose.yml create mode 100644 os-integration-test/etc/ssh/authorized_keys diff --git a/.circleci/config.yml b/.circleci/config.yml index 6ead1a63..0dfd17b6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -3,97 +3,28 @@ jobs: build: docker: - image: circleci/openjdk:11-jdk - - image: int128/sshd:latest - environment: - # see the keys in os-integration-test/etc/ssh/ - SSH_AUTHORIZED_KEYS: | - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDvyn/5Z5s4TjxpCTJT0csJ7MeARchWzppcofSuAGaWeY0gR/vLxNZ1DupBPV6x7GGYZKkKP+n2JJ95ZO/TAbtPQfrq2hS24HtmVXeIQNhdJ5gFgplv5wAEOGX1t8Vy4tHlcMGtMYp+JvIup8YiHW6uic9QMaE5/3Q2DobllAQr17yDgEU9catR70FKqisemlOUaYc9KQWa3gZ8d6rHtfaAI1HnK6U7rH9ZzXmejyvSt6NhT7iQ2yJMF0HOpdQmnDqxJr5jOeWrgf0TbwW0AN3TXrqLFpUdy2DCWF0XEMOaLZhINMV1yxShYAUzhqbnP0voKoKv8IaSG/htJKAVIXn9 - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1xN7CzvOi8IOUqXs+y7BvCwr52enPvcaObR5ymVMZKwPiXXqNKOnvQsKv23JxSOfoHS7WeWqTCkxrawsTSB6ZO7qy6AHxF1qa26KGuwkgbAa7wZIAQtrAH/li04jllxDKYdcriq76poVVvK76q6ASxAy76eboWDrABBXhNWD1pHZj5pE0vKpdGRnAqe/vWIkkmJLy5cVwcrKz8RThtTYv1w5Wuzp2z4W7+O9oFXvYr76lztxLSMtgGcoM6hRUdn+CfBP4aN8LBr0MnvAcQec2aZUOEBFl8q73ZRQ10SmZciIaLEBI/MrB0Oa/TY48/FcQj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fWOMi6ReiWJFUCQ - 9tgjgooudcspmC7+BKNZE9dvoI08kRV/3BUXj6HgdBsUKKQ34ZOONcP4JwyYe7vke69Hux - YKKoLL6izzV0jUXUi7iY7H3jgc124yzV7h3oGea6zNBABN2zUyysoIVBnhLlogpOiwW3eO - KUCk6clhBYBRoom/OpCnvx0K6RW2m9rmj9IdSt5XkIqR+e4idP4f4FMIUprX2fUbCtpyvz - 1bC3B19dhLqi1hnQKHw8UAQIUXzwSlgSmbf/KO56Lm4kN4KsIOiG8jjRqe8y2Zz40j3jfP - ERdjh3Gx8opRb2iSZO2N48dltm+iPHe/pSvNGdz1ZfQAAQAAAIEAt+/7p7AI1vKBHtB8ra - iG8ShaFRD32i5rILVI+UEp7NKi48Xm36LLbxgJZwNGsF4DGcimMfdjyHy7J1aB6BleuKUX - iHRQFus26iU6jW7pqSIG9UAEONxO2smv8AjpU9t6oWmWj91osiuykMWcKrnKYgR7tB+BsS - hIVqJagkn1jdwAAACBAOkRQheAz7c8hDnz3nnTBF0fACL8/yH4igChrYA29L1EdKgH1FwW - RZIix6ROxZunYlbbdLhx2XXJnu07ffROVNku6bBK+XIHyrQlrUEU4xmKzwbmh2sBv78T6u - WqmEj/YfIx7aX0G+i5GWfPhKdwvMJI1ZATEv7OVGo2DO6HoFWBAAAAgQDPmP/yfdxCxtWK - GY1MANtFh/b2xWgSPRasbTg3L3LEk2I3WiQPcARTLv9O02ZNrwBSPJ33BF5GEkUcK13WI3 - P3ns3YHA031EPwQrF1T0iHN024EkDl0KKUMjobSOeoC1RmXHuJ6Do3lHHNxlvrkIKw3YxV - 92rSZ1v9fq2p3xnKAQAAABVoaWRldGFrZUByYWJiaXQubG9jYWwBAgME - -----END OPENSSH PRIVATE KEY----- - SSH_HOST_DSA_KEY: | - -----BEGIN OPENSSH PRIVATE KEY----- - b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABswAAAAdzc2gtZH - NzAAAAgQDB5zSCWJEMYMsp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57ln7kR2IUxhPKm4OyW3meH4gcAVBN1jYnmwZq - RgF+7hi6tZNhEzr7VG6N92LpAQ+6Rao4QEAom8DnT5yAAAABQcGgS2uRxbrfvcxPwmL/Mq - JOcO3QAAABVoaWRldGFrZUByYWJiaXQubG9jYWwBAgME - -----END OPENSSH PRIVATE KEY----- - SSH_HOST_ECDSA_KEY: | - -----BEGIN OPENSSH PRIVATE KEY----- - b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAaAAAABNlY2RzYS - 1zaGEyLW5pc3RwMjU2AAAACG5pc3RwMjU2AAAAQQTb2Qpge+BrGw6SKfi2lTzubUPS5FYg - OGJBOV3IgNGJOP4q+lQZV4KQCq+XgtDsL3OxAOFya/sa3dNI90Sh5ZXoAAAAsOBC60DgQu - tAAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBNvZCmB74GsbDpIp - +LaVPO5tQ9LkViA4YkE5XciA0Yk4/ir6VBlXgpAKr5eC0Owvc7EA4XJr+xrd00j3RKHlle - gAAAAgQhtKq9f2GGDeivbuZ3tPKWtzabtWWkBBMCP79B1WIhcAAAAVaGlkZXRha2VAcmFi - Yml0LmxvY2FsAQID - -----END OPENSSH PRIVATE KEY----- - SSH_HOST_ED25519_KEY: | - -----BEGIN OPENSSH PRIVATE KEY----- - b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW - QyNTUxOQAAACAg0uc6mInMIv6tF/4rYU5Tn/VBZ0Wp7HSzBqMQDLwPqgAAAJi6uxPeursT - 3gAAAAtzc2gtZWQyNTUxOQAAACAg0uc6mInMIv6tF/4rYU5Tn/VBZ0Wp7HSzBqMQDLwPqg - AAAEDtQZ8yklhUquVEgewNF+kCFYADJ5vOQqrAfqWZ1XpiryDS5zqYicwi/q0X/ithTlOf - 9UFnRansdLMGoxAMvA+qAAAAFWhpZGV0YWtlQHJhYmJpdC5sb2NhbA== - -----END OPENSSH PRIVATE KEY----- working_directory: ~/groovy-ssh steps: - run: mkdir -p $HOME/bin - run: echo 'export PATH="$HOME/bin:$PATH"' >> $BASH_ENV - run: | - curl -L -o $HOME/bin/ghcp https://github.com/int128/ghcp/releases/download/v1.3.0/ghcp_linux_amd64 + curl -fL -o /tmp/ghcp.zip https://github.com/int128/ghcp/releases/download/v1.13.1/ghcp_linux_amd64.zip + unzip /tmp/ghcp.zip -d $HOME/bin chmod +x $HOME/bin/ghcp - run: | - curl -L -o /tmp/ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.12.0/ghr_v0.12.0_linux_amd64.tar.gz + curl -L -o /tmp/ghr.tar.gz https://github.com/tcnksm/ghr/releases/download/v0.16.0/ghr_v0.16.0_linux_amd64.tar.gz tar -C /tmp -zxf /tmp/ghr.tar.gz - mv /tmp/ghr_v0.12.0_linux_amd64/ghr $HOME/bin/ghr + mv /tmp/ghr_v0.16.0_linux_amd64/ghr $HOME/bin/ghr - checkout + - setup_remote_docker - restore_cache: keys: - v1-dependencies-{{ checksum "build.gradle" }} - v1-dependencies- + - run: + name: "Start dockerized SSH server" + command: | + docker-compose up -d -f ./.circleci/docker-compose.yml - run: ./gradlew build - store_test_results: path: build/test-results diff --git a/.circleci/docker-compose.yml b/.circleci/docker-compose.yml new file mode 100644 index 00000000..ad5530fa --- /dev/null +++ b/.circleci/docker-compose.yml @@ -0,0 +1,15 @@ +version: '3' + +services: + sshd: + image: panubo/sshd:latest + ports: + - "2222:22" + volumes: + - ../os-integration-test/etc/ssh/authorized_keys:/root/.ssh/authorized_keys + - ../os-integration-test/etc/ssh/ssh_host_rsa_key:/etc/ssh/ssh_host_rsa_key + - ../os-integration-test/etc/ssh/ssh_host_dsa_key:/etc/ssh/ssh_host_dsa_key + - ../os-integration-test/etc/ssh/ssh_host_ecdsa_key:/etc/ssh/ssh_host_ecdsa_key + - ../os-integration-test/etc/ssh/ssh_host_ed25519_key:/etc/ssh/ssh_host_ed25519_key + environment: + - SSH_ENABLE_ROOT=true diff --git a/core/build.gradle b/core/build.gradle index 7939a053..d1f73c5d 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,3 +1,6 @@ +repositories { + mavenCentral() +} plugins { id 'groovy' id 'maven-publish' @@ -17,10 +20,10 @@ dependencies { testCompile('org.spockframework:spock-core:1.3-groovy-2.5') { exclude group: 'org.codehaus.groovy', module:'groovy-all' } - testRuntime 'cglib:cglib-nodep:3.2.10' - testRuntime 'org.objenesis:objenesis:3.0.1' + testRuntime 'cglib:cglib-nodep:3.3.0' + testRuntime 'org.objenesis:objenesis:3.2' - testRuntime 'ch.qos.logback:logback-classic:1.1.2' + testRuntime 'ch.qos.logback:logback-classic:1.4.4' } processResources { diff --git a/os-integration-test/build.gradle b/os-integration-test/build.gradle index 1325e20b..3b3e375f 100644 --- a/os-integration-test/build.gradle +++ b/os-integration-test/build.gradle @@ -1,3 +1,6 @@ +repositories { + mavenCentral() +} plugins { id 'groovy' } @@ -5,9 +8,9 @@ plugins { dependencies { compile project(':core') - compile 'org.spockframework:spock-core:1.2-groovy-2.5' + compile 'org.spockframework:spock-core:1.3-groovy-2.5' - testRuntime 'ch.qos.logback:logback-classic:1.1.2' + testRuntime 'ch.qos.logback:logback-classic:1.4.4' } test { diff --git a/os-integration-test/etc/ssh/authorized_keys b/os-integration-test/etc/ssh/authorized_keys new file mode 100644 index 00000000..dc4dbd9c --- /dev/null +++ b/os-integration-test/etc/ssh/authorized_keys @@ -0,0 +1,3 @@ +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDvyn/5Z5s4TjxpCTJT0csJ7MeARchWzppcofSuAGaWeY0gR/vLxNZ1DupBPV6x7GGYZKkKP+n2JJ95ZO/TAbtPQfrq2hS24HtmVXeIQNhdJ5gFgplv5wAEOGX1t8Vy4tHlcMGtMYp+JvIup8YiHW6uic9QMaE5/3Q2DobllAQr17yDgEU9catR70FKqisemlOUaYc9KQWa3gZ8d6rHtfaAI1HnK6U7rH9ZzXmejyvSt6NhT7iQ2yJMF0HOpdQmnDqxJr5jOeWrgf0TbwW0AN3TXrqLFpUdy2DCWF0XEMOaLZhINMV1yxShYAUzhqbnP0voKoKv8IaSG/htJKAVIXn9 +ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC1xN7CzvOi8IOUqXs+y7BvCwr52enPvcaObR5ymVMZKwPiXXqNKOnvQsKv23JxSOfoHS7WeWqTCkxrawsTSB6ZO7qy6AHxF1qa26KGuwkgbAa7wZIAQtrAH/li04jllxDKYdcriq76poVVvK76q6ASxAy76eboWDrABBXhNWD1pHZj5pE0vKpdGRnAqe/vWIkkmJLy5cVwcrKz8RThtTYv1w5Wuzp2z4W7+O9oFXvYr76lztxLSMtgGcoM6hRUdn+CfBP4aN8LBr0MnvAcQec2aZUOEBFl8q73ZRQ10SmZciIaLEBI/MrB0Oa/TY48/FcQjwaFmQdyp2AIG/tQdzmx your_email@example.com +ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEmU+yuKZZrxAE61hYT1sm0cOKbUie5d61zXPw4ehgWiwyZYtEmH+pDmh/MZfxB6W8QUxOj/ClSYGtbnrDuFm1Y= diff --git a/os-integration-test/run-sshd.sh b/os-integration-test/run-sshd.sh index 831e3b17..62f8b10e 100755 --- a/os-integration-test/run-sshd.sh +++ b/os-integration-test/run-sshd.sh @@ -1,10 +1,3 @@ #!/bin/bash -xe -exec docker run --rm -p 22:22 \ - -e "SSH_HOST_DSA_KEY=$(cat etc/ssh/ssh_host_dsa_key)" \ - -e "SSH_HOST_RSA_KEY=$(cat etc/ssh/ssh_host_rsa_key)" \ - -e "SSH_HOST_ECDSA_KEY=$(cat etc/ssh/ssh_host_ecdsa_key)" \ - -e "SSH_HOST_ED25519_KEY=$(cat etc/ssh/ssh_host_ed25519_key)" \ - -e "SSH_AUTHORIZED_KEYS=$(cat etc/ssh/id_rsa.pub etc/ssh/id_rsa_pass.pub etc/ssh/id_ecdsa.pub)" \ - --name sshd \ - int128/sshd +exec docker-compose -f $( dirname -- "$0"; )/../.circleci/docker-compose.yml up diff --git a/server-integration-test/build.gradle b/server-integration-test/build.gradle index 9c58b31e..8c256162 100644 --- a/server-integration-test/build.gradle +++ b/server-integration-test/build.gradle @@ -1,22 +1,25 @@ +repositories { + mavenCentral() +} plugins { id 'groovy' } dependencies { compile project(':core') - compile 'org.apache.sshd:sshd-core:2.2.0' - compile 'org.apache.sshd:sshd-sftp:2.2.0' - compile 'org.apache.sshd:sshd-scp:2.2.0' + compile 'org.apache.sshd:sshd-core:2.9.0' + compile 'org.apache.sshd:sshd-sftp:2.9.0' + compile 'org.apache.sshd:sshd-scp:2.9.0' - runtime 'org.bouncycastle:bcpkix-jdk15on:1.61' + runtime 'org.bouncycastle:bcpkix-jdk15on:1.70' testCompile 'org.codehaus.groovy.modules.http-builder:http-builder:0.7.1' - testCompile 'org.spockframework:spock-core:1.2-groovy-2.5' - testRuntime 'cglib:cglib-nodep:3.2.10' - testRuntime 'org.objenesis:objenesis:3.0.1' + testCompile 'org.spockframework:spock-core:1.3-groovy-2.5' + testRuntime 'cglib:cglib-nodep:3.3.0' + testRuntime 'org.objenesis:objenesis:3.2' - testRuntime 'ch.qos.logback:logback-classic:1.1.2' + testRuntime 'ch.qos.logback:logback-classic:1.4.4' } test { From db2c9ff55b7386960dd2ba10b1a9f5dedd477786 Mon Sep 17 00:00:00 2001 From: Guenter Schafranek Date: Mon, 7 Nov 2022 17:20:48 +0100 Subject: [PATCH 04/12] chore(build): Fixed remote docker instantiation --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0dfd17b6..130493d6 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,7 +24,7 @@ jobs: - run: name: "Start dockerized SSH server" command: | - docker-compose up -d -f ./.circleci/docker-compose.yml + docker-compose -f ./.circleci/docker-compose.yml up -d - run: ./gradlew build - store_test_results: path: build/test-results From 2c01acc5e3787c85e1a27ac352919bea60fdca20 Mon Sep 17 00:00:00 2001 From: Guenter Schafranek Date: Mon, 7 Nov 2022 17:23:17 +0100 Subject: [PATCH 05/12] chore(build): Fixed error in gradle build file --- core/build.gradle | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/build.gradle b/core/build.gradle index d1f73c5d..e08314ab 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,12 +1,13 @@ -repositories { - mavenCentral() -} plugins { id 'groovy' id 'maven-publish' id 'com.jfrog.bintray' version '1.8.4' } +repositories { + mavenCentral() +} + java { sourceCompatibility = JavaVersion.VERSION_11 targetCompatibility = JavaVersion.VERSION_11 From af21f2a0e2fb0f6081aa17135266174d6b1a994b Mon Sep 17 00:00:00 2001 From: Guenter Schafranek Date: Mon, 7 Nov 2022 17:24:49 +0100 Subject: [PATCH 06/12] chore(build): Fixed error in gradle build file(s) --- os-integration-test/build.gradle | 7 ++++--- server-integration-test/build.gradle | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/os-integration-test/build.gradle b/os-integration-test/build.gradle index 3b3e375f..d6b60133 100644 --- a/os-integration-test/build.gradle +++ b/os-integration-test/build.gradle @@ -1,10 +1,11 @@ -repositories { - mavenCentral() -} plugins { id 'groovy' } +repositories { + mavenCentral() +} + dependencies { compile project(':core') diff --git a/server-integration-test/build.gradle b/server-integration-test/build.gradle index 8c256162..b9fedbec 100644 --- a/server-integration-test/build.gradle +++ b/server-integration-test/build.gradle @@ -1,10 +1,11 @@ -repositories { - mavenCentral() -} plugins { id 'groovy' } +repositories { + mavenCentral() +} + dependencies { compile project(':core') compile 'org.apache.sshd:sshd-core:2.9.0' From 6029034d05ed7222901ed8e21aabe6f9897e741a Mon Sep 17 00:00:00 2001 From: Guenter Schafranek Date: Mon, 7 Nov 2022 17:35:23 +0100 Subject: [PATCH 07/12] chore(build): jcenter (bintray) no longer available --- build.gradle | 2 +- docs/src/docs/asciidoc/getting-started.adoc | 4 ++-- docs/src/docs/asciidoc/user-guide.adoc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 7866ad1d..3a1e85d1 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,7 @@ allprojects { version = System.getenv('CIRCLE_TAG') ?: 'SNAPSHOT' repositories { - jcenter() + mavenCentral() } afterEvaluate { diff --git a/docs/src/docs/asciidoc/getting-started.adoc b/docs/src/docs/asciidoc/getting-started.adoc index 9cbb1de0..d97a726f 100644 --- a/docs/src/docs/asciidoc/getting-started.adoc +++ b/docs/src/docs/asciidoc/getting-started.adoc @@ -56,7 +56,7 @@ Gradle 2.0 style: ---- buildscript { repositories { - jcenter() + mavenCentral() } dependencies { classpath 'org.hidetake:gradle-ssh-plugin:{gradle-ssh-version}' @@ -73,7 +73,7 @@ The plugin also supports Gradle 1.x with the backport library: ---- buildscript { repositories { - jcenter() + mavenCentral() } dependencies { classpath 'org.hidetake:gradle-ssh-plugin:{gradle-ssh-version}' diff --git a/docs/src/docs/asciidoc/user-guide.adoc b/docs/src/docs/asciidoc/user-guide.adoc index 764270aa..966013f9 100644 --- a/docs/src/docs/asciidoc/user-guide.adoc +++ b/docs/src/docs/asciidoc/user-guide.adoc @@ -1637,7 +1637,7 @@ Following example transfers the `groovy-all` jar and execute a script on the rem [source,groovy] ---- repositories { - jcenter() + mavenCentral() } configurations { From 3460793929f491b84785e24e80a3cd12576d7183 Mon Sep 17 00:00:00 2001 From: Guenter Schafranek Date: Mon, 7 Nov 2022 17:38:51 +0100 Subject: [PATCH 08/12] chore(test): Adapted ssh test fixtures --- cli/gssh-example.groovy | 4 ++-- .../groovy/org/hidetake/groovy/ssh/test/os/Fixture.groovy | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/gssh-example.groovy b/cli/gssh-example.groovy index 524db3b8..4a95be73 100644 --- a/cli/gssh-example.groovy +++ b/cli/gssh-example.groovy @@ -1,8 +1,8 @@ ssh.remotes { tester { host = 'localhost' - port = 22 - user = 'tester' + port = 2222 + user = 'root' identity = new File('os-integration-test/etc/ssh/id_rsa') knownHosts = addHostKey(new File('cli/build/known_hosts')) } diff --git a/os-integration-test/src/main/groovy/org/hidetake/groovy/ssh/test/os/Fixture.groovy b/os-integration-test/src/main/groovy/org/hidetake/groovy/ssh/test/os/Fixture.groovy index e43576d3..c73c9d86 100644 --- a/os-integration-test/src/main/groovy/org/hidetake/groovy/ssh/test/os/Fixture.groovy +++ b/os-integration-test/src/main/groovy/org/hidetake/groovy/ssh/test/os/Fixture.groovy @@ -16,8 +16,8 @@ class Fixture { service.remotes { Default { host = 'localhost' - port = 22 - user = 'tester' + port = 2222 + user = 'root' identity = new File("etc/ssh/id_rsa") knownHosts = addHostKey(new File("build/known_hosts")) } From 5b092d1f9ac25f51eee9da53f8f1dd50f47037a6 Mon Sep 17 00:00:00 2001 From: Guenter Schafranek Date: Mon, 7 Nov 2022 17:44:27 +0100 Subject: [PATCH 09/12] chore(test): Updated shadow jar --- cli/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/build.gradle b/cli/build.gradle index e3799f0f..5f595d20 100644 --- a/cli/build.gradle +++ b/cli/build.gradle @@ -1,7 +1,7 @@ plugins { id 'groovy' id 'application' - id 'com.github.johnrengelman.shadow' version '5.0.0' + id 'com.github.johnrengelman.shadow' version '6.1.0' } java { From bd497e1d47b6cbf58de811949b0920917c79af03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Schafranek?= Date: Mon, 27 Feb 2023 23:19:42 +0100 Subject: [PATCH 10/12] chore(deps): Rolled back slf4j-api version --- core/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/build.gradle b/core/build.gradle index e08314ab..0f430fa6 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -15,7 +15,7 @@ java { dependencies { compile 'org.codehaus.groovy:groovy-all:2.5.19' - compile 'org.slf4j:slf4j-api:1.7.36' + compile 'org.slf4j:slf4j-api:1.7.33' compile 'com.github.mwiede:jsch:0.2.4' testCompile('org.spockframework:spock-core:1.3-groovy-2.5') { From 94fba9c19243e0255f9a12b100821b197f27a099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Schafranek?= Date: Mon, 27 Feb 2023 23:33:30 +0100 Subject: [PATCH 11/12] fix: Sync with master --- .../groovy/ssh/connection/UserAuthentication.groovy | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/core/src/main/groovy/org/hidetake/groovy/ssh/connection/UserAuthentication.groovy b/core/src/main/groovy/org/hidetake/groovy/ssh/connection/UserAuthentication.groovy index 7b25982b..594650ea 100644 --- a/core/src/main/groovy/org/hidetake/groovy/ssh/connection/UserAuthentication.groovy +++ b/core/src/main/groovy/org/hidetake/groovy/ssh/connection/UserAuthentication.groovy @@ -1,10 +1,13 @@ package org.hidetake.groovy.ssh.connection +import org.hidetake.groovy.ssh.core.Remote + import com.jcraft.jsch.AgentIdentityRepository import com.jcraft.jsch.IdentityRepository import com.jcraft.jsch.JSch import com.jcraft.jsch.SSHAgentConnector import com.jcraft.jsch.Session + import groovy.util.logging.Slf4j @Slf4j @@ -25,9 +28,9 @@ trait UserAuthentication { } if (settings.agent) { - // Use agent authentication using https://github.com/mwiede/jsch/issues/65#issuecomment-913051572 - IdentityRepository irepo = new AgentIdentityRepository(new SSHAgentConnector()) - jsch.setIdentityRepository(irepo) + // Use agent authentication using https://github.com/mwiede/jsch/issues/65#issuecomment-913051572 + IdentityRepository irepo = new AgentIdentityRepository(new SSHAgentConnector()) + jsch.identityRepository = irepo log.debug("Using SSH agent authentication for $remote") } else { jsch.identityRepository = null /* null means the default repository */ From b9d526bfbc0e19f31438a070e74efb51091a110d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCnter=20Schafranek?= Date: Mon, 27 Feb 2023 23:36:16 +0100 Subject: [PATCH 12/12] fix: More sync with master --- Dockerfile | 2 +- build.gradle | 22 ++-------------------- 2 files changed, 3 insertions(+), 21 deletions(-) diff --git a/Dockerfile b/Dockerfile index fbaa00a6..170403be 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -from java:11 +from java:8 volume /usr/src/groovy-ssh copy . /usr/src/groovy-ssh diff --git a/build.gradle b/build.gradle index 3a1e85d1..0ce1ea30 100644 --- a/build.gradle +++ b/build.gradle @@ -1,22 +1,4 @@ allprojects { - group = 'org.hidetake' - version = System.getenv('CIRCLE_TAG') ?: 'SNAPSHOT' - - repositories { - mavenCentral() - } - - afterEvaluate { - tasks.withType(Test) { - finalizedBy ':testReport' - testReport.reportOn binResultsDir - reports.html.enabled = false - reports.junitXml.destination = file("${rootProject.buildDir}/test-results") - } - } -} - -task testReport(type: TestReport) { - description 'Generates test report for all projects' - destinationDir = file("$buildDir/reports") + group = 'org.hidetake' + version = System.getenv('GROOVY_SSH_VERSION') ?: '0.0.0' }