StackStorm / st2

StackStorm (aka "IFTTT for Ops") is event-driven automation for auto-remediation, incident responses, troubleshooting, deployments, and more for DevOps and SREs. Includes rules engine, workflow, 160 integration packs with 6000+ actions (see https://exchange.stackstorm.org) and ChatOps. Installer at https://docs.stackstorm.com/install/index.html
https://stackstorm.com/
Apache License 2.0
6.05k stars 745 forks source link

SSH Config being ignored #5531

Open satellite-no opened 2 years ago

satellite-no commented 2 years ago

SUMMARY

using the core.remote module the /home/stanley/.ssh/config is being ignored. Not sure if I missed something.

STACKSTORM VERSION

[root@stackstorm centos]# st2 --version
st2 3.6.0, on Python 3.6.8
OS, environment, install method

New install, a beginner using shell script to get it up and running.

Steps to reproduce the problem

Configured /etc/st2/st2.conf with the below per "ssh troubleshooting" guide.

[system_user]
user = stanley
ssh_key_file = /home/stanley/.ssh/stanley_rsa

...

[ssh_runner]
remote_dir = /tmp
use_ssh_config = True
ssh_config_file_path = ~/.ssh/config

Expected Results

Remote cli execution success

Actual Results

It parses the config but then appears to ignore it.

Output from debug /var/log/st2/st2actionrunner.236327.log

2022-01-09 10:45:02,856 139706203665064 DEBUG base [-] Performing pre-run for runner: 621413db-2341-4fad-9224-c8feee1a3b0c
2022-01-09 10:45:02,856 139706203665064 DEBUG paramiko_ssh_runner [-] Entering BaseParallelSSHRunner.pre_run() for liveaction_id="61db02feeceae61645ed8184"
2022-01-09 10:45:02,857 139706203665064 INFO paramiko_ssh_runner [-] [BaseParallelSSHRunner="621413db-2341-4fad-9224-c8feee1a3b0c", liveaction_id="61db02feeceae61645ed8184"] Finished pre_run.
2022-01-09 10:45:02,857 139706154534456 DEBUG ip_utils [-] Non-bracket address. host_str: salt
2022-01-09 10:45:02,857 139706154534456 DEBUG parallel_ssh [-] Connecting to host. (host='salt',port='None',user='None',private_key='<redacted>')
2022-01-09 10:45:02,858 139706154534456 INFO paramiko_ssh [-] Parsed SSH config file contents: {'hostname': '172.16.0.146', 'user': 'centos', 'certificatefile': '~/.ssh/id_rsa-cert.pub'}
2022-01-09 10:45:02,869 139706154534456 DEBUG paramiko_ssh [-] Connecting to server (hostname='salt',port=22,username='centos',timeout=60)
2022-01-09 10:45:02,869 139706154534456 DEBUG paramiko_ssh [-] Connection info (conninfo={'hostname': 'salt', 'allow_agent': False, 'look_for_keys': False, 'timeout': 60, 'username': 'centos', 'port': 22, 'key_filename': '/home/stanley/.ssh/stanley_rsa'})

Thanks!

arm4b commented 2 years ago

Try to use the full path for ssh_config_file_path instead of ~

ssh_config_file_path = /home/stanley/.ssh/config
satellite-no commented 2 years ago

That partially worked.. It appears to work except for the hostname. Meaning it works as long as I have salt in the hosts file otherwise it still says "no address found".

Host *
    User centos
    CertificateFile ~/.ssh/id_rsa-cert.pub
    IdentityFile ~/.ssh/id_rsa

Host salt
    HostName 172.16.0.146
satellite-no commented 2 years ago

@paky92, I have attempted reloading configs, restarting as documented using sudo service st2actionrunner restart, and restarting with st2ctl restart.

stale[bot] commented 2 years ago

Thanks for contributing to this issue. As it has been 90 days since the last activity, we are automatically marking is as stale. If this issue is not relevant or applicable anymore (problem has been fixed in a new version or similar), please close the issue or let us know so we can close it. On the contrary, if the issue is still relevant, there is nothing you need to do, but if you have any additional details or context which would help us when working on this issue, please include it as a comment to this issue.