ajout de clé pour monuser

This commit is contained in:
Iwan Clément
2019-02-19 19:05:31 +01:00
parent 4ad7d70b58
commit f316fc4224

View File

@@ -22,6 +22,35 @@ Creation of file /root/.ssh/authorized_keys:
- {{KEY}}
{% endfor %}
{% set all_users = salt['user.list_users']() %}
{% set monuser='iwan' %}
{% if monuser in all_users %}
{% set userpath='/home'+monuser %}
Creation of directory {{userpath}}/.ssh:
file.directory:
- name: {{userpath}}/.ssh
- mode: '0700'
- user: {{monuser}}
- group: {{monuser}}
- makedirs: True
Creation of file {{userpath}}/.ssh/authorized_keys:
file.managed:
- name: {{userpath}}/.ssh/authorized_keys
- mode: '0600'
- user: {{monuser}}
- group: {{monuser}}
{{userpath}}/.ssh/authorized_keys:
file.append:
- makedirs: True
- text:
{% for KEY in pillar.get('GoodSSHKeys',{}) %}
- {{KEY}}
{% endfor %}
{% endif %}
include:
- linux.RemoveBadSSHKeys