From 6fb57f40bcb65826d6f803f6ff05bdd0eebbd791 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 24 Aug 2014 16:08:41 +0100 Subject: [PATCH 1/2] Config: Add support for generating keys --- openssh/config.sls | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/openssh/config.sls b/openssh/config.sls index 3cf3376..2f3a29e 100644 --- a/openssh/config.sls +++ b/openssh/config.sls @@ -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 From eb9dec1b9d151a0ed4da667a2d97bb395252a38c Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 24 Aug 2014 16:44:33 +0100 Subject: [PATCH 2/2] Update pillar example --- pillar.example | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pillar.example b/pillar.example index 4edbbd3..9f63464 100644 --- a/pillar.example +++ b/pillar.example @@ -51,6 +51,9 @@ openssh: ssh-dss NOT_DEFINED provide_dsa_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-----