From 2b5a2a4763275a5086e7ebd2e6cfe121f6e4eb03 Mon Sep 17 00:00:00 2001 From: Steffen Zieger Date: Tue, 15 Oct 2024 12:00:54 +0200 Subject: [PATCH] fix tests after adding support for sshd include_dir, refs #390 (#397) --- data/RedHat-7.yaml | 2 -- metadata.json | 8 -------- spec/classes/init_spec.rb | 11 +++++++++++ spec/classes/server_spec.rb | 6 ++++++ 4 files changed, 17 insertions(+), 10 deletions(-) delete mode 100644 data/RedHat-7.yaml diff --git a/data/RedHat-7.yaml b/data/RedHat-7.yaml deleted file mode 100644 index 9ee7359d..00000000 --- a/data/RedHat-7.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -ssh::server::host_priv_key_group: 'ssh_keys' diff --git a/metadata.json b/metadata.json index f95c111e..feb73270 100644 --- a/metadata.json +++ b/metadata.json @@ -41,14 +41,6 @@ "9" ] }, - { - "operatingsystem": "Scientific", - "operatingsystemrelease": [ - "7", - "8", - "9" - ] - }, { "operatingsystem": "Debian", "operatingsystemrelease": [ diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 285421bf..738bce0d 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -67,6 +67,17 @@ ssh_config_expected_custom = "# File managed by Puppet\n\nHostFoo\n HostName bar\nSomeOtherKey someValue\nHost *\n HashKnownHosts yes\n SendEnv LANG LC_*\n" sshd_config_default = "# File is managed by Puppet\n\nAcceptEnv LANG LC_*\nChallengeResponseAuthentication no\nPrintMotd no\nSubsystem sftp #{sftp_server_path}\nX11Forwarding yes\n" sshd_config_custom = "# File is managed by Puppet\n\nAcceptEnv LANG LC_*\nChallengeResponseAuthentication no\nPrintMotd no\nSomeOtherKey someValue\nSubsystem sftp #{sftp_server_path}\nUsePAM no\nX11Forwarding no\n" + when 'RedHat' + ssh_config_expected_default = "# File managed by Puppet\n\nHost *\n HashKnownHosts yes\n SendEnv LANG LC_*\n" + ssh_config_expected_custom = "# File managed by Puppet\n\nHostFoo\n HostName bar\nSomeOtherKey someValue\nHost *\n HashKnownHosts yes\n SendEnv LANG LC_*\n" + + if os_facts[:os]['release']['major'] == '8' + sshd_config_default = "# File is managed by Puppet\n\nAcceptEnv LANG LC_*\nChallengeResponseAuthentication no\nPrintMotd no\nSubsystem sftp #{sftp_server_path}\nUsePAM yes\nX11Forwarding yes\n" + sshd_config_custom = "# File is managed by Puppet\n\nAcceptEnv LANG LC_*\nChallengeResponseAuthentication no\nPrintMotd no\nSomeOtherKey someValue\nSubsystem sftp #{sftp_server_path}\nUsePAM no\nX11Forwarding no\n" + else + sshd_config_default = "# File is managed by Puppet\nInclude /etc/ssh/sshd_config.d/*.conf\n\nAcceptEnv LANG LC_*\nChallengeResponseAuthentication no\nPrintMotd no\nSubsystem sftp #{sftp_server_path}\nUsePAM yes\nX11Forwarding yes\n" + sshd_config_custom = "# File is managed by Puppet\nInclude /etc/ssh/sshd_config.d/*.conf\n\nAcceptEnv LANG LC_*\nChallengeResponseAuthentication no\nPrintMotd no\nSomeOtherKey someValue\nSubsystem sftp #{sftp_server_path}\nUsePAM no\nX11Forwarding no\n" + end else ssh_config_expected_default = "# File managed by Puppet\n\nHost *\n HashKnownHosts yes\n SendEnv LANG LC_*\n" ssh_config_expected_custom = "# File managed by Puppet\n\nHostFoo\n HostName bar\nSomeOtherKey someValue\nHost *\n HashKnownHosts yes\n SendEnv LANG LC_*\n" diff --git a/spec/classes/server_spec.rb b/spec/classes/server_spec.rb index 2305a986..a5266ef0 100644 --- a/spec/classes/server_spec.rb +++ b/spec/classes/server_spec.rb @@ -23,6 +23,12 @@ sshd_config_custom = case os_facts[:os]['family'] when 'Solaris' "# File is managed by Puppet\n\nChallengeResponseAuthentication no\nHostKey /etc/ssh/ssh_host_rsa_key\nHostKey /etc/ssh/ssh_host_dsa_key\nPrintMotd no\nSomeOtherKey someValue\nSubsystem sftp /some/path\nUsePAM no\nX11Forwarding no\n" + when 'RedHat' + if os_facts[:os]['release']['major'] == '8' + "# File is managed by Puppet\n\nAcceptEnv LANG LC_*\nChallengeResponseAuthentication no\nPrintMotd no\nSomeOtherKey someValue\nSubsystem sftp /some/path\nUsePAM no\nX11Forwarding no\n" + else + "# File is managed by Puppet\nInclude /etc/ssh/sshd_config.d/*.conf\n\nAcceptEnv LANG LC_*\nChallengeResponseAuthentication no\nPrintMotd no\nSomeOtherKey someValue\nSubsystem sftp /some/path\nUsePAM no\nX11Forwarding no\n" + end else "# File is managed by Puppet\n\nAcceptEnv LANG LC_*\nChallengeResponseAuthentication no\nPrintMotd no\nSomeOtherKey someValue\nSubsystem sftp /some/path\nUsePAM no\nX11Forwarding no\n" end