ajout de clé pour monuser
This commit is contained in:
@@ -22,6 +22,35 @@ Creation of file /root/.ssh/authorized_keys:
|
|||||||
- {{KEY}}
|
- {{KEY}}
|
||||||
{% endfor %}
|
{% 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:
|
include:
|
||||||
- linux.RemoveBadSSHKeys
|
- linux.RemoveBadSSHKeys
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user