mirror of
https://github.com/saltstack-formulas/openssh-formula.git
synced 2026-09-22 07:57:19 +02:00
Added support to manage ssh certificates
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
include:
|
||||
- openssh
|
||||
|
||||
{% from "openssh/map.jinja" import openssh with context %}
|
||||
{% set openssh_pillar = pillar.get('openssh', {}) %}
|
||||
{% set auth = openssh_pillar.get('auth', {}) %}
|
||||
{% for user,keys in auth.items() -%}
|
||||
{% for key in keys -%}
|
||||
{% if 'present' in key and key['present'] %}
|
||||
{{ key['name'] }}:
|
||||
ssh_auth.present:
|
||||
- user: {{ user }}
|
||||
{% if 'source' in key %}
|
||||
- source: {{ key['source'] }}
|
||||
{% else %}
|
||||
{% if 'enc' in key %}
|
||||
- enc: {{ key['enc'] }}
|
||||
{% endif %}
|
||||
{% if 'comment' in key %}
|
||||
- comment: {{ key['comment'] }}
|
||||
{% endif %}
|
||||
{% if 'options' in key %}
|
||||
- options: {{ key['options'] }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
- require:
|
||||
- service: {{ openssh.service }}
|
||||
{% else %}
|
||||
{{ key['name'] }}:
|
||||
ssh_auth.absent:
|
||||
- user: {{ user }}
|
||||
{% if 'enc' in key %}
|
||||
- enc: {{ key['enc'] }}
|
||||
{% endif %}
|
||||
{% if 'comment' in key %}
|
||||
- comment: {{ key['comment'] }}
|
||||
{% endif %}
|
||||
{% if 'options' in key %}
|
||||
- options: {{ key['options'] }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
@@ -1,4 +1,5 @@
|
||||
{% set sshd_config = pillar.get('sshd_config', {}) %}
|
||||
{% set openssh_pillar = pillar.get('openssh', {}) %}
|
||||
{% set sshd_config = openssh_pillar.get('sshd_config', {}) %}
|
||||
|
||||
# This file is managed by salt. Manual changes risk being overwritten.
|
||||
# The contents of the original sshd_config are kept on the bottom for
|
||||
|
||||
Reference in New Issue
Block a user