Added support to manage ssh certificates
This commit is contained in:
parent
6e418aa945
commit
47211d0648
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
||||||
Copyright (c) 2013 Salt Stack Formulas
|
Copyright (c) 2013-2014 Salt Stack Formulas
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
|
24
README.rst
24
README.rst
|
@ -18,6 +18,21 @@ Available states
|
||||||
|
|
||||||
Installs the ``openssh`` server package and service.
|
Installs the ``openssh`` server package and service.
|
||||||
|
|
||||||
|
``openssh.auth``
|
||||||
|
-----------
|
||||||
|
|
||||||
|
Manages SSH certificates for users.
|
||||||
|
|
||||||
|
``openssh.banner``
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Installs a banner that users see when SSH-ing in.
|
||||||
|
|
||||||
|
``openssh.client``
|
||||||
|
------------------
|
||||||
|
|
||||||
|
Installs the openssh client package.
|
||||||
|
|
||||||
``openssh.config``
|
``openssh.config``
|
||||||
------------------
|
------------------
|
||||||
|
|
||||||
|
@ -26,12 +41,3 @@ Installs the ssh daemon configuration file included in this formula
|
||||||
by values from pillar. ``pillar.example`` results in the generation
|
by values from pillar. ``pillar.example`` results in the generation
|
||||||
of the default ``sshd_config`` file on Debian Wheezy.
|
of the default ``sshd_config`` file on Debian Wheezy.
|
||||||
|
|
||||||
``openssh.client``
|
|
||||||
------------------
|
|
||||||
|
|
||||||
Installs the openssh client package.
|
|
||||||
|
|
||||||
``openssh.banner``
|
|
||||||
------------------
|
|
||||||
|
|
||||||
Installs a banner that users see when SSH-ing in.
|
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
include:
|
||||||
|
- openssh
|
||||||
|
|
||||||
|
{% from "openssh/map.jinja" import openssh with context %}
|
||||||
|
{% set openssh_pillar = pillar.get('openssh', {}) %}
|
||||||
|
{% set auth = openssh_pillar.get('auth', {}) %}
|
||||||
|
{% for user,keys in auth.items() -%}
|
||||||
|
{% for key in keys -%}
|
||||||
|
{% if 'present' in key and key['present'] %}
|
||||||
|
{{ key['name'] }}:
|
||||||
|
ssh_auth.present:
|
||||||
|
- user: {{ user }}
|
||||||
|
{% if 'source' in key %}
|
||||||
|
- source: {{ key['source'] }}
|
||||||
|
{% else %}
|
||||||
|
{% if 'enc' in key %}
|
||||||
|
- enc: {{ key['enc'] }}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'comment' in key %}
|
||||||
|
- comment: {{ key['comment'] }}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'options' in key %}
|
||||||
|
- options: {{ key['options'] }}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
- require:
|
||||||
|
- service: {{ openssh.service }}
|
||||||
|
{% else %}
|
||||||
|
{{ key['name'] }}:
|
||||||
|
ssh_auth.absent:
|
||||||
|
- user: {{ user }}
|
||||||
|
{% if 'enc' in key %}
|
||||||
|
- enc: {{ key['enc'] }}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'comment' in key %}
|
||||||
|
- comment: {{ key['comment'] }}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'options' in key %}
|
||||||
|
- options: {{ key['options'] }}
|
||||||
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endfor %}
|
|
@ -1,4 +1,5 @@
|
||||||
{% set sshd_config = pillar.get('sshd_config', {}) %}
|
{% set openssh_pillar = pillar.get('openssh', {}) %}
|
||||||
|
{% set sshd_config = openssh_pillar.get('sshd_config', {}) %}
|
||||||
|
|
||||||
# This file is managed by salt. Manual changes risk being overwritten.
|
# This file is managed by salt. Manual changes risk being overwritten.
|
||||||
# The contents of the original sshd_config are kept on the bottom for
|
# The contents of the original sshd_config are kept on the bottom for
|
||||||
|
|
|
@ -1,30 +1,43 @@
|
||||||
sshd_config:
|
openssh:
|
||||||
Port: 22
|
sshd_config:
|
||||||
Protocol: 2
|
Port: 22
|
||||||
HostKey:
|
Protocol: 2
|
||||||
- /etc/ssh/ssh_host_rsa_key
|
HostKey:
|
||||||
- /etc/ssh/ssh_host_dsa_key
|
- /etc/ssh/ssh_host_rsa_key
|
||||||
- /etc/ssh/ssh_host_ecdsa_key
|
- /etc/ssh/ssh_host_dsa_key
|
||||||
UsePrivilegeSeparation: yes
|
- /etc/ssh/ssh_host_ecdsa_key
|
||||||
KeyRegenerationInterval: 3600
|
UsePrivilegeSeparation: yes
|
||||||
ServerKeyBits: 768
|
KeyRegenerationInterval: 3600
|
||||||
SyslogFacility: AUTH
|
ServerKeyBits: 768
|
||||||
LogLevel: INFO
|
SyslogFacility: AUTH
|
||||||
LoginGraceTime: 120
|
LogLevel: INFO
|
||||||
PermitRootLogin: yes
|
LoginGraceTime: 120
|
||||||
StrictModes: yes
|
PermitRootLogin: yes
|
||||||
RSAAuthentication: yes
|
StrictModes: yes
|
||||||
PubkeyAuthentication: yes
|
RSAAuthentication: yes
|
||||||
IgnoreRhosts: yes
|
PubkeyAuthentication: yes
|
||||||
RhostsRSAAuthentication: no
|
IgnoreRhosts: yes
|
||||||
HostbasedAuthentication: no
|
RhostsRSAAuthentication: no
|
||||||
PermitEmptyPasswords: no
|
HostbasedAuthentication: no
|
||||||
ChallengeResponseAuthentication: no
|
PermitEmptyPasswords: no
|
||||||
X11Forwarding: yes
|
ChallengeResponseAuthentication: no
|
||||||
X11DisplayOffset: 10
|
X11Forwarding: yes
|
||||||
PrintMotd: no
|
X11DisplayOffset: 10
|
||||||
PrintLastLog: yes
|
PrintMotd: no
|
||||||
TCPKeepAlive: yes
|
PrintLastLog: yes
|
||||||
AcceptEnv: "LANG LC_*"
|
TCPKeepAlive: yes
|
||||||
Subsystem: "sftp /usr/lib/openssh/sftp-server"
|
AcceptEnv: "LANG LC_*"
|
||||||
UsePAM: yes
|
Subsystem: "sftp /usr/lib/openssh/sftp-server"
|
||||||
|
UsePAM: yes
|
||||||
|
|
||||||
|
auth:
|
||||||
|
joe:
|
||||||
|
- name: JOE_VALID_SSH_PUBLIC_KEY
|
||||||
|
present: True
|
||||||
|
enc: ssh-rsa
|
||||||
|
comment: main key
|
||||||
|
- name: JOE_NON_VALID_SSH_PUBLIC_KEY
|
||||||
|
present: False
|
||||||
|
enc: ssh-rsa
|
||||||
|
comment: obsolete key - removed
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue