1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add support ssh configs from /etc/openssh.

In Altlinux system config dir for openssh is /etc/openssh.
This commit is contained in:
Alexey Shabalin 2016-01-14 13:01:49 +03:00
parent 0b32e1586d
commit 9be8ecda06
3 changed files with 10 additions and 5 deletions

View file

@ -536,6 +536,8 @@ class Facts(object):
keydir = '/etc/ssh' keydir = '/etc/ssh'
else: else:
keydir = '/etc' keydir = '/etc'
if self.facts['distribution'] == 'Altlinux':
keydir = '/etc/openssh'
else: else:
keydir = '/etc/ssh' keydir = '/etc/ssh'

View file

@ -119,6 +119,7 @@ def not_in_host_file(self, host):
host_file_list.append(user_host_file) host_file_list.append(user_host_file)
host_file_list.append("/etc/ssh/ssh_known_hosts") host_file_list.append("/etc/ssh/ssh_known_hosts")
host_file_list.append("/etc/ssh/ssh_known_hosts2") host_file_list.append("/etc/ssh/ssh_known_hosts2")
host_file_list.append("/etc/openssh/ssh_known_hosts")
hfiles_not_found = 0 hfiles_not_found = 0
for hf in host_file_list: for hf in host_file_list:

View file

@ -151,11 +151,13 @@ class Connection(ConnectionBase):
self.keyfile = os.path.expanduser("~/.ssh/known_hosts") self.keyfile = os.path.expanduser("~/.ssh/known_hosts")
if C.HOST_KEY_CHECKING: if C.HOST_KEY_CHECKING:
try: for ssh_known_hosts in ("/etc/ssh/ssh_known_hosts", "/etc/openssh/ssh_known_hosts"):
#TODO: check if we need to look at several possible locations, possible for loop try:
ssh.load_system_host_keys("/etc/ssh/ssh_known_hosts") #TODO: check if we need to look at several possible locations, possible for loop
except IOError: ssh.load_system_host_keys(ssh_known_hosts)
pass # file was not found, but not required to function break
except IOError:
pass # file was not found, but not required to function
ssh.load_system_host_keys() ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(MyAddPolicy(self._new_stdin, self)) ssh.set_missing_host_key_policy(MyAddPolicy(self._new_stdin, self))