wip
This commit is contained in:
parent
48b904fede
commit
a962ce32a2
2 changed files with 3 additions and 23 deletions
|
@ -11,24 +11,9 @@ def user(metadata):
|
|||
for name, config in metadata.get('users').items():
|
||||
users[name] = {
|
||||
'authorized_keys': [],
|
||||
'privkey': '111',
|
||||
'privkey': 'pubkey',
|
||||
}
|
||||
|
||||
if not 'full_name' in config:
|
||||
users[name]['full_name'] = name
|
||||
|
||||
if not 'home' in config:
|
||||
users[name]['home'] = f'/home/{name}'
|
||||
|
||||
if not 'shell' in config:
|
||||
users[name]['shell'] = '/bin/bash'
|
||||
|
||||
if not 'privkey' in users[name] and not 'pubkey' in users[name]:
|
||||
privkey, pubkey = repo.libs.ssh.generate_ed25519_key_pair(
|
||||
b64decode(str(repo.vault.random_bytes_as_base64_for(f"{name}@{node.name}", length=32)))
|
||||
)
|
||||
users[name]['keytype'] = 'ed25519'
|
||||
users[name]['privkey'] = privkey
|
||||
users[name]['pubkey'] = pubkey + f' {name}@{node.name}'
|
||||
|
||||
return {
|
||||
'users': users,
|
||||
|
|
|
@ -7,12 +7,7 @@
|
|||
'server': 'home.backups',
|
||||
},
|
||||
'users': {
|
||||
'root': {
|
||||
'shell': '/usr/bin/zsh',
|
||||
'authorized_keys': [
|
||||
'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEU1l2ijW3ZqzFGZcdWg2ESgTGehdNfBTfafxsjWvWdS mwiegand@macbook',
|
||||
],
|
||||
},
|
||||
'root': {},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue