Open ciechonp opened 1 year ago
same error on my side :/
I have downgraded st2 from 3.7 to 3.6 and it starts to work as expected. I tried st2 3.8 with the same errors. I think that clearly indicates that issue is related paramiko python library version that was upgraded in st2 3.7. So there is a workaround, but it is still not working on st2 3.7 and 3.8 so we can't use the latest versions.
This sounds like this issue: https://github.com/paramiko/paramiko/issues/2048
It is also mentioned here, and the paramiko fix hasn't been merged yet: https://github.com/fabric/fabric/issues/2182
This also explains that the problem is possibly due to it treating the key as the wrong type. So I don't know if any alternative would be to use a ds a key rather than rsa.
downgrade paramiko to =2.8.1 in stackstorm should fix, but I haven't looked at history and other dependencies to see if that is possible.
Looks like we upgraded paramiko just because of dependabot alerts - https://github.com/StackStorm/st2/commit/2dc9d9003d82b63f19ce1b3a577c0b5f99ffa500. Will try and reproduce and see if downgrading paramiko to 2.8.1 resolves issue.
Interestingly I couldn't reproduce this problem. Steps taken:
st2 run core.remote cmd=ls username=ubuntu hosts=xxx private_key=/home/stanley/.ssh/stanley_rsa
st2 run core.remote cmd=ls username=ubuntu hosts=xxx
This is with putting the newly generated rsa key onto the remote server.
There's some more info on the paramiko error which might explain why working for me: Typically, when the given private key is a RSA key and publickey authentication passes, the issue doesn't occur. However, when the publickey authentication fails using RSAKey, SSHClient is trying to load and authenticate using DSSKey. As the result, the issue occurs.
So I managed to reproduce this error when I put the rsa key into a seperate directory, but didn't setup on the remote server - and then I got the error about the DSA key being reported. But when I then put the public key of that key onto the remote server, then it all worked fine.
So in my testing the error:
q must be exactly 160, 224, or 256 bits long
is only happening when it fails to connect remotely with the private key. But when the key validation passes then it all works fine.
Can you double-check the location and permissions of files, and that you have matching private/public keys, as I cannot reproduce the problem on a standalone ST2 running 3.8.0 (which is paramiko 2.10.1)
SUMMARY
When running core.remote action to ssh to host using private key error is thrown
STACKSTORM VERSION
st2 --version st2 3.7.0, on Python 3.8.10
OS, environment, install method
K8s helm chart installation
Steps to reproduce the problem
st2 run core.remote cmd=whoami hosts=xxx username=stanley private_key=/home/stanley/.ssh/stanley_rsa
Expected Results
This action should run whoami command on remote host and print output.
SSH connection using this private_key is working properly password less when running ssh command from action_runner pod:
ssh -i stanley_rsa stanley@xxx
Exactly the same private_key we have on our old stackstorm instance(st2 3.5dev (596c60c23), on Python 3.6.9) and same core.remote action is able to run successfully. I have also verified that paramiko library has different versions:
Actual Results
Any suggestion what needs to be changed and how to make core.remote action work correctly?