Browse Source

Config: Add support for generating keys

master
Alan Pearce 10 years ago
parent
commit
6fb57f40bc
1 changed files with 8 additions and 1 deletions
  1. +8
    -1
      openssh/config.sls

+ 8
- 1
openssh/config.sls View File

- service: openssh - service: openssh


{% for keyType in ['ecdsa', 'dsa', 'rsa'] %} {% for keyType in ['ecdsa', 'dsa', 'rsa'] %}
{% if salt['pillar.get']('openssh:provide_' ~ keyType ~ '_keys', False) %}
{% if salt['pillar.get']('openssh:generate_' ~ keyType ~ '_keys', False) %}
ssh_generate_host_{{ keyType }}_key:
cmd.run:
- name: ssh-keygen -t {{ keyType }} -N '' -f /etc/ssh/ssh_host_{{ keyType }}_key
- creates: /etc/ssh/ssh_host_{{ keyType }}_key
- user: root

{% elif salt['pillar.get']('openssh:provide_' ~ keyType ~ '_keys', False) %}
ssh_host_{{ keyType }}_key: ssh_host_{{ keyType }}_key:
file.managed: file.managed:
- name: /etc/ssh/ssh_host_{{ keyType }}_key - name: /etc/ssh/ssh_host_{{ keyType }}_key

Loading…
Cancel
Save