JiriOndrusek commented on code in PR #6912: URL: https://github.com/apache/camel-quarkus/pull/6912#discussion_r1920316183
########## integration-tests/ssh/src/test/java/org/apache/camel/quarkus/component/ssh/it/SshTestResource.java: ########## @@ -45,33 +54,77 @@ public Map<String, String> start() { container = new GenericContainer(SSH_IMAGE) .withExposedPorts(SSH_PORT) .withEnv("PASSWORD_ACCESS", "true") - .withEnv("USER_NAME", "test") - .withEnv("USER_PASSWORD", "password") + .withEnv("USER_NAME", USERNAME) + .withEnv("USER_PASSWORD", PASSWORD) .waitingFor(Wait.forListeningPort()); container.start(); LOGGER.info("Started SSH container to {}:{}", container.getHost(), container.getMappedPort(SSH_PORT).toString()); - return CollectionHelper.mapOf( - "quarkus.ssh.host", - container.getHost(), - "quarkus.ssh.port", - container.getMappedPort(SSH_PORT).toString()); + securedPort = AvailablePortFinder.getNextAvailable(); + + var sshd = SshServer.setUpDefaultServer(); + sshd.setPort(securedPort); + sshd.setKeyPairProvider(new FileKeyPairProvider(Paths.get(getHostKey()))); + sshd.setCommandFactory(new TestEchoCommandFactory()); + sshd.setPasswordAuthenticator((username, password, session) -> true); + sshd.setPublickeyAuthenticator((username, key, session) -> true); + sshd.start(); + + sshds.add(sshd); + + edPort = AvailablePortFinder.getNextAvailable(); + + sshd = SshServer.setUpDefaultServer(); + sshd.setPort(edPort); + sshd.setKeyPairProvider(new FileKeyPairProvider(Paths.get("target/classes/edDSA/key_ed25519.pem"))); + sshd.setCommandFactory(new TestEchoCommandFactory()); + sshd.setPasswordAuthenticator((username, password, session) -> true); + sshd.setPublickeyAuthenticator((username, key, session) -> true); + sshd.start(); + + sshds.add(sshd); + + LOGGER.info("Started SSHD server to {}:{}", container.getHost(), + securedPort); + + return Map.of( + "quarkus.ssh.host", "localhost", + "quarkus.ssh.port", container.getMappedPort(SSH_PORT).toString(), + "quarkus.ssh.secured-port", securedPort + "", + "quarkus.ssh.ed-port", edPort + "", + "ssh.username", USERNAME, + "ssh.password", PASSWORD); } catch (Exception e) { throw new RuntimeException(e); } } + //todo proper path (no target) + protected String getHostKey() { + //todo test + // return "target/classes/hostkey.pem"; + return "target/certs/user01.key"; + } + @Override public void stop() { - LOGGER.info("Stopping SSH container"); + LOGGER.info("Stopping SSH container and servers"); try { if (container != null) { container.stop(); } + sshds.stream().forEach(s -> { + try { + s.stop(true); + Thread.sleep(50); Review Comment: removed ########## integration-tests/ssh/pom.xml: ########## @@ -98,6 +115,48 @@ </plugins> </build> </profile> + <profile> + <id>non-fips</id> + <activation> + <property> + <name>!fips</name> + </property> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>exec-maven-plugin</artifactId> + <executions> + <execution> + <id>generate-certs.sh</id> + <phase>generate-sources</phase> + <goals> + <goal>exec</goal> + </goals> + <configuration> + <executable>bash</executable> + <arguments> + <argument>${basedir}/generate-certs.sh</argument> Review Comment: done ########## integration-tests/ssh/pom.xml: ########## @@ -51,6 +59,11 @@ <artifactId>rest-assured</artifactId> <scope>test</scope> </dependency> + <dependency> + <groupId>org.assertj</groupId> + <artifactId>assertj-core</artifactId> Review Comment: removed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org