updated ssh state

This commit is contained in:
Paul 2020-10-10 14:14:08 +02:00
parent 55720e0fd0
commit 475de43f3c
4 changed files with 22 additions and 4 deletions

View File

@ -1,4 +1,12 @@
--- ---
ssh-ssh-config:
file.managed:
- name: /etc/ssh/ssh_config
- source: salt://ssh/ssh_config.j2
- template: jinja
- user: root
- mode: 0644
ssh-sshd-config: ssh-sshd-config:
file.managed: file.managed:
- name: /etc/ssh/sshd_config - name: /etc/ssh/sshd_config

View File

@ -3,7 +3,8 @@ ssh:
enabled: true enabled: true
pkgs: pkgs:
- 'openssh-server' - 'openssh-server'
config: - 'openssh-client'
sshd_config:
LoginGraceTime: 60 LoginGraceTime: 60
PermitRootLogin: 'no' PermitRootLogin: 'no'
MaxAuthTries: 3 MaxAuthTries: 3
@ -11,5 +12,7 @@ ssh:
PasswordAuthentication: 'no' PasswordAuthentication: 'no'
VersionAddendum: none VersionAddendum: none
Subsystem: sftp /usr/lib/openssh/sftp-server Subsystem: sftp /usr/lib/openssh/sftp-server
AllowGroups: root AllowGroups: admin
X11Forwarding: 'yes' X11Forwarding: 'yes'
ssh_config:
ForwardAgent: yes

7
states/ssh/ssh_config.j2 Normal file
View File

@ -0,0 +1,7 @@
## {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
{%- from "ssh/map.jinja" import ssh with context %}
{%- for key, value in ssh.ssh_config.items() %}
{{ key }} {{ value }}
{%- endfor %}

View File

@ -12,7 +12,7 @@
{%- do net6.append( value.ip + "/" + value.mask ) -%} {%- do net6.append( value.ip + "/" + value.mask ) -%}
{%- endfor -%} {%- endfor -%}
{%- for key, value in ssh.config.items() %} {%- for key, value in ssh.sshd_config.items() %}
{{ key }} {{ value }} {{ key }} {{ value }}
{%- endfor %} {%- endfor %}
Match Address {{ net4|join(',') }} Match Address {{ net4|join(',') }}