Skip to content

Commit a70d6d8

Browse files
committed
Patch al20203
1 parent 7b035af commit a70d6d8

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

cookbooks/aws-parallelcluster-environment/templates/isolated/patch-iso-instance.sh.erb

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ if [[ "${OS}" == "amzn2023" ]]; then
3535
cat > ${REPOSITORY_DEFINITION_FILE} <<REPO_DEFINITION
3636
[amzn2023-iso]
3737
name=Amazon Linux 2023 isolated Region repository
38-
mirrorlist=http://al2023-repos-$awsregion-de612dc2.s3.$awsregion.$awsdomain/core-iso/mirrors/$releasever/$basearch/mirror.list
38+
mirrorlist=http://al2023-repos-\$awsregion-de612dc2.s3.\$awsregion.\$awsdomain/core-iso/mirrors/\$releasever/\$basearch/mirror.list
3939
priority=10
4040
enabled=1
4141
repo_gpgcheck=0
@@ -45,8 +45,12 @@ gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-amazon-linux-2023
4545
REPO_DEFINITION
4646

4747
echo "sslverify=0" >> /etc/dnf/dnf.conf
48-
dnf install -y amazon-linux-repo-iso ca-certificates-iso
49-
echo -n "" > sudo tee /etc/dnf/vars/dualstack
48+
echo -n "" | sudo tee /etc/dnf/vars/dualstack
49+
if [[ ${REGION} == us-isob* ]]; then
50+
dnf install -y amazon-linux-repo-iso ca-certificates-isob
51+
else
52+
dnf install -y amazon-linux-repo-iso ca-certificates-iso
53+
fi
5054
sed -i "s/sslverify=0//g" /etc/dnf/dnf.conf
5155
else
5256
cat > ${REPOSITORY_DEFINITION_FILE} <<REPO_DEFINITION
@@ -66,27 +70,30 @@ fi
6670

6771
rm -f ${REPOSITORY_DEFINITION_FILE}
6872

69-
echo "[INFO] Complete: installation of packages from amazon Linux 2 repository for US isolated region"
73+
echo "[INFO] Complete: installation of packages from ${OS} repository for US isolated region"
7074

7175
echo "[INFO] Starting: CA bundle configuration for AWS CLI in US isolated region"
7276

73-
USERS=(<%= @users %>)
7477
CA_BUNDLE="/etc/pki/${REGION}/certs/ca-bundle.pem"
7578

76-
for user in "${USERS[@]}"; do
77-
echo "[INFO] Setting CA bundle ${CA_BUNDLE} for user ${user}"
78-
sudo mkhomedir_helper $user
79-
sudo -u $user aws configure set ca_bundle "$CA_BUNDLE"
80-
done
79+
sudo aws configure set ca_bundle "$CA_BUNDLE"
8180

8281
echo "[INFO] Complete: CA bundle configuration for AWS CLI in US isolated region"
8382

8483
echo "[INFO] Starting: Setting system-wide environment variables for AWS CLI in US isolated region"
8584

85+
echo "export AWS_CA_BUNDLE=/etc/pki/${REGION}/certs/ca-bundle.pem" >> /etc/profile.d/aws-cli-default-config.sh
86+
8687
echo "export AWS_DEFAULT_REGION=${REGION}" >> /etc/profile.d/aws-cli-default-config.sh
8788

88-
echo "Defaults env_keep += \"AWS_DEFAULT_REGION AWS_CA_BUNDLE\"" > /etc/sudoers.d/pcluster-aws-cli-envkeep
89+
echo "export REQUESTS_CA_BUNDLE=${AWS_CA_BUNDLE}" >> /etc/profile.d/aws-cli-default-config.sh
8990

90-
echo "[INFO] Complete: Setting system-wide environment variables for AWS CLI in US isolated region"
91+
echo "export SSL_CERT_FILE=${AWS_CA_BUNDLE}" >> /etc/profile.d/aws-cli-default-config.sh
92+
93+
echo "Defaults env_keep += \"AWS_DEFAULT_REGION AWS_CA_BUNDLE REQUESTS_CA_BUNDLE SSL_CERT_FILE\"" > /etc/sudoers.d/pcluster-aws-cli-envkeep
9194

92-
echo "[INFO] Complete: instance configuration for US isolated region"
95+
source /etc/profile.d/aws-cli-default-config.sh
96+
97+
sudo aws configure set ca_bundle "$CA_BUNDLE"
98+
99+
echo "[INFO] Complete: Setting system-wide environment variables for AWS CLI in US isolated region"

cookbooks/aws-parallelcluster-platform/files/isolated/iso-ca-bundle-config.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ function get_instance_region {
99

1010
REGION="$(get_instance_region)"
1111

12+
CA_BUNDLE="/etc/pki/${REGION}/certs/ca-bundle.pem"
13+
1214
echo "export AWS_CA_BUNDLE=/etc/pki/${REGION}/certs/ca-bundle.pem" >> /etc/profile.d/aws-cli-default-config.sh
1315

1416
echo "export AWS_DEFAULT_REGION=${REGION}" >> /etc/profile.d/aws-cli-default-config.sh

0 commit comments

Comments
 (0)