Repository metrics
- Stars
- (13,071 stars)
- PR merge metrics
- (Avg merge 24d 6h) (30 merged PRs in 30d)
Description
ISSUE TYPE
- Awx cli tool should have the option to prompt a user for their password to avoid entering a password in plain visible text on the command line.
SUMMARY
The awx cli tool can take a password as a command line argument or an environment variable. Both options require a user to enter and possibly store their password in plain text. This not only poses a security concern, it makes it difficult to properly escape special characters if present. An option to prompt a user to enter their password in a manner that won't be echoed to the terminal should alleviate this.
I personally got around this by modifying the awxkit/cli/client.py with the following:
from getpass import getpass
...
def get_config(self, key):
"""Helper method for looking up the value of a --conf.xyz flag"""
if key == 'password':
if getattr(self.args, 'conf.{}'.format(key)) == 'ask':
password = getpass("Enter your password: ")
return password
else:
return getattr(self.args, 'conf.{}'.format(key))
else:
return getattr(self.args, 'conf.{}'.format(key))
I don't think the method above is ideal, but it works for my immediate needs. And has the desired effect on the command line.
edit to include conditional return when key == 'password' and is not set to 'ask'