Skip to content

Commit 9966a7c

Browse files
committed
fix: build host policy: fail2ban install requires epel-release for all redhat-based platforms
Ticket: ENT-13804 Changelog: none
1 parent aa105bc commit 9966a7c

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

ci/cfengine-build-host-setup.cf

Lines changed: 11 additions & 11 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";
@@ -218,7 +216,8 @@ bundle agent cfengine_build_host_setup
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");
@@ -254,9 +253,10 @@ bundle agent cfengine_build_host_setup
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)