diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b37f375..6d61662 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,9 +44,10 @@ jobs: run: git config --global core.autocrlf false if: startsWith(matrix.os, 'windows') - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: temurin java-version: 17 @@ -56,4 +57,4 @@ jobs: run: mvn -B clean install -Dno-format - name: Build with Maven (Native) - run: mvn -B install -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip \ No newline at end of file + run: mvn -B install -Dnative -Dquarkus.native.container-build -Dnative.surefire.skip diff --git a/.github/workflows/quarkus-snapshot.yaml b/.github/workflows/quarkus-snapshot.yaml index 388cf44..2edafb5 100644 --- a/.github/workflows/quarkus-snapshot.yaml +++ b/.github/workflows/quarkus-snapshot.yaml @@ -38,18 +38,18 @@ jobs: uses: dcarbone/install-yq-action@v1.0.1 - name: Set up Java - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: temurin java-version: ${{ env.JAVA_VERSION }} - name: Checkout repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: current-repo - name: Checkout Ecosystem - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: ${{ env.ECOSYSTEM_CI_REPO }} path: ecosystem-ci @@ -57,4 +57,4 @@ jobs: - name: Setup and Run Tests run: ./ecosystem-ci/setup-and-test env: - ECOSYSTEM_CI_TOKEN: ${{ secrets.ECOSYSTEM_CI_TOKEN }} \ No newline at end of file + ECOSYSTEM_CI_TOKEN: ${{ secrets.ECOSYSTEM_CI_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 90bbea8..6cf892d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -28,17 +28,10 @@ jobs: github-token: ${{secrets.GITHUB_TOKEN}} metadata-file-path: '.github/project.yml' - - uses: actions/checkout@v3 - - - name: Import GPG key - id: import_gpg - uses: crazy-max/ghaction-import-gpg@v3 - with: - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} - passphrase: ${{ secrets.GPG_PASSPHRASE }} + - uses: actions/checkout@v4 - name: Set up JDK 17 - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: temurin java-version: 17 @@ -46,6 +39,8 @@ jobs: server-id: ossrh server-username: MAVEN_USERNAME server-password: MAVEN_PASSWORD + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE - name: Configure Git author run: | @@ -67,6 +62,7 @@ jobs: env: MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} - name: Push changes to ${{github.base_ref}} branch run: | diff --git a/deployment/pom.xml b/deployment/pom.xml index 5484d99..ce88d7a 100644 --- a/deployment/pom.xml +++ b/deployment/pom.xml @@ -7,16 +7,12 @@ 999-SNAPSHOT quarkus-sshd-deployment - Quarkus Apache sshd Quarkus extention - Deployment + Quarkus Apache SSHD - Deployment io.quarkus quarkus-core-deployment - - io.quarkus - quarkus-arc-deployment - io.quarkus quarkus-security-deployment @@ -48,4 +44,4 @@ - \ No newline at end of file + diff --git a/deployment/src/main/java/io/quarkiverse/sshd/deployment/SshdProcessor.java b/deployment/src/main/java/io/quarkiverse/sshd/deployment/SshdProcessor.java index 3cbaaec..df26231 100644 --- a/deployment/src/main/java/io/quarkiverse/sshd/deployment/SshdProcessor.java +++ b/deployment/src/main/java/io/quarkiverse/sshd/deployment/SshdProcessor.java @@ -3,7 +3,6 @@ import java.security.KeyFactory; import java.security.KeyPairGenerator; import java.security.Signature; -import java.util.Arrays; import javax.crypto.KeyAgreement; import javax.crypto.Mac; @@ -48,12 +47,10 @@ NativeImageResourceBuildItem nativeImageResourceBuildItem() { @BuildStep void sessionProxy(BuildProducer proxiesProducer) { - for (String s : Arrays.asList( + proxiesProducer.produce(new NativeImageProxyDefinitionBuildItem( SessionListener.class.getName(), ChannelListener.class.getName(), - PortForwardingEventListener.class.getName())) { - proxiesProducer.produce(new NativeImageProxyDefinitionBuildItem(s)); - } + PortForwardingEventListener.class.getName())); } } diff --git a/docs/pom.xml b/docs/pom.xml index 89603e5..0617f63 100644 --- a/docs/pom.xml +++ b/docs/pom.xml @@ -9,7 +9,7 @@ quarkus-sshd-docs - Quarkus Apache sshd Quarkus extention - Documentation + Quarkus Apache SSHD - Documentation diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml new file mode 100644 index 0000000..f1486d2 --- /dev/null +++ b/integration-tests/pom.xml @@ -0,0 +1,92 @@ + + + 4.0.0 + + io.quarkiverse.sshd + quarkus-sshd-parent + 999-SNAPSHOT + + + quarkus-sshd-integration-tests + Quarkus Apache SSHD - Integration Tests + + + io.quarkiverse.sshd + quarkus-sshd + ${project.version} + + + io.quarkus + quarkus-junit5 + test + + + org.assertj + assertj-core + 3.25.3 + test + + + + + + io.quarkus + quarkus-maven-plugin + + + + build + + + + + + maven-failsafe-plugin + + + + integration-test + verify + + + + ${project.build.directory}/${project.build.finalName}-runner + + org.jboss.logmanager.LogManager + ${maven.home} + + + + + + + + + + native-image + + + native + + + + + + maven-surefire-plugin + + ${native.surefire.skip} + + + + + + false + native + --initialize-at-run-time=org.apache.activemq.artemis.api.core.ActiveMQBuffers\,org.apache.activemq.artemis.utils.RandomUtil + + + + + diff --git a/integration-tests/src/test/java/io/quarkiverse/sshd/SmokeTest.java b/integration-tests/src/test/java/io/quarkiverse/sshd/SmokeTest.java new file mode 100644 index 0000000..19c8bac --- /dev/null +++ b/integration-tests/src/test/java/io/quarkiverse/sshd/SmokeTest.java @@ -0,0 +1,30 @@ +package io.quarkiverse.sshd; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.io.IOException; + +import org.apache.sshd.client.SshClient; +import org.apache.sshd.client.session.ClientSession; +import org.apache.sshd.client.simple.SimpleClient; +import org.eclipse.microprofile.config.ConfigProvider; +import org.junit.jupiter.api.Test; + +import io.quarkus.test.common.QuarkusTestResource; +import io.quarkus.test.junit.QuarkusTest; + +@QuarkusTest +@QuarkusTestResource(value = SshdServerTestResource.class, restrictToAnnotatedClass = true) +public class SmokeTest { + + @Test + void shouldOpenSession() throws IOException { + String host = ConfigProvider.getConfig().getValue("quarkiverse.sshd.host", String.class); + int port = ConfigProvider.getConfig().getValue("quarkiverse.sshd.port", Integer.class); + try (SimpleClient client = SshClient.setUpDefaultSimpleClient()) { + try (ClientSession clientSession = client.sessionLogin(host, port, "anonymous", "anonymous")) { + assertThat(clientSession).isNotNull(); + } + } + } +} diff --git a/integration-tests/src/test/java/io/quarkiverse/sshd/SmokeTestIT.java b/integration-tests/src/test/java/io/quarkiverse/sshd/SmokeTestIT.java new file mode 100644 index 0000000..926501c --- /dev/null +++ b/integration-tests/src/test/java/io/quarkiverse/sshd/SmokeTestIT.java @@ -0,0 +1,8 @@ +package io.quarkiverse.sshd; + +import io.quarkus.test.junit.QuarkusIntegrationTest; + +@QuarkusIntegrationTest +public class SmokeTestIT extends SmokeTest { + +} diff --git a/integration-tests/src/test/java/io/quarkiverse/sshd/SshdServerTestResource.java b/integration-tests/src/test/java/io/quarkiverse/sshd/SshdServerTestResource.java new file mode 100644 index 0000000..98b01b3 --- /dev/null +++ b/integration-tests/src/test/java/io/quarkiverse/sshd/SshdServerTestResource.java @@ -0,0 +1,50 @@ +package io.quarkiverse.sshd; + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.nio.file.Files; +import java.util.Map; + +import org.apache.sshd.common.io.nio2.Nio2ServiceFactoryFactory; +import org.apache.sshd.server.SshServer; +import org.apache.sshd.server.auth.hostbased.AcceptAllHostBasedAuthenticator; +import org.apache.sshd.server.auth.password.AcceptAllPasswordAuthenticator; +import org.apache.sshd.server.auth.pubkey.AcceptAllPublickeyAuthenticator; +import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; +import org.apache.sshd.server.shell.UnknownCommandFactory; + +import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; + +public class SshdServerTestResource implements QuarkusTestResourceLifecycleManager { + + private SshServer sshd; + + @Override + public Map start() { + try { + sshd = SshServer.setUpDefaultServer(); + sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(Files.createTempFile("host", "key"))); + sshd.setHostBasedAuthenticator(AcceptAllHostBasedAuthenticator.INSTANCE); + sshd.setPasswordAuthenticator(AcceptAllPasswordAuthenticator.INSTANCE); + sshd.setPublickeyAuthenticator(AcceptAllPublickeyAuthenticator.INSTANCE); + sshd.setCommandFactory(UnknownCommandFactory.INSTANCE); + sshd.setIoServiceFactoryFactory(new Nio2ServiceFactoryFactory()); + sshd.setHost("localhost"); + sshd.start(); + return Map.of( + "quarkiverse.sshd.host", sshd.getHost(), + "quarkiverse.sshd.port", Integer.toString(sshd.getPort())); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } + + @Override + public void stop() { + try { + sshd.stop(true); + } catch (IOException e) { + throw new UncheckedIOException(e); + } + } +} diff --git a/pom.xml b/pom.xml index 2385c22..e5f915d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,86 +1,68 @@ - - 4.0.0 - - io.quarkiverse - quarkiverse-parent - 16 - - io.quarkiverse.sshd - quarkus-sshd-parent - 999-SNAPSHOT - pom - Quarkus Apache sshd Quarkus extention - Parent - - deployment - runtime - docs - + + 4.0.0 + + io.quarkiverse + quarkiverse-parent + 16 + + io.quarkiverse.sshd + quarkus-sshd-parent + 999-SNAPSHOT + pom + Quarkus Apache SSHD - Parent + + deployment + runtime + docs + integration-tests + - - scm:git:git@github.com:quarkiverse/quarkus-sshd.git - scm:git:git@github.com:quarkiverse/quarkus-sshd.git - https://github.com/quarkiverse/quarkus-sshd - HEAD - + + scm:git:git@github.com:quarkiverse/quarkus-sshd.git + scm:git:git@github.com:quarkiverse/quarkus-sshd.git + https://github.com/quarkiverse/quarkus-sshd + HEAD + - - 3.10.1 - 11 - UTF-8 - UTF-8 - 3.6.1 - 2.11.0 - - - - - io.quarkus - quarkus-bom - ${quarkus.version} - pom - import - - - org.apache.sshd - sshd-core - ${version.sshd} - - - org.bouncycastle - bcprov-jdk18on - 1.77 - - - org.bouncycastle - bcpkix-jdk18on - 1.77 - - - net.i2p.crypto - eddsa - 0.3.0 - - - - - - - - io.quarkus - quarkus-maven-plugin - ${quarkus.version} - - - maven-compiler-plugin - ${compiler-plugin.version} - - - -parameters - - - - - - - \ No newline at end of file + + 3.8.3 + 2.11.0 + 0.3.0 + true + + + + + + io.quarkus + quarkus-bom + ${quarkus.version} + pom + import + + + org.apache.sshd + sshd-core + ${version.sshd} + + + net.i2p.crypto + eddsa + ${version.eddsa} + + + + + + + + io.quarkus + quarkus-maven-plugin + ${quarkus.version} + + + + + diff --git a/runtime/pom.xml b/runtime/pom.xml index ab1b725..29498b4 100644 --- a/runtime/pom.xml +++ b/runtime/pom.xml @@ -7,7 +7,7 @@ 999-SNAPSHOT quarkus-sshd - Quarkus Apache sshd Quarkus extension - Runtime + Quarkus Apache SSHD - Runtime extension for apache sshd @@ -18,10 +18,6 @@ io.quarkus quarkus-core - - io.quarkus - quarkus-arc - io.quarkus quarkus-security @@ -36,7 +32,7 @@ org.graalvm.sdk - graal-sdk + nativeimage @@ -71,4 +67,4 @@ - \ No newline at end of file +