This is an automated email from the ASF dual-hosted git repository.
jamesnetherton pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/main by this push:
new 06601c6565 Fix SFTP authorized_keys not available on Podman
06601c6565 is described below
commit 06601c65653d71256e855a7e0ac6e016c80a1e41
Author: JinyuChen97 <[email protected]>
AuthorDate: Wed Sep 9 07:06:34 2026 +0100
Fix SFTP authorized_keys not available on Podman
The issue only found in Podman not Docker
Copy authorized_keys after container start instead of before. The
linuxserver/openssh-server init process may overwrite pre-copied
authorized_keys with an empty file on Podman. Also set correct ownership and
permissions required by OpenSSH StrictModes.
---
.../camel/quarkus/test/support/sftp/SftpTestResource.java | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
diff --git
a/integration-tests-support/sftp/src/main/java/org/apache/camel/quarkus/test/support/sftp/SftpTestResource.java
b/integration-tests-support/sftp/src/main/java/org/apache/camel/quarkus/test/support/sftp/SftpTestResource.java
index 503f7ede44..6c2f39b26b 100644
---
a/integration-tests-support/sftp/src/main/java/org/apache/camel/quarkus/test/support/sftp/SftpTestResource.java
+++
b/integration-tests-support/sftp/src/main/java/org/apache/camel/quarkus/test/support/sftp/SftpTestResource.java
@@ -77,10 +77,6 @@ public class SftpTestResource implements
QuarkusTestResourceLifecycleManager {
.withCopyFileToContainer(
MountableFile.forHostPath(trustedCaPath),
"/config/.ssh/trusted_user_cas.pub")
- // Copy authorized_keys with all public keys
- .withCopyFileToContainer(
- MountableFile.forHostPath(authorizedKeysPath),
- "/config/.ssh/authorized_keys")
// Copy custom sshd_config
.withCopyFileToContainer(
MountableFile.forHostPath(sshdConfigPath),
@@ -89,6 +85,15 @@ public class SftpTestResource implements
QuarkusTestResourceLifecycleManager {
container.start();
+ // Copy authorized_keys AFTER container start. The container init
process
+ // creates an empty authorized_keys, overwriting any file copied
before start.
+ // This is observed with Podman where the init overwrites the
pre-copied file.
+ container.copyFileToContainer(
+ MountableFile.forHostPath(authorizedKeysPath),
+ "/config/.ssh/authorized_keys");
+ container.execInContainer("chown", "admin:admin",
"/config/.ssh/authorized_keys");
+ container.execInContainer("chmod", "600",
"/config/.ssh/authorized_keys");
+
Map<String, String> result = new HashMap<>();
result.put("camel.sftp.test-port",
container.getMappedPort(SFTP_PORT).toString());