evolinux-base: Validate sshd config with "sshd -t"

See #52 - It seems the behaviour changed with the recent releases, -T 
that does an extended test now fails on "Match" blocks when no context 
is given through -C
This commit is contained in:
Ludovic Poujol 2019-06-17 09:47:22 +02:00
parent 20a4c082d7
commit 334b8a3f0d

View file

@ -23,7 +23,7 @@
Match Group evolix
PasswordAuthentication no
insertafter: EOF
validate: '/usr/sbin/sshd -T -f %s'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when:
- evolinux_ssh_password_auth_addresses != []
@ -37,7 +37,7 @@
Match Address {{ evolinux_ssh_password_auth_addresses | join(',') }}
PasswordAuthentication yes
insertafter: EOF
validate: '/usr/sbin/sshd -T -f %s'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when:
- evolinux_ssh_password_auth_addresses != []
@ -82,7 +82,7 @@
dest: /etc/ssh/sshd_config
line: "\nAllowUsers {{ logname.stdout }}"
insertafter: 'Subsystem'
validate: '/usr/sbin/sshd -T -f %s'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when: evolinux_ssh_allow_current_user and grep_allowusers_ssh.rc != 0
@ -91,7 +91,7 @@
dest: /etc/ssh/sshd_config
regexp: '^(AllowUsers ((?!{{ logname.stdout }}).)*)$'
replace: '\1 {{ logname.stdout }}'
validate: '/usr/sbin/sshd -T -f %s'
validate: '/usr/sbin/sshd -t -f %s'
notify: reload sshd
when: evolinux_ssh_allow_current_user and grep_allowusers_ssh.rc == 0