From 0f83ab7008130ac66216fd8415e3222a17369617 Mon Sep 17 00:00:00 2001 From: Steffen Roegner Date: Fri, 31 Jan 2014 14:44:41 -0500 Subject: [PATCH] Add and support ssh_key_type attribute to allow for dsa ssh key pairs --- pillar.example | 1 + users/init.sls | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pillar.example b/pillar.example index a555691..8dd2e91 100644 --- a/pillar.example +++ b/pillar.example @@ -17,6 +17,7 @@ users: gid: 500 groups: - users + ssh_key_type: rsa ssh_keys: privkey: PRIVATEKEY pubkey: PUBLICKEY diff --git a/users/init.sls b/users/init.sls index 4582217..bbbcdde 100644 --- a/users/init.sls +++ b/users/init.sls @@ -77,9 +77,10 @@ user_keydir_{{ name }}: {%- endfor %} {% if 'ssh_keys' in user %} + {% set key_type = 'id_' + user.get('ssh_key_type', 'rsa') %} user_{{ name }}_private_key: file.managed: - - name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/id_rsa + - name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/{{ key_type }} - user: {{ name }} - group: {{ user_group }} - mode: 600 @@ -91,7 +92,7 @@ user_{{ name }}_private_key: {% endfor %} user_{{ name }}_public_key: file.managed: - - name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/id_rsa.pub + - name: {{ user.get('home', '/home/{0}'.format(name)) }}/.ssh/{{ key_type }}.pub - user: {{ name }} - group: {{ user_group }} - mode: 644