You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2021/06/08 12:03:00 UTC

[GitHub] [airflow] uranusjr commented on a change in pull request #16314: Add support for non-RSA type client host key

uranusjr commented on a change in pull request #16314:
URL: https://github.com/apache/airflow/pull/16314#discussion_r647371839



##########
File path: airflow/providers/ssh/hooks/ssh.py
##########
@@ -159,9 +166,15 @@ def __init__(  # pylint: disable=too-many-statements
                     and str(extra_options["look_for_keys"]).lower() == 'false'
                 ):
                     self.look_for_keys = False
-                if "host_key" in extra_options and self.no_host_key_check is False:
-                    decoded_host_key = decodebytes(extra_options["host_key"].encode('utf-8'))
-                    self.host_key = paramiko.RSAKey(data=decoded_host_key)
+                host_key = extra_options.get("host_key")
+                if host_key is not None and self.no_host_key_check is False:
+                    if host_key.startswith("ssh-"):
+                        key_type, host_key = host_key.split(" ")[:2]
+                        key_constructor = _host_key_mappings[key_type[4:]]

Review comment:
       Not quite sure about the parsing logic here (is the separator always one single space or should we [split with `None`](https://docs.python.org/3/library/stdtypes.html#str.split) instead? should the split be `host_key.split(" ", 2)` instead? etc.), but otherwise LGTM. We can probably just release this first and fix anything if someone complains anyway.




-- 
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:
users@infra.apache.org