Skip to content

Commit 07bf484

Browse files
Merge pull request #2138 from craigcomstock/ent-13804
fix: build host policy: fail2ban install requires epel-release for all redhat-based platforms
2 parents aa105bc + 5d523db commit 07bf484

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

ci/cfengine-build-host-setup.cf

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,14 @@ bundle agent cfengine_build_host_setup
126126
"xfsprogs";
127127

128128
# note that shellcheck, fakeroot and ccache require epel-release to be installed
129-
!(redhat_8|centos_8).(redhat|centos).(yum_dnf_conf_ok)::
129+
# epel-release is installed by distribution package in rhel-7 and by URL for rhel-8+ later in commands section
130+
(redhat_7|centos_7).(yum_dnf_conf_ok)::
130131
"epel-release"
131-
comment => "centos-8/rhel-8 at least in AWS has no epel-release package to install so later we will install with downloaded rpm from dl.fedoraproject.org";
132+
classes => results( "bundle", "epel_release" );
132133

133-
!(redhat_7|centos_7|redhat_8|centos_8).(yum_dnf_conf_ok)::
134-
"fail2ban"
135-
comment => "Ban IPs with repeated failed SSH auth attempts";
136-
(redhat_7|centos_7|redhat_8|centos_8).(yum_dnf_conf_ok)::
134+
!(redhat_7|centos_7).(redhat|centos).(yum_dnf_conf_ok).epel_release_ok::
137135
"fail2ban-server"
138-
comment => "Ban IPs with repeated failed SSH auth attempts. On centos-7 .noarch must be specified as there are conflicting sub-packages attempted with legacy packages promise as fail2ban-*.*.";
136+
comment => "Ban IPs with repeated failed SSH auth attempts. On centos/rhel 8+ we must specify individual packages instead of just fail2ban as package method will append -*.* which would include conflicting shorewall and shorewall-lite packages.";
139137
"fail2ban-sendmail";
140138
"fail2ban-firewalld";
141139
"ccache";
@@ -211,14 +209,15 @@ bundle agent cfengine_build_host_setup
211209
linux::
212210
"have_tmp_mount" expression => returnszero("mount | grep '/tmp'", "useshell");
213211
"have_coredumpctl" expression => returnszero("command -v coredumpctl", "useshell");
214-
"missing_opt_jdk21" expression => not(fileexists("/opt/jdk-21.0.8"));
212+
"missing_java" expression => not(fileexists("/usr/bin/java"));
215213
(redhat|centos).!(redhat_6|centos_6|redhat_7|centos_7)::
216214
"yum_conf_ok" expression => returnszero("grep best=False /etc/yum.conf >/dev/null", "useshell");
217215
redhat_6|centos_6|redhat_7|centos_7::
218216
"yum_conf_ok" expression => "any"; # rhel/centos-6 and 7 do not support --nobest or best property in yum.conf
219217
redhat_8|centos_8::
220218
"have_fakeroot" expression => returnszero("command -v fakeroot >/dev/null", "useshell");
221-
"epel_release_installed" expression => returnszero("yum info --installed epel-release", "useshell");
219+
(redhat|centos)::
220+
"epel_release_ok" expression => returnszero("yum info --installed epel-release", "useshell");
222221
(redhat_8|centos_8).have_perl::
223222
"have_data_dumper" expression => returnszero("cpan -l | grep Data::Dumper", "useshell");
224223
"have_data_dumper_names" expression => returnszero("cpan -l | grep Data::Dumper::Names", "useshell");
@@ -247,16 +246,17 @@ bundle agent cfengine_build_host_setup
247246
"sysctl kernel.core_pattern='|/lib/systemd/systemd-coredump %p %u %g %s %t %e'" -> { "ENT-12669" }
248247
comment => "Ensure that core_pattern is proper for systemd-coredump if coredumpctl is present.",
249248
contain => in_shell;
250-
missing_opt_jdk21::
249+
missing_java::
251250
"sh $(this.promise_dirname)/linux-install-jdk21.sh" contain => in_shell;
252251
(redhat_7|centos_7|redhat_8|centos_8|redhat_9|redhat_10).(!have_development_tools).(yum_dnf_conf_ok)::
253252
"yum groups install -y 'Development Tools'" contain => in_shell;
254253
(redhat_8|centos_8).!have_fakeroot:: # special fakeroot, missing from _8 an d up?
255254
"sudo rpm -iv https://kojipkgs.fedoraproject.org//packages/fakeroot/1.23/1.fc29/x86_64/fakeroot-1.23-1.fc29.x86_64.rpm https://kojipkgs.fedoraproject.org//packages/fakeroot/1.23/1.fc29/x86_64/fakeroot-libs-1.23-1.fc29.x86_64.rpm"
256255
contain => in_shell;
257-
(redhat_8|centos_8).!epel_release_installed::
258-
"yum install --assumeyes https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm"
259-
comment => "TODO: check a sha for the epel-release-latest-8.noarch.rpm file",
256+
(redhat|centos).!(redhat_7|centos_7).!epel_release_ok::
257+
"yum install --assumeyes https://dl.fedoraproject.org/pub/epel/epel-release-latest-${sys.os_version_major}.noarch.rpm"
258+
comment => "rhel-7 installs this with a packages promise. TODO: check a sha for the download URL somehow?",
259+
classes => results( "bundle", "epel_release" ),
260260
contain => in_shell;
261261
(redhat_8|centos_8).!have_data_dumper.have_perl::
262262
"cpan Data::Dumper"

0 commit comments

Comments
 (0)