mirror of
https://github.com/willshersystems/ansible-sshd
synced 2024-12-24 01:20:18 +01:00
tests: Replace cat with slurp
This commit is contained in:
parent
a1ee1c0f77
commit
ff04f6ff89
4 changed files with 25 additions and 21 deletions
|
@ -51,7 +51,8 @@
|
||||||
register: root_effective
|
register: root_effective
|
||||||
|
|
||||||
- name: Print current configuration file
|
- name: Print current configuration file
|
||||||
command: "cat {{ main_sshd_config }}"
|
slurp:
|
||||||
|
src: "{{ main_sshd_config }}"
|
||||||
register: config
|
register: config
|
||||||
|
|
||||||
- name: Check the options are effective
|
- name: Check the options are effective
|
||||||
|
@ -70,8 +71,8 @@
|
||||||
- name: Check the options are in configuration file
|
- name: Check the options are in configuration file
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'Match User xusers' in config.stdout"
|
- "'Match User xusers' in config.content | b64decode"
|
||||||
- "'Match User bot' in config.stdout"
|
- "'Match User bot' in config.content | b64decode"
|
||||||
- "'Match User sftponly' in config.stdout"
|
- "'Match User sftponly' in config.content | b64decode"
|
||||||
- "'Match User root' in config.stdout"
|
- "'Match User root' in config.content | b64decode"
|
||||||
tags: tests::verify
|
tags: tests::verify
|
||||||
|
|
|
@ -49,7 +49,8 @@
|
||||||
register: root_effective
|
register: root_effective
|
||||||
|
|
||||||
- name: Print current configuration file
|
- name: Print current configuration file
|
||||||
command: "cat {{ main_sshd_config }}"
|
slurp:
|
||||||
|
src: "{{ main_sshd_config }}"
|
||||||
register: config
|
register: config
|
||||||
|
|
||||||
- name: Check the options are effective
|
- name: Check the options are effective
|
||||||
|
@ -68,8 +69,8 @@
|
||||||
- name: Check the options are in configuration file
|
- name: Check the options are in configuration file
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'Match User xusers' in config.stdout"
|
- "'Match User xusers' in config.content | b64decode"
|
||||||
- "'Match User bot' in config.stdout"
|
- "'Match User bot' in config.content | b64decode"
|
||||||
- "'Match User sftponly' in config.stdout"
|
- "'Match User sftponly' in config.content | b64decode"
|
||||||
- "'Match User root' in config.stdout"
|
- "'Match User root' in config.content | b64decode"
|
||||||
tags: tests::verify
|
tags: tests::verify
|
||||||
|
|
|
@ -21,7 +21,8 @@
|
||||||
register: runtime
|
register: runtime
|
||||||
|
|
||||||
- name: Print current configuration file
|
- name: Print current configuration file
|
||||||
command: cat /etc/ssh/sshd_config
|
slurp:
|
||||||
|
src: /etc/ssh/sshd_config
|
||||||
register: config
|
register: config
|
||||||
|
|
||||||
- name: Check the options are effective
|
- name: Check the options are effective
|
||||||
|
@ -36,8 +37,8 @@
|
||||||
- name: Check the options are in configuration file
|
- name: Check the options are in configuration file
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'AcceptEnv LANG' in config.stdout"
|
- "'AcceptEnv LANG' in config.content | b64decode"
|
||||||
- "'Banner /etc/issue' in config.stdout"
|
- "'Banner /etc/issue' in config.content | b64decode"
|
||||||
- "'Ciphers aes256-gcm@openssh.com' in config.stdout"
|
- "'Ciphers aes256-gcm@openssh.com' in config.content | b64decode"
|
||||||
- "'Subsystem sftp internal-sftp' in config.stdout"
|
- "'Subsystem sftp internal-sftp' in config.content | b64decode"
|
||||||
tags: tests::verify
|
tags: tests::verify
|
||||||
|
|
|
@ -14,15 +14,16 @@
|
||||||
- meta: flush_handlers
|
- meta: flush_handlers
|
||||||
|
|
||||||
- name: Print current configuration file
|
- name: Print current configuration file
|
||||||
command: cat /etc/sysconfig/sshd
|
slurp:
|
||||||
|
src: /etc/sysconfig/sshd
|
||||||
register: config
|
register: config
|
||||||
|
|
||||||
- name: Check the crypto policies is overridden in RHEL 8
|
- name: Check the crypto policies is overridden in RHEL 8
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'CRYPTO_POLICY=' in config.stdout_lines"
|
- "'CRYPTO_POLICY=' in config.content | b64decode"
|
||||||
# these are string variants in default configuration file
|
# these are string variants in default configuration file
|
||||||
- "'# CRYPTO_POLICY=' not in config.stdout_lines"
|
- "'# CRYPTO_POLICY=' not in config.content | b64decode"
|
||||||
when:
|
when:
|
||||||
- ansible_facts['os_family'] == "RedHat"
|
- ansible_facts['os_family'] == "RedHat"
|
||||||
- ansible_facts['distribution_major_version'] == "8"
|
- ansible_facts['distribution_major_version'] == "8"
|
||||||
|
@ -30,10 +31,10 @@
|
||||||
- name: Check the RNG options are in configuration file
|
- name: Check the RNG options are in configuration file
|
||||||
assert:
|
assert:
|
||||||
that:
|
that:
|
||||||
- "'SSH_USE_STRONG_RNG=32' in config.stdout_lines"
|
- "'SSH_USE_STRONG_RNG=32' in config.content | b64decode"
|
||||||
# these are string variants in default configuration file
|
# these are string variants in default configuration file
|
||||||
- "'SSH_USE_STRONG_RNG=0' not in config.stdout_lines"
|
- "'SSH_USE_STRONG_RNG=0' not in config.content | b64decode"
|
||||||
- "'# SSH_USE_STRONG_RNG=1' not in config.stdout_lines"
|
- "'# SSH_USE_STRONG_RNG=1' not in config.content | b64decode"
|
||||||
when:
|
when:
|
||||||
- ansible_facts['os_family'] == "RedHat"
|
- ansible_facts['os_family'] == "RedHat"
|
||||||
- ansible_facts['distribution'] != 'Fedora'
|
- ansible_facts['distribution'] != 'Fedora'
|
||||||
|
|
Loading…
Reference in a new issue