freget opened a new pull request #15964:
URL: https://github.com/apache/airflow/pull/15964


    <!--
   Thank you for contributing! Please make sure that your code changes
   are covered with tests. And in case of new features or big changes
   remember to adjust the documentation.
   
   Feel free to ping committers for the review!
   
   In case of existing issue, reference it using one of the following:
   
   closes: #ISSUE
   related: #ISSUE
   
   How to write a good git commit message:
   http://chris.beams.io/posts/git-commit/
   -->
   When using the SSHHook to connect to an ssh server on a non default port, 
the host_key setting was not added with the correct hostname to the list of 
known hosts. In more detail:
   
   ```python
   from airflow.providers.ssh.hooks.ssh import SSHHook
   import paramiko
   from base64 import decodebytes
   
   hook = SSHHook(remote_host="1.2.3.4", port=1234, username="user")
   # Usually, host_key would come from the connection_extras, for the sake of 
this example we set the value manually:
   host_key = "abc" # Some public key
   hook.host_key = paramiko.RSAKey(data=decodebytes(host_key.encode("utf-8")))
   hook.no_host_key_check = False
   
   conn = hook.get_conn()
   ```
   
   yielded the exception
   
       paramiko.ssh_exception.SSHException: Server '[1.2.3.4]:1234' not found 
in known_hosts
   
   closes: #15963
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to