From 5e9033f500cfa0cc5c06867ebdccd9e6b3298498 Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Sun, 27 Sep 2020 20:16:39 +0200 Subject: [PATCH 1/2] test(inspec): `_mapdata` files should have `tofs` configuration --- .../default/files/_mapdata/amazonlinux-1.yaml | 10 ++++++++++ .../default/files/_mapdata/amazonlinux-2.yaml | 10 ++++++++++ .../default/files/_mapdata/arch-base-latest.yaml | 10 ++++++++++ test/integration/default/files/_mapdata/centos-6.yaml | 10 ++++++++++ test/integration/default/files/_mapdata/centos-7.yaml | 10 ++++++++++ test/integration/default/files/_mapdata/centos-8.yaml | 10 ++++++++++ test/integration/default/files/_mapdata/debian-10.yaml | 10 ++++++++++ test/integration/default/files/_mapdata/debian-9.yaml | 10 ++++++++++ test/integration/default/files/_mapdata/fedora-31.yaml | 10 ++++++++++ test/integration/default/files/_mapdata/fedora-32.yaml | 10 ++++++++++ .../default/files/_mapdata/opensuse-15.yaml | 10 ++++++++++ test/integration/default/files/_mapdata/ubuntu-16.yaml | 10 ++++++++++ test/integration/default/files/_mapdata/ubuntu-18.yaml | 10 ++++++++++ test/integration/default/files/_mapdata/ubuntu-20.yaml | 10 ++++++++++ 14 files changed, 140 insertions(+) diff --git a/test/integration/default/files/_mapdata/amazonlinux-1.yaml b/test/integration/default/files/_mapdata/amazonlinux-1.yaml index 7566157..b18b022 100644 --- a/test/integration/default/files/_mapdata/amazonlinux-1.yaml +++ b/test/integration/default/files/_mapdata/amazonlinux-1.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/amazonlinux-2.yaml b/test/integration/default/files/_mapdata/amazonlinux-2.yaml index ff39b52..17e0c9f 100644 --- a/test/integration/default/files/_mapdata/amazonlinux-2.yaml +++ b/test/integration/default/files/_mapdata/amazonlinux-2.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/arch-base-latest.yaml b/test/integration/default/files/_mapdata/arch-base-latest.yaml index 90d1d26..471eafb 100644 --- a/test/integration/default/files/_mapdata/arch-base-latest.yaml +++ b/test/integration/default/files/_mapdata/arch-base-latest.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/centos-6.yaml b/test/integration/default/files/_mapdata/centos-6.yaml index 4c05c6b..df92a76 100644 --- a/test/integration/default/files/_mapdata/centos-6.yaml +++ b/test/integration/default/files/_mapdata/centos-6.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/centos-7.yaml b/test/integration/default/files/_mapdata/centos-7.yaml index 9e37cb8..a9df180 100644 --- a/test/integration/default/files/_mapdata/centos-7.yaml +++ b/test/integration/default/files/_mapdata/centos-7.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/centos-8.yaml b/test/integration/default/files/_mapdata/centos-8.yaml index c0e6c76..f125f56 100644 --- a/test/integration/default/files/_mapdata/centos-8.yaml +++ b/test/integration/default/files/_mapdata/centos-8.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/debian-10.yaml b/test/integration/default/files/_mapdata/debian-10.yaml index c6c148f..7c93e85 100644 --- a/test/integration/default/files/_mapdata/debian-10.yaml +++ b/test/integration/default/files/_mapdata/debian-10.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/debian-9.yaml b/test/integration/default/files/_mapdata/debian-9.yaml index 6a4436c..9dd8a08 100644 --- a/test/integration/default/files/_mapdata/debian-9.yaml +++ b/test/integration/default/files/_mapdata/debian-9.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/fedora-31.yaml b/test/integration/default/files/_mapdata/fedora-31.yaml index b61b597..caebd27 100644 --- a/test/integration/default/files/_mapdata/fedora-31.yaml +++ b/test/integration/default/files/_mapdata/fedora-31.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/fedora-32.yaml b/test/integration/default/files/_mapdata/fedora-32.yaml index 1981214..3a50629 100644 --- a/test/integration/default/files/_mapdata/fedora-32.yaml +++ b/test/integration/default/files/_mapdata/fedora-32.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/opensuse-15.yaml b/test/integration/default/files/_mapdata/opensuse-15.yaml index fc1eddc..4e25e10 100644 --- a/test/integration/default/files/_mapdata/opensuse-15.yaml +++ b/test/integration/default/files/_mapdata/opensuse-15.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/ubuntu-16.yaml b/test/integration/default/files/_mapdata/ubuntu-16.yaml index ebf0904..7124114 100644 --- a/test/integration/default/files/_mapdata/ubuntu-16.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-16.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/ubuntu-18.yaml b/test/integration/default/files/_mapdata/ubuntu-18.yaml index d560513..2b00d0f 100644 --- a/test/integration/default/files/_mapdata/ubuntu-18.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-18.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': diff --git a/test/integration/default/files/_mapdata/ubuntu-20.yaml b/test/integration/default/files/_mapdata/ubuntu-20.yaml index 2bf6e3e..8d2d7d0 100644 --- a/test/integration/default/files/_mapdata/ubuntu-20.yaml +++ b/test/integration/default/files/_mapdata/ubuntu-20.yaml @@ -151,6 +151,16 @@ openssh: sshd_config_src: sshd_config sshd_config_user: root sshd_enable: true + tofs: + source_files: + manage ssh_known_hosts file: + - alt_ssh_known_hosts + ssh_config: + - alt_ssh_config + sshd_banner: + - fire_banner + sshd_config: + - alt_sshd_config ssh_config: Hosts: '*': From c0d5052f6a4f86ed78df5f79f4848f24113dbe1a Mon Sep 17 00:00:00 2001 From: Daniel Dehennin Date: Sun, 27 Sep 2020 20:17:05 +0200 Subject: [PATCH 2/2] fix(pillar): `tofs` must not be under `mine_functions` The debug output of test jobs don't show the use of TOFS as it should and the pillar.example show that `tofs` is under `mine_functions` instead of `openssh`. * pillar.example: move `tofs` under `openssh`. * test/salt/pillar/default.sls: ditoo. --- pillar.example | 20 ++++++++++---------- test/salt/pillar/default.sls | 20 ++++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/pillar.example b/pillar.example index 2c86d92..bf3a0f6 100644 --- a/pillar.example +++ b/pillar.example @@ -361,16 +361,6 @@ openssh: # salt://files/ssh/moduli.hash # These will be automatically referenced to by the ssh_moduli state. -# Required for openssh.known_hosts -mine_functions: - public_ssh_host_keys: - mine_function: cmd.run - cmd: cat /etc/ssh/ssh_host_*_key.pub - python_shell: true - public_ssh_hostname: - mine_function: grains.get - key: id - tofs: # The files_switch key serves as a selector for alternative # directories under the formula files directory. See TOFS pattern @@ -399,3 +389,13 @@ mine_functions: - alt_ssh_config sshd_banner: - fire_banner + +# Required for openssh.known_hosts +mine_functions: + public_ssh_host_keys: + mine_function: cmd.run + cmd: cat /etc/ssh/ssh_host_*_key.pub + python_shell: true + public_ssh_hostname: + mine_function: grains.get + key: id diff --git a/test/salt/pillar/default.sls b/test/salt/pillar/default.sls index be0af66..664b4cd 100644 --- a/test/salt/pillar/default.sls +++ b/test/salt/pillar/default.sls @@ -189,16 +189,6 @@ openssh: # salt://files/ssh/moduli.hash # These will be automatically referenced to by the ssh_moduli state. -# Required for openssh.known_hosts -mine_functions: - public_ssh_host_keys: - mine_function: cmd.run - cmd: cat /etc/ssh/ssh_host_*_key.pub - python_shell: true - public_ssh_hostname: - mine_function: grains.get - key: id - tofs: # The files_switch key serves as a selector for alternative # directories under the formula files directory. See TOFS pattern @@ -227,3 +217,13 @@ mine_functions: - alt_ssh_config sshd_banner: - fire_banner + +# Required for openssh.known_hosts +mine_functions: + public_ssh_host_keys: + mine_function: cmd.run + cmd: cat /etc/ssh/ssh_host_*_key.pub + python_shell: true + public_ssh_hostname: + mine_function: grains.get + key: id