SSH test using GitHub Action #24913
-
I have a code that wraps around some SSH operations. I would like to build CI for this code. Is there a way to generate two virtual machine and SSH between them? |
Beta Was this translation helpful? Give feedback.
Replies: 13 comments
-
Technically you should be able to use Qemu (possibly with libvirt) on an Ubuntu runner, maybe with Vagrant or something to set them up automatically. However I’d recommend using containers instead if possible, because the performance is much better. I have a Dockerfile that starts an SSH server inside a container for a project of mine. In that project a script creates the necessary |
Beta Was this translation helpful? Give feedback.
-
It’s actually a good idea to use an ssh server! I’ll try to get started based on your example, thanks. |
Beta Was this translation helpful? Give feedback.
-
@airtower-luna I’ve been trying your suggestion. Here is what I have in my action:
However, I’m getting permission issues:
would you happen to know how to solve these issues? |
Beta Was this translation helpful? Give feedback.
-
At a glance, no. To get more information try running |
Beta Was this translation helpful? Give feedback.
-
Thanks @airtower-luna ! I’m not too good at reading the verbose output of ssh, but it seems to me that ssh wants to read a passphrase that I set to be empty:
|
Beta Was this translation helpful? Give feedback.
-
This looks like the key issue, not the passphrase:
tdegeus:
You need to either import the host key for localhost into |
Beta Was this translation helpful? Give feedback.
-
Thanks once more @airtower-luna . The thing that confuses me is that I did import the key:
and that it did find it:
|
Beta Was this translation helpful? Give feedback.
-
Sorry, writing |
Beta Was this translation helpful? Give feedback.
-
Thanks! Indeed that was one issue in adding myself to
(Not to worry about publishing the key here, it is generated in a virtual machine in CI). For reference: github.com/tdegeus/shelephantSSH test on CI
SSH test on CI
|
Beta Was this translation helpful? Give feedback.
-
It looks like the SSH server rejected the key. To figure out why you’ll need to check |
Beta Was this translation helpful? Give feedback.
-
Thanks for all your help. The solution was in the end very simple. My $HOME has permissions 777, which is too much for SSH. So what solved it was
|
Beta Was this translation helpful? Give feedback.
-
I have lost a lot of time debugging users ssh incidents only to find out it was a simple file permission. I wrote a few bash scripts that allow users and administrators to make sure that the ssh files and directory permissions are correct on each system. The script names are check-user-ssh.sh and check-host-ssh.sh which can be found at docker-security-infrastructure/ssh at master · BradleyA/docker-security-infrastructure · GitHub |
Beta Was this translation helpful? Give feedback.
-
Thanks nice @bradleya . Did you consider making this an GitHub Action? |
Beta Was this translation helpful? Give feedback.
It looks like the SSH server rejected the key. To figure out why you’ll need to check
/var/log/auth.log
as I mentioned above, it should contain information on login attempts.