Browse Source

Merge pull request #16 from alanpearce/ecdsa

Add support for ECDSA host keys
master
Nitin Madhok 10 years ago
parent
commit
7a409e1821
2 changed files with 17 additions and 27 deletions
  1. +9
    -27
      openssh/config.sls
  2. +8
    -0
      pillar.example

+ 9
- 27
openssh/config.sls View File

- watch_in: - watch_in:
- service: openssh - service: openssh


{% if salt['pillar.get']('openssh:provide_dsa_keys', False) %}
ssh_host_dsa_key:
{% for keyType in ['ecdsa', 'dsa', 'rsa'] %}
{% if salt['pillar.get']('openssh:provide_' ~ keyType ~ '_keys', False) %}
ssh_host_{{ keyType }}_key:
file.managed: file.managed:
- name: /etc/ssh/ssh_host_dsa_key
- contents_pillar: 'openssh:dsa:private_key'
- name: /etc/ssh/ssh_host_{{ keyType }}_key
- contents_pillar: 'openssh:{{ keyType }}:private_key'
- user: root - user: root
- mode: 600 - mode: 600
- require_in: - require_in:
- service: {{ openssh.service }} - service: {{ openssh.service }}


ssh_host_dsa_key.pub:
ssh_host_{{ keyType }}_key.pub:
file.managed: file.managed:
- name: /etc/ssh/ssh_host_dsa_key.pub
- contents_pillar: 'openssh:dsa:public_key'
- user: root
- mode: 600
- require_in:
- service: {{ openssh.service }}
{% endif %}

{% if salt['pillar.get']('openssh:provide_rsa_keys', False) %}
ssh_host_rsa_key:
file.managed:
- name: /etc/ssh/ssh_host_rsa_key
- contents_pillar: 'openssh:rsa:private_key'
- user: root
- mode: 600
- require_in:
- service: {{ openssh.service }}

ssh_host_rsa_key.pub:
file.managed:
- name: /etc/ssh/ssh_host_rsa_key.pub
- contents_pillar: 'openssh:rsa:public_key'
- name: /etc/ssh/ssh_host_{{ keyType }}_key.pub
- contents_pillar: 'openssh:{{ keyType }}:public_key'
- user: root - user: root
- mode: 600 - mode: 600
- require_in: - require_in:
- service: {{ openssh.service }} - service: {{ openssh.service }}
{% endif %} {% endif %}
{% endfor %}

+ 8
- 0
pillar.example View File

-----END DSA PRIVATE KEY----- -----END DSA PRIVATE KEY-----
public_key: | public_key: |
ssh-dss NOT_DEFINED ssh-dss NOT_DEFINED
ecdsa:
private_key: |
-----BEGIN EC PRIVATE KEY-----
NOT_DEFINED
-----END EC PRIVATE KEY-----
public_key: |
ecdsa-sha2-nistp256 NOT_DEFINED
provide_dsa_keys: False provide_dsa_keys: False
provide_ecdsa_keys: False
provide_rsa_keys: False provide_rsa_keys: False
rsa: rsa:
private_key: | private_key: |

Loading…
Cancel
Save