Ver código fonte

Merge pull request #17 from alanpearce/generate-keys

Config: Add support for generating keys
tags/v0.41.0
Nitin Madhok 10 anos atrás
pai
commit
df61e44fea
2 arquivos alterados com 11 adições e 1 exclusões
  1. +8
    -1
      openssh/config.sls
  2. +3
    -0
      pillar.example

+ 8
- 1
openssh/config.sls Ver arquivo

@@ -14,7 +14,14 @@ sshd_config:
- service: openssh

{% 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:
file.managed:
- name: /etc/ssh/ssh_host_{{ keyType }}_key

+ 3
- 0
pillar.example Ver arquivo

@@ -59,6 +59,9 @@ openssh:
provide_dsa_keys: False
provide_ecdsa_keys: False
provide_rsa_keys: False
generate_dsa_keys: False
generate_ecdsa_keys: False
generate_rsa_keys: False
rsa:
private_key: |
-----BEGIN RSA PRIVATE KEY-----

Carregando…
Cancelar
Salvar