mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge pull request #33933 from folti/develop
ssh: keep original permissions, when hashing known_hosts
This commit is contained in:
commit
94a78fe7d7
@ -1175,8 +1175,10 @@ def hash_known_hosts(user=None, config=None):
|
||||
if not os.path.isfile(full):
|
||||
return {'status': 'error',
|
||||
'error': 'Known hosts file {0} does not exist'.format(full)}
|
||||
origmode = os.stat(full).st_mode
|
||||
cmd = ['ssh-keygen', '-H', '-f', full]
|
||||
cmd_result = __salt__['cmd.run'](cmd, python_shell=False)
|
||||
os.stat(full, origmode)
|
||||
# ssh-keygen creates a new file, thus a chown is required.
|
||||
if os.geteuid() == 0 and user:
|
||||
uinfo = __salt__['user.info'](user)
|
||||
|
Loading…
Reference in New Issue
Block a user