mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-11-25 04:20:18 +01:00
Support __sshd_supports_validate
This commit is contained in:
parent
1cf57fe318
commit
c201ba2060
4 changed files with 14 additions and 3 deletions
|
@ -103,6 +103,7 @@
|
|||
changed_when: false
|
||||
when:
|
||||
- __sshd_hostkeys_from_config | from_json == []
|
||||
- __sshd_supports_validate
|
||||
|
||||
- name: Generate temporary hostkey
|
||||
ansible.builtin.command: >
|
||||
|
|
|
@ -16,7 +16,9 @@
|
|||
group: "{{ sshd_config_group }}"
|
||||
mode: "{{ sshd_config_mode }}"
|
||||
validate: >-
|
||||
{% if sshd_test_hostkey is defined and sshd_test_hostkey.path is defined %}
|
||||
{% if not __sshd_supports_validate %}
|
||||
true %s
|
||||
{% elif sshd_test_hostkey is defined and sshd_test_hostkey.path is defined %}
|
||||
{{ sshd_binary }} -t -f %s -h {{ sshd_test_hostkey.path }}/rsa_key
|
||||
{% else %}
|
||||
{{ sshd_binary }} -t -f %s
|
||||
|
@ -33,7 +35,9 @@
|
|||
group: "{{ sshd_config_group }}"
|
||||
mode: "{{ sshd_config_mode }}"
|
||||
validate: >-
|
||||
{% if sshd_test_hostkey is defined and sshd_test_hostkey.path is defined %}
|
||||
{% if not __sshd_supports_validate %}
|
||||
true %s
|
||||
{% elif sshd_test_hostkey is defined and sshd_test_hostkey.path is defined %}
|
||||
{{ sshd_binary }} -t -f %s -h {{ sshd_test_hostkey.path }}/rsa_key
|
||||
{% else %}
|
||||
{{ sshd_binary }} -t -f %s
|
||||
|
|
|
@ -13,7 +13,9 @@
|
|||
create: yes
|
||||
marker: "# {mark} sshd system role managed block: namespace {{ sshd_config_namespace }}"
|
||||
validate: >-
|
||||
{% if sshd_test_hostkey is defined and sshd_test_hostkey.path is defined %}
|
||||
{% if not __sshd_supports_validate %}
|
||||
true %s
|
||||
{% elif sshd_test_hostkey is defined and sshd_test_hostkey.path is defined %}
|
||||
{{ sshd_binary }} -t -f %s -h {{ sshd_test_hostkey.path }}/rsa_key
|
||||
{% else %}
|
||||
{{ sshd_binary }} -t -f %s
|
||||
|
|
|
@ -47,3 +47,7 @@ __sshd_drop_in_dir_mode: '0755'
|
|||
# This is usually the case when the selection is up to the OpenSSH defaults or
|
||||
# drop-in directory is used.
|
||||
__sshd_verify_hostkeys_default: []
|
||||
|
||||
# This switch can control if the validate step is supported by the target OS.
|
||||
# This is useful for very old OpenSSH or for tests that generate invalid configurations
|
||||
__sshd_supports_validate: true
|
||||
|
|
Loading…
Reference in a new issue