Skip to content

Commit f812368

Browse files
francesco-giordanoenrico-usai
authored andcommitted
Disable DLAMI aws-ubuntu-eni-helper to prevent confict with configure_nw_interface.sh
Refactor of log4j-cve-2021-44228-hotpatch service disabling
1 parent 68cf6d9 commit f812368

File tree

6 files changed

+58
-13
lines changed

6 files changed

+58
-13
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ This file is used to list changes made in each version of the AWS ParallelCluste
4444
- selinux-6.0.4 (from selinux-3.1.1)
4545
- yum-7.4.0 (from yum-6.1.1)
4646
- yum-epel-4.5.0 (from yum-epel-4.1.2)
47+
- Disable `aws-ubuntu-eni-helper` service, available in Deep Learning AMIs, to avoid conflicts with `configure_nw_interface.sh` when configuring instances with multiple network cards.
48+
- Set MTU to 9001 for all the network interfaces when configuring instances with multiple network cards.
4749

4850
3.1.4
4951
------
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# frozen_string_literal: true
2+
3+
# Copyright:: 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4+
#
5+
# Licensed under the Apache License, Version 2.0 (the "License").
6+
# You may not use this file except in compliance with the License.
7+
# A copy of the License is located at
8+
#
9+
# http://aws.amazon.com/apache2.0/
10+
#
11+
# or in the "LICENSE.txt" file accompanying this file.
12+
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
13+
# See the License for the specific language governing permissions and limitations under the License.
14+
15+
#
16+
# Disable service
17+
#
18+
def disable_service(service, platform_families = %i(rhel amazon debian), operations = :disable)
19+
if platform_family?(platform_families)
20+
service service do
21+
action operations
22+
end
23+
end
24+
end

cookbooks/aws-parallelcluster-install/recipes/base.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
include_recipe "aws-parallelcluster::setup_envars"
1919
include_recipe "aws-parallelcluster-install::sudoers"
2020
include_recipe "aws-parallelcluster-install::cluster_admin_user"
21-
include_recipe "aws-parallelcluster-install::disable_log4j_patcher"
21+
include_recipe "aws-parallelcluster-install::disable_services" unless virtualized?
2222

2323
case node['platform_family']
2424
when 'rhel', 'amazon'

cookbooks/aws-parallelcluster-install/recipes/disable_log4j_patcher.rb renamed to cookbooks/aws-parallelcluster-install/recipes/disable_services.rb

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#
44
# Cookbook:: aws-parallelcluster
5-
# Recipe:: disable_log4j_patcher
5+
# Recipe:: disable_services
66
#
7-
# Copyright:: 2013-2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
7+
# Copyright:: 2013-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
88
#
99
# Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with the
1010
# License. A copy of the License is located at
@@ -15,13 +15,11 @@
1515
# OR CONDITIONS OF ANY KIND, express or implied. See the License for the specific language governing permissions and
1616
# limitations under the License.
1717

18-
# default openmpi installation conflicts with new install
19-
# new one is installed in /opt/amazon/efa/bin/
18+
# Disable DLAMI multi eni helper
19+
# no only_if statement because if the service is not present the action disable does not return error
20+
disable_service('aws-ubuntu-eni-helper', 'debian', %i(disable stop mask))
2021

21-
if platform_family?('amazon')
22-
# masking the service in order to prevent it from being automatically enabled
23-
# if not installed yet
24-
service 'log4j-cve-2021-44228-hotpatch' do
25-
action %i(disable stop mask)
26-
end
27-
end
22+
# Disable log4j-cve-2021-44228-hotpatch
23+
# masking the service in order to prevent it from being automatically enabled
24+
# if not installed yet
25+
disable_service('log4j-cve-2021-44228-hotpatch', 'amazon', %i(disable stop mask))

cookbooks/aws-parallelcluster-test/libraries/helpers.rb

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# frozen_string_literal: true
22

3-
# Copyright:: 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
# Copyright:: 2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.
44
#
55
# Licensed under the Apache License, Version 2.0 (the "License").
66
# You may not use this file except in compliance with the License.
@@ -224,3 +224,14 @@ def check_ssh_target_checker_vpc_cidr_list(ssh_target_checker_script, expected_c
224224
TEST
225225
end
226226
end
227+
228+
#
229+
# Check if a service is disabled
230+
#
231+
def is_service_disabled(service, platform_families = %i(rhel amazon debian))
232+
if platform_family?(platform_families)
233+
execute "check #{service} service is disabled" do
234+
command "systemctl is-enabled #{service} && exit 1 || exit 0"
235+
end
236+
end
237+
end

cookbooks/aws-parallelcluster-test/recipes/tests.rb

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,16 @@ module load intelmpi && mpirun --help | grep '#{node['cluster']['intelmpi']['kit
541541
command "systemctl is-enabled ec2blkdev"
542542
end
543543

544+
###################
545+
# Verify that aws-ubuntu-eni-helper service is disabled
546+
###################
547+
is_service_disabled('aws-ubuntu-eni-helper', 'debian')
548+
549+
###################
550+
# Verify that log4j-cve-2021-44228-hotpatch service is disabled
551+
###################
552+
is_service_disabled('log4j-cve-2021-44228-hotpatch', 'amazon')
553+
544554
###################
545555
# clusterstatusmgtd
546556
###################

0 commit comments

Comments
 (0)