Hide Forgot
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