diff --git a/pillar.example b/pillar.example index 9085ac2..f095548 100644 --- a/pillar.example +++ b/pillar.example @@ -28,6 +28,10 @@ users: - PUBLICKEY ssh_auth.absent: - PUBLICKEY_TO_BE_REMOVED + # Generates an authorized_keys file for the user + # with the given keys + ssh_auth_file: + - PUBLICKEY google_auth: ssh: | SOMEGAUTHHASHVAL diff --git a/users/init.sls b/users/init.sls index 41877c7..ea548d6 100644 --- a/users/init.sls +++ b/users/init.sls @@ -167,6 +167,18 @@ ssh_auth_delete_{{ name }}_{{ loop.index0 }}: {% endfor %} {% endif %} +{% if 'ssh_auth_file' in user %} +{{ home }}/.ssh/authorized_keys: + file.managed: + - user: {{ name }} + - group: {{ name }} + - mode: 600 + - contents: | + {% for auth in user.ssh_auth_file -%} + {{ auth }} + {% endfor -%} +{% endif %} + {% if 'sudouser' in user and user['sudouser'] %} sudoer-{{ name }}: