Browse Source

Merge pull request #91 from M2Mobi/master

Add possibility to manage ssh's known_hosts file.
tags/v0.45.0
puneet kandhari 9 years ago
parent
commit
9dd98d57e7
2 changed files with 35 additions and 0 deletions
  1. +5
    -0
      pillar.example
  2. +30
    -0
      users/init.sls

+ 5
- 0
pillar.example View File

ssh_auth_sources: ssh_auth_sources:
- salt://keys/buser.id_rsa.pub - salt://keys/buser.id_rsa.pub
# Manage the ~/.ssh/config file # Manage the ~/.ssh/config file
ssh_known_hosts:
importanthost:
fingerprint: 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
ssh_known_hosts.absent:
- notimportanthost
ssh_config: ssh_config:
all: all:
hostname: "*" hostname: "*"

+ 30
- 0
users/init.sls View File

{% endfor -%} {% endfor -%}
{% endif %} {% endif %}


{% if 'ssh_known_hosts' in user %}
{% for hostname, host in user['ssh_known_hosts'].items() %}
users_ssh_known_hosts_{{ name }}_{{ loop.index0 }}:
ssh_known_hosts.present:
- user: {{ name }}
- name: {{ hostname }}
{% if 'port' in host %}
- port: {{ host['port'] }}
{% endif -%}
{% if 'fingerprint' in host %}
- fingerprint: {{ host['fingerprint'] }}
{% endif -%}
{% if 'key' in host %}
- key: {{ host['key'] }}
{% endif -%}
{% if 'enc' in host %}
- enc: {{ host['enc'] }}
{% endif -%}
{% endfor %}
{% endif %}

{% if 'ssh_known_hosts.absent' in user %}
{% for host in user['ssh_known_hosts.absent'] %}
users_ssh_known_hosts_delete_{{ name }}_{{ loop.index0 }}:
ssh_known_hosts.absent:
- user: {{ name }}
- name: {{ host }}
{% endfor %}
{% endif %}

{% if 'sudouser' in user and user['sudouser'] %} {% if 'sudouser' in user and user['sudouser'] %}


users_sudoer-{{ name }}: users_sudoer-{{ name }}:

Loading…
Cancel
Save