diff --git a/README.md b/README.md index 3557f37..61bfd3e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ AWS Console Login Utility ## Command line tool - `aws-console` -- `aws-system-credential` +- `aws-credential-process-from-system` ## Installation ### Via Pip @@ -91,7 +91,7 @@ The docs - https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-files.html --- -## Usage of `aws-system-credential` +## Usage of `aws-credential-process-from-system` The tool provides two main commands: `store` and `get`. - Store AWS credentials in system default credential store - Retrieve AWS credentials from system default credential store. Optionally plug the CLI to aws external credential process. @@ -101,7 +101,7 @@ To store IAM user credential in the system credential store for best security ra Manully the save the credential in the store using ```bash -aws-system-credential store \ +aws-credential-process-from-system store \ --access-key 'AKIAIOSFODNN7EXAMPLE' \ --secret-key 'wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY' \ --account-id '123456789012' \ @@ -114,10 +114,10 @@ Configure aws config file to use credential process [profile iam-user] region = us-east-1 output = json -credential_process = aws-system-credential get --account-id 123456789012 --username 'my-iam-user' --access-key 'AKIAIOSFODNN7EXAMPLE' --credential-process +credential_process = aws-credential-process-from-system get --account-id 123456789012 --username 'my-iam-user' --access-key 'AKIAIOSFODNN7EXAMPLE' ``` -> Try `aws-system-credential --help` for detailed parameter +> Try `aws-credential-process-from-system --help` for detailed parameter ### Refer The docs diff --git a/aws_console/__init__.py b/aws_console/__init__.py index ddcff3b..69ac863 100644 --- a/aws_console/__init__.py +++ b/aws_console/__init__.py @@ -17,10 +17,10 @@ def aws_console(): open_console(url, args.clip, args.stdout) -def aws_system_credential(): +def aws_credential_process_from_system(): args = credential_process_arguments() if args.command == 'store': store_aws_credential(args.account_id, args.username, args.access_key, args.secret_key) elif args.command == 'get': - get_aws_credential(args.account_id, args.username, args.access_key, args.credential_process) + get_aws_credential(args.account_id, args.username, args.access_key) diff --git a/aws_console/input_output/cli.py b/aws_console/input_output/cli.py index 007693d..5d9e3db 100644 --- a/aws_console/input_output/cli.py +++ b/aws_console/input_output/cli.py @@ -52,7 +52,5 @@ def credential_process_arguments(): # Subparser for 'get' command get_parser = subparsers.add_parser('get', help='Get AWS credentials', parents=[global_parser, get_store_common_parser]) - get_parser.add_argument('--credential-process', - action='store_true', help='Use credential process') return parser.parse_args() diff --git a/aws_console/system_credential_store.py b/aws_console/system_credential_store.py index fe494fd..8e53fc7 100644 --- a/aws_console/system_credential_store.py +++ b/aws_console/system_credential_store.py @@ -7,16 +7,13 @@ def store_aws_credential(account_id, username, access_key, secret_key): keyring.set_password(service_name, access_key, secret_key) -def get_aws_credential(account_id, username, access_key, for_credential_process): +def get_aws_credential(account_id, username, access_key): service_name = '-'.join(filter(None, ['aws', account_id, username])) secret_key = keyring.get_password(service_name, access_key) - if for_credential_process: - # https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sourcing-external.html - print(json.dumps({ - "Version": 1, - "AccessKeyId": access_key, - "SecretAccessKey": secret_key - })) - else: - print(secret_key) + # https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sourcing-external.html + print(json.dumps({ + "Version": 1, + "AccessKeyId": access_key, + "SecretAccessKey": secret_key + })) diff --git a/setup.py b/setup.py index 3a0a530..4a3ea70 100755 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ def find_version(*file_paths): entry_points={ 'console_scripts': [ 'aws-console = aws_console:aws_console', - 'aws-system-credential = aws_console:aws_system_credential' + 'aws-credential-process-from-system = aws_console:aws_credential_process_from_system' ] }, install_requires=[