mirror of
https://github.com/saltstack-formulas/openssh-formula.git
synced 2024-11-28 03:28:09 +01:00
Fix invalid require_in sshd_config for key states
Change the require_ins used by the key management states in the config.sls to be conditional based on whether the sshd_config is managed by the formula Fixes #130
This commit is contained in:
parent
aa3da8f2c2
commit
63ad14efb1
@ -1,9 +1,11 @@
|
|||||||
{% from "openssh/map.jinja" import openssh with context %}
|
{% from "openssh/map.jinja" import openssh with context %}
|
||||||
|
|
||||||
|
{%- set manage_sshd_config = salt['pillar.get']('sshd_config', False) %}
|
||||||
|
|
||||||
include:
|
include:
|
||||||
- openssh
|
- openssh
|
||||||
|
|
||||||
{% if salt['pillar.get']('sshd_config', False) %}
|
{% if manage_sshd_config %}
|
||||||
sshd_config:
|
sshd_config:
|
||||||
file.managed:
|
file.managed:
|
||||||
- name: {{ openssh.sshd_config }}
|
- name: {{ openssh.sshd_config }}
|
||||||
@ -38,8 +40,10 @@ ssh_host_{{ keyType }}_key:
|
|||||||
- contents_pillar: 'openssh:{{ keyType }}:private_key'
|
- contents_pillar: 'openssh:{{ keyType }}:private_key'
|
||||||
- user: root
|
- user: root
|
||||||
- mode: 600
|
- mode: 600
|
||||||
|
{%- if manage_sshd_config %}
|
||||||
- require_in:
|
- require_in:
|
||||||
- file: sshd_config
|
- file: sshd_config
|
||||||
|
{%- endif %}
|
||||||
- watch_in:
|
- watch_in:
|
||||||
- service: {{ openssh.service }}
|
- service: {{ openssh.service }}
|
||||||
|
|
||||||
@ -49,8 +53,10 @@ ssh_host_{{ keyType }}_key.pub:
|
|||||||
- contents_pillar: 'openssh:{{ keyType }}:public_key'
|
- contents_pillar: 'openssh:{{ keyType }}:public_key'
|
||||||
- user: root
|
- user: root
|
||||||
- mode: 600
|
- mode: 600
|
||||||
|
{%- if manage_sshd_config %}
|
||||||
- require_in:
|
- require_in:
|
||||||
- file: sshd_config
|
- file: sshd_config
|
||||||
|
{%- endif %}
|
||||||
- watch_in:
|
- watch_in:
|
||||||
- service: {{ openssh.service }}
|
- service: {{ openssh.service }}
|
||||||
{%- elif salt['pillar.get']('openssh:generate_' ~ keyType ~ '_keys', False) %}
|
{%- elif salt['pillar.get']('openssh:generate_' ~ keyType ~ '_keys', False) %}
|
||||||
@ -68,8 +74,10 @@ ssh_generate_host_{{ keyType }}_key:
|
|||||||
- name: "rm {{ keyFile }}*; ssh-keygen -t {{ keyType }} {{ keySizePart }} -N '' -f {{ keyFile }}"
|
- name: "rm {{ keyFile }}*; ssh-keygen -t {{ keyType }} {{ keySizePart }} -N '' -f {{ keyFile }}"
|
||||||
- unless: "test -s {{ keyFile }}"
|
- unless: "test -s {{ keyFile }}"
|
||||||
- runas: root
|
- runas: root
|
||||||
|
{%- if manage_sshd_config %}
|
||||||
- require_in:
|
- require_in:
|
||||||
- file: sshd_config
|
- file: sshd_config
|
||||||
|
{%- endif %}
|
||||||
- watch_in:
|
- watch_in:
|
||||||
- service: {{ openssh.service }}
|
- service: {{ openssh.service }}
|
||||||
|
|
||||||
@ -80,8 +88,10 @@ ssh_host_{{ keyType }}_key: # set permissions
|
|||||||
- mode: 0600
|
- mode: 0600
|
||||||
- require:
|
- require:
|
||||||
- cmd: ssh_generate_host_{{ keyType }}_key
|
- cmd: ssh_generate_host_{{ keyType }}_key
|
||||||
|
{%- if manage_sshd_config %}
|
||||||
- require_in:
|
- require_in:
|
||||||
- file: sshd_config
|
- file: sshd_config
|
||||||
|
{%- endif %}
|
||||||
|
|
||||||
{%- elif salt['pillar.get']('openssh:absent_' ~ keyType ~ '_keys', False) %}
|
{%- elif salt['pillar.get']('openssh:absent_' ~ keyType ~ '_keys', False) %}
|
||||||
ssh_host_{{ keyType }}_key:
|
ssh_host_{{ keyType }}_key:
|
||||||
|
Loading…
Reference in New Issue
Block a user