This commit is contained in:
mwiegand 2021-07-13 01:04:49 +02:00
parent e8932df0cb
commit 86946636c4
2 changed files with 14 additions and 1 deletions

View file

@ -4,4 +4,8 @@ files['/etc/ssh/sshd_config'] = {
],
}
svc_systemd['ssh'] = {}
svc_systemd['ssh'] = {
'needs': [
'tag:ssh_users',
],
}

View file

@ -11,16 +11,25 @@ for name, config in node.metadata.get('users').items():
'content': config['privkey'] + '\n',
'owner': name,
'mode': '0600',
'tags': [
'ssh_users',
],
}
files[f"{config['home']}/.ssh/id_{config['keytype']}.pub"] = {
'content': config['pubkey'] + '\n',
'owner': name,
'mode': '0600',
'tags': [
'ssh_users',
],
}
files[config['home'] + '/.ssh/authorized_keys'] = {
'content': '\n'.join(sorted(config['authorized_keys'])) + '\n',
'owner': name,
'mode': '0600',
'tags': [
'ssh_users',
],
}
users[name] = config