tests: Verify the main configuration file contains Include directive if needed

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
This commit is contained in:
Jakub Jelen 2022-04-06 16:07:31 +02:00 committed by Jakub Jelen
parent 9c202bd60e
commit e1e820428d
2 changed files with 22 additions and 0 deletions

View file

@ -38,6 +38,7 @@
Banner: /etc/issue Banner: /etc/issue
Ciphers: aes256-ctr Ciphers: aes256-ctr
sshd_Compression: no sshd_Compression: no
- name: Configure second alternative sshd_config file - name: Configure second alternative sshd_config file
include_role: include_role:
name: ansible-sshd name: ansible-sshd
@ -49,6 +50,7 @@
Banner: /etc/issue2 Banner: /etc/issue2
Ciphers: aes128-ctr Ciphers: aes128-ctr
sshd_MaxStartups: 100 sshd_MaxStartups: 100
- name: Now configure the main sshd_config file - name: Now configure the main sshd_config file
include_role: include_role:
name: ansible-sshd name: ansible-sshd
@ -114,6 +116,16 @@
- "'MaxStartups 100' not in config3.content | b64decode" - "'MaxStartups 100' not in config3.content | b64decode"
- "'Compression no' not in config3.content | b64decode" - "'Compression no' not in config3.content | b64decode"
- name: Check the main configuration file contains some default values for RHEL 9 or Fedora
assert:
that:
- "'Include /etc/ssh/sshd_config.d/*.conf' in config3.content | b64decode"
- "'AuthorizedKeysFile .ssh/authorized_keys' in config3.content | b64decode"
- "'Subsystem sftp /usr/libexec/sftp-server' in config3.content | b64decode"
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version']|int > 8
- name: Check the generated config has requested properties - name: Check the generated config has requested properties
assert: assert:
that: that:

View file

@ -130,6 +130,16 @@
- "'MaxStartups 100' not in config3.content | b64decode" - "'MaxStartups 100' not in config3.content | b64decode"
- "'Compression no' not in config3.content | b64decode" - "'Compression no' not in config3.content | b64decode"
- name: Check the main configuration file contains some default values for RHEL 9 or Fedora
assert:
that:
- "'Include /etc/ssh/sshd_config.d/*.conf' in config3.content | b64decode"
- "'AuthorizedKeysFile .ssh/authorized_keys' in config3.content | b64decode"
- "'Subsystem sftp /usr/libexec/sftp-server' in config3.content | b64decode"
when:
- ansible_facts['os_family'] == 'RedHat'
- ansible_facts['distribution_major_version']|int > 8
- name: Check the generated config has requested properties - name: Check the generated config has requested properties
assert: assert:
that: that: