Paramiko error: encountered RSA key, expected OPENSSH key
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 6.5k
- Forks
- 787
- PR merge metrics
- No merged PRs in 30d
Description
SUMMARY
I succeed to run core.remote (ssh conf is okay) but action linux.wait_for_ssh provided by st2 installation return error:
Paramiko error: encountered RSA key, expected OPENSSH key
STACKSTORM VERSION
(cluster)-[xxx@admxx ~]$ st2 --version
st2 3.7.0, on Python 3.6.8
OS, environment, install method
(cluster)-[xxx@admxx ~]$ cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
- installation : one-line install
Steps to reproduce the problem
Requirement:
- Pack core (provided by st2 installation)
- Pack Linux (provided by st2 installation)
Steps:
- Run:
st2 run core.remote hosts=node300 cmd=whoami-> OK - Run:
st2 run linux.wait_for_ssh hostname=node300 sleep_delay=2 retries=2-> KO
Expected Results
My ssh config is good:
(cluster)-[xxx@admxx ~]$ su - stanley
(cluster)-[stanley@admxx ~]$
(cluster)-[stanley@admxx~]$ ssh node300
(cluster)-[stanley@node300 ~]$
core.remote is working:
(cluster)-[xxx@admxx ~]$ st2 run core.remote hosts=node300 cmd=whoami
.
id: 635111284ba4844998622a74
action.ref: core.remote
context.user: st2admin
parameters:
cmd: whoami
hosts: node300
status: succeeded
start_timestamp: Thu, 20 Oct 2022 09:13:12 UTC
end_timestamp: Thu, 20 Oct 2022 09:13:13 UTC
result:
node300:
failed: false
return_code: 0
stderr: ''
stdout: stanley
succeeded: true
Actual Results
the action linux.wait_for_ssh return the error:
Paramiko error: not a valid OPENSSH private key file
(cluster)-[xxx@admxx ~]$ st2 run linux.wait_for_ssh hostname=node300 sleep_delay=2 retries=2
id: 635114334ba4844998622a7a
action.ref: linux.wait_for_ssh
context.user: st2admin
parameters:
hostname: node300
retries: 2
sleep_delay: 2
status: failed
start_timestamp: Thu, 20 Oct 2022 09:26:11 UTC
end_timestamp: Thu, 20 Oct 2022 09:26:15 UTC
result:
exit_code: 1
result: None
stderr: "st2.actions.python.BaseAction: INFO Neither "password" nor "keyfile" parameter provided, defaulting to using "/home/stanley/.ssh/id_rsa.pub" key file
st2.actions.python.BaseAction: DEBUG SSH connection attempt: 1
st2.actions.python.BaseAction: INFO Attempt 1 failed (Error connecting to host node300 with connection parameters {'hostname': 'node300', 'allow_agent': False, 'look_for_keys': False, 'timeout': 3, 'username': 'stanley', 'port': 22, 'key_filename': '/home/stanley/.ssh/id_rsa.pub'}.Paramiko error: not a valid OPENSSH private key file.), sleeping for 2 seconds...
st2.actions.python.BaseAction: DEBUG SSH connection attempt: 2
st2.actions.python.BaseAction: INFO Attempt 2 failed (Error connecting to host node300 with connection parameters {'hostname': 'node300', 'allow_agent': False, 'look_for_keys': False, 'timeout': 3, 'username': 'stanley', 'port': 22, 'key_filename': '/home/stanley/.ssh/id_rsa.pub'}.Paramiko error: not a valid OPENSSH private key file.), sleeping for 2 seconds...
Traceback (most recent call last):
File "/opt/stackstorm/st2/lib/python3.6/site-packages/python_runner/python_action_wrapper.py", line 395, in <module>
obj.run()
File "/opt/stackstorm/st2/lib/python3.6/site-packages/python_runner/python_action_wrapper.py", line 214, in run
output = action.run(**self._parameters)
File "/opt/stackstorm/packs/linux/actions/wait_for_ssh.py", line 71, in run
raise Exception("Exceeded max retries (%s)" % (retries))
Exception: Exceeded max retries (2)
"
stdout: ''
Thanks! :)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with packs/linux/actions/wait_for_ssh.py and compare its SSH parameters with the successful core.remote invocation. Reproduce the failure using the documented st2 run commands and inspect how /home/stanley/.ssh/id_rsa.pub is selected. Done means linux.wait_for_ssh handles the configured RSA key consistently and the reported command succeeds.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100