tg123/sshpiper

Compatibility and Configuration of sshpiper with Various SSH-Enabled Docker Containers (docker plugin)

Alexander671 opened this issue · 6 comments

I am currently exploring the use of the sshpiper with the ./out/docker plugin to connect to various SSH-enabled Docker containers. My objective is to determine whether sshpiper can be configured to work with any SSH-enabled container, and not just those specified in the existing documentation.

The challenge arises with the implementation of alternative Docker images, such as devdotnetorg/openssh-server, which I selected due to specific requirements (e.g., the absence of an Ubuntu tag in linuxserver/openssh-server). sshpiper works seamlessly with the linuxserver/openssh-server image, I encounter issues when attempting to use it with other images.

To illustrate, here is the command I use to run the linuxserver/openssh-server container, which operates as expected:

docker run -d -e USER_NAME={container_name} -e USER_PASSWORD={password} -e PASSWORD_ACCESS=true \
-l sshpiper.username={container_name} -l sshpiper.container_username={container_name} -l sshpiper.port=2222 \
--name {container_name} --expose 2222 --hostname=openssh-server linuxserver/openssh-server:latest

Attempting to use the same parameters with a different image, such as devdotnetorg/openssh-server, results in sshpiper not functioning as intended (container status is up):

docker run -d -e USER_NAME={container_name} -e USER_PASSWORD={password} -e PASSWORD_ACCESS=true \
-l sshpiper.username={container_name} -l sshpiper.container_username={container_name} -l sshpiper.port=2222 \
--name {container_name} --expose 2222 --hostname=openssh-server devdotnetorg/openssh-server:ubuntu-22.04

Given this context, I am looking for insights on the following:

  1. Is there a universal approach to configure sshpiper with any SSH-enabled Docker container, or are there specific requirements/limitations for compatibility?
  2. What configuration adjustments, if any, are necessary to facilitate sshpiper's functionality across various container images?
  3. Why does sshpiper integrate flawlessly with certain images (as documented) but not with others?
    Any guidance on how to navigate these challenges, or documentation pointing towards extending sshpiper's compatibility, would be greatly appreciated. Thank you in advance for your support and clarification.

If it can help, there are docker inspect files of two containers:

  1. inspect_alpine.txt
  2. inspect_ubuntu.txt

any sshd should be compatible with sshpiper
did you see any error?

@tg123, I am just get this message, when container is different and i try to connect with password:

...
INFO[0000] sshpiperd is listening on: [::]:2222         
ERRO[0045] cannot create upstream for 127.0.0.1:35188 (username [user-419088070]) with password auth: dial tcp 172.17.0.2:2222: connect: connection refused 

But when container is "correct" message will be:

...
INFO[0390] ssh connection pipe created 127.0.0.1:51494 (username [user-419088070]) -> 172.17.0.2:2222 (username [user-419088070]) 
  1. can i get more logs somewhere?
  2. can someone reproduce my problem?

you should use -l sshpiper.port=22
since your image, devdotnetorg/openssh-server:ubuntu-22.04, is listening on 22 instead of 2222

you should use -l sshpiper.port=22 since your image, devdotnetorg/openssh-server:ubuntu-22.04, is listening on 22 instead of 2222

@tg123, When i change command and use -l sshpiper.port=22 i am getting same result (for devdotnetorg/openssh-server):

(venv) alexander@alexander:~/path/to/project$ ssh user-419088070@127.0.0.1 -p 2222
user-419088070@127.0.0.1's password: 
Permission denied, please try again.

But now there are no logs in ./out/sshpiperd ./out/docker after trying password. Sorry maybe i dont understand something simple

first you can test with your upstream with username user-419088070 and password
i believe the reason is that your upstream does not have user user-419088070

checked the dockerfile, unlike linuxserver/openssh-server, your image will not create user for you, should also set -l sshpiper.container_username=root

@tg123 hi, sorry, I was a little busy. I tried to run with -l sshpiper.container_username=root and its work!. I don't understand clearly why, but thank you very much. I think we can close this issue