st2 icon indicating copy to clipboard operation
st2 copied to clipboard

SSH Config being ignored

Open satellite-no opened this issue 3 years ago • 4 comments

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!

satellite-no avatar Jan 09 '22 16:01 satellite-no

Try to use the full path for ssh_config_file_path instead of ~

ssh_config_file_path = /home/stanley/.ssh/config

arm4b avatar Jan 10 '22 23:01 arm4b

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 avatar Jan 11 '22 01:01 satellite-no

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

satellite-no avatar Jan 28 '22 15:01 satellite-no

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.

stale[bot] avatar Apr 28 '22 23:04 stale[bot]