Note: This bug is displayed in read-only format because
the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
After cloud-init added AWS IMDSv2 support, it saves token values in cloud-init.log. I am suggesting to backport the below patch to change this behavior.
commit 87cd040ed8fe7195cbb357ed3bbf53cd2a81436c
Author: Ryan Harper <ryan.harper>
Date: Wed Feb 19 15:01:09 2020 -0600
ec2: Do not log IMDSv2 token values, instead use REDACTED (#219)
Instead of logging the token values used log the headers and replace the actual
values with the string 'REDACTED'. This allows users to examine cloud-init.log
and see that the IMDSv2 token header is being used but avoids leaving the value
used in the log file itself.
The current log is like this:
2020-04-07 09:49:34,693 - DataSourceEc2.py[DEBUG]: Fetching Ec2 IMDSv2 API Token
2020-04-07 09:49:34,693 - url_helper.py[DEBUG]: [0/1] open 'http://169.254.169.254/latest/api/token' with {'url': 'http://169.254.169.254/latest/api/token', 'headers': {'X-aws-ec2-metadata-token-ttl-seconds': '21600', 'User-Agent': 'Cloud-Init/19.4'}, 'allow_redirects': True, 'method': 'PUT', 'timeout': 1.0} configuration
2020-04-07 09:49:34,705 - url_helper.py[DEBUG]: Read from http://169.254.169.254/latest/api/token (200, 56b) after 1 attempts
2020-04-07 09:49:34,705 - DataSourceEc2.py[DEBUG]: Using metadata source: 'http://169.254.169.254'
2020-04-07 09:49:34,705 - url_helper.py[DEBUG]: [0/1] open 'http://169.254.169.254/2016-09-02/meta-data/instance-id' with {'url': 'http://169.254.169.254/2016-09-02/meta-data/instance-id', 'headers': {'X-aws-ec2-metadata-token': 'AQAEAKFXG-CkNfREz8EV84ZfvXwKeUOxK01GzrC5DgBd7Z7MzGrNLQ==', 'User-Agent': 'Cloud-Init/19.4'}, 'allow_redirects': True, 'method': 'GET'} configuration
2020-04-07 09:49:34,707 - url_helper.py[DEBUG]: Read from http://169.254.169.254/2016-09-02/meta-data/instance-id (200, 19b) after 1 attempts
Version-Release number of selected components (if applicable):
RHEL Version:
RHEL-7.9(cloud-init-19.4-3.el7.x86_64)
How reproducible:
100%
Steps to Reproduce:
1. Start a RHEL-7.9 AMI on aws.
2. Check /var/log/cloud-init.log.
Actual results:
token value is saved
Expected results:
No token value saved
Additional info:
- N/A
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory (Moderate: cloud-init security, bug fix, and enhancement update), and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.
https://access.redhat.com/errata/RHSA-2020:3898
After cloud-init added AWS IMDSv2 support, it saves token values in cloud-init.log. I am suggesting to backport the below patch to change this behavior. commit 87cd040ed8fe7195cbb357ed3bbf53cd2a81436c Author: Ryan Harper <ryan.harper> Date: Wed Feb 19 15:01:09 2020 -0600 ec2: Do not log IMDSv2 token values, instead use REDACTED (#219) Instead of logging the token values used log the headers and replace the actual values with the string 'REDACTED'. This allows users to examine cloud-init.log and see that the IMDSv2 token header is being used but avoids leaving the value used in the log file itself. The current log is like this: 2020-04-07 09:49:34,693 - DataSourceEc2.py[DEBUG]: Fetching Ec2 IMDSv2 API Token 2020-04-07 09:49:34,693 - url_helper.py[DEBUG]: [0/1] open 'http://169.254.169.254/latest/api/token' with {'url': 'http://169.254.169.254/latest/api/token', 'headers': {'X-aws-ec2-metadata-token-ttl-seconds': '21600', 'User-Agent': 'Cloud-Init/19.4'}, 'allow_redirects': True, 'method': 'PUT', 'timeout': 1.0} configuration 2020-04-07 09:49:34,705 - url_helper.py[DEBUG]: Read from http://169.254.169.254/latest/api/token (200, 56b) after 1 attempts 2020-04-07 09:49:34,705 - DataSourceEc2.py[DEBUG]: Using metadata source: 'http://169.254.169.254' 2020-04-07 09:49:34,705 - url_helper.py[DEBUG]: [0/1] open 'http://169.254.169.254/2016-09-02/meta-data/instance-id' with {'url': 'http://169.254.169.254/2016-09-02/meta-data/instance-id', 'headers': {'X-aws-ec2-metadata-token': 'AQAEAKFXG-CkNfREz8EV84ZfvXwKeUOxK01GzrC5DgBd7Z7MzGrNLQ==', 'User-Agent': 'Cloud-Init/19.4'}, 'allow_redirects': True, 'method': 'GET'} configuration 2020-04-07 09:49:34,707 - url_helper.py[DEBUG]: Read from http://169.254.169.254/2016-09-02/meta-data/instance-id (200, 19b) after 1 attempts Version-Release number of selected components (if applicable): RHEL Version: RHEL-7.9(cloud-init-19.4-3.el7.x86_64) How reproducible: 100% Steps to Reproduce: 1. Start a RHEL-7.9 AMI on aws. 2. Check /var/log/cloud-init.log. Actual results: token value is saved Expected results: No token value saved Additional info: - N/A