From ea97b9640316fa0e6c23578b95aa0ad024bab146 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Feb 02 2021 09:32:38 +0000 Subject: import fence-agents-4.2.1-41.el7_9.3 --- diff --git a/SOURCES/bz1905735-fence_aws-add-imdsv2-support.patch b/SOURCES/bz1905735-fence_aws-add-imdsv2-support.patch new file mode 100644 index 0000000..a5bdad3 --- /dev/null +++ b/SOURCES/bz1905735-fence_aws-add-imdsv2-support.patch @@ -0,0 +1,40 @@ +From c9f8890264e0257197b31124dbb26c1046475314 Mon Sep 17 00:00:00 2001 +From: Oyvind Albrigtsen +Date: Fri, 13 Nov 2020 14:30:43 +0100 +Subject: [PATCH] fence_aws: add support for IMDSv2 + +--- + agents/aws/fence_aws.py | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/agents/aws/fence_aws.py b/agents/aws/fence_aws.py +index 483a2991..e2a2391f 100644 +--- a/agents/aws/fence_aws.py ++++ b/agents/aws/fence_aws.py +@@ -3,12 +3,13 @@ + import sys, re + import logging + import atexit +-import requests + sys.path.append("@FENCEAGENTSLIBDIR@") + from fencing import * + from fencing import fail, fail_usage, run_delay, EC_STATUS, SyslogLibHandler + ++import requests + import boto3 ++from requests import HTTPError + from botocore.exceptions import ConnectionError, ClientError, EndpointConnectionError, NoRegionError + + logger = logging.getLogger("fence_aws") +@@ -19,8 +20,9 @@ + + def get_instance_id(): + try: +- r = requests.get('http://169.254.169.254/latest/meta-data/instance-id') +- return r.content.decode("UTF-8") ++ token = requests.put('http://169.254.169.254/latest/api/token', headers={"X-aws-ec2-metadata-token-ttl-seconds" : "21600"}).content.decode("UTF-8") ++ r = requests.get('http://169.254.169.254/latest/meta-data/instance-id', headers={"X-aws-ec2-metadata-token" : token}).content.decode("UTF-8") ++ return r + except HTTPError as http_err: + logger.error('HTTP error occurred while trying to access EC2 metadata server: %s', http_err) + except Exception as err: diff --git a/SPECS/fence-agents.spec b/SPECS/fence-agents.spec index 314c7ce..6c63cdb 100644 --- a/SPECS/fence-agents.spec +++ b/SPECS/fence-agents.spec @@ -67,7 +67,7 @@ Name: fence-agents Summary: Fence Agents for Red Hat Cluster Version: 4.2.1 -Release: 41%{?alphatag:.%{alphatag}}%{?dist}.2 +Release: 41%{?alphatag:.%{alphatag}}%{?dist}.3 License: GPLv2+ and LGPLv2+ Group: System Environment/Base URL: https://github.com/ClusterLabs/fence-agents @@ -137,6 +137,7 @@ Patch62: bz1793738-fence_vmware_rest-2-support-utf-8-vm-names.patch Patch63: bz1832289-fence_aws-improve-catch-connectionerror.patch Patch64: bz1860545-fence_lpar-fix-long-user-host-issue.patch Patch65: bz1862024-fence_evacuate-support-private-flavors.patch +Patch66: bz1905735-fence_aws-add-imdsv2-support.patch # bundle patches Patch1000: bz1568753-4-fence_gce-bundled-libs.patch Patch1001: bz1568753-5-%{oauth2client}-docs-build-fix.patch @@ -235,6 +236,7 @@ BuildRequires: python-six >= 1.6.1 %patch63 -p1 %patch64 -p1 %patch65 -p1 +%patch66 -p1 # prevent compilation of something that won't get used anyway sed -i.orig 's|FENCE_ZVM=1|FENCE_ZVM=0|' configure.ac @@ -1186,6 +1188,10 @@ The fence-agents-zvm package contains a fence agent for z/VM hypervisors %endif %changelog +* Mon Jan 4 2021 Oyvind Albrigtsen - 4.2.1-41.3 +- fence_aws: add support for IMDSv2 + Resolves: rhbz#1905735 + * Fri Oct 2 2020 Oyvind Albrigtsen - 4.2.1-41.2 - Upgrade bundled python-httplib2 to fix CVE-2020-11078 Resolves: rhbz#1850114