cli-aws-mfa


Namecli-aws-mfa JSON
Version 0.0.10 PyPI version JSON
download
home_page
SummaryAWS CLI MFA - Easily Manage Session Token
upload_time2023-04-27 07:08:21
maintainer
docs_urlNone
authorimajeetyadav (Ajeet Yadav)
requires_python
license
keywords aws mfa virtual
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
# AWS CLI MFA

Developed by Ajeet Yadav

## Example of How To Use

```
# Setup ARN and profile name
cli-aws-mfa init

# Refresh Session Token
cli-aws-mfa refresh 

```

## Policy Used for CLI MFA

```json
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "MustBeSignedInWithMFA",
            "Effect": "Deny",
            "NotAction": [
                "iam:CreateVirtualMFADevice",
                "iam:DeleteVirtualMFADevice",
                "iam:ListVirtualMFADevices",
                "iam:EnableMFADevice",
                "iam:ResyncMFADevice",
                "iam:ListAccountAliases",
                "iam:ListUsers",
                "iam:ListSSHPublicKeys",
                "iam:ListAccessKeys",
                "iam:ListServiceSpecificCredentials",
                "iam:ListMFADevices",
                "iam:GetAccountSummary",
                "sts:GetSessionToken"
            ],
            "Resource": "*",
            "Condition": {
                "BoolIfExists": {
                    "aws:MultiFactorAuthPresent": "false"
                }
            }
        }
    ]
}
```

## Here's a brief summary of the methods in this class:

- `__init__(self, profile_name="mfa-user", mfa_arn=None)`: Initializes a new `MFA` instance with the specified profile name and MFA ARN (Amazon Resource Name).
- `set_mfa_token(self, token)`: Sets the MFA token for the instance.
- `set_mfa_arn(self, arn)`: Sets the MFA ARN for the instance.
- `authenticate(self)`: Authenticates with AWS using the specified MFA ARN and token, and returns a set of temporary credentials.
- `set_credential(self, credentials)`: Sets the AWS credentials for the specified profile name using the temporary credentials returned by `authenticate()`.
- `check_mfa_arn_file(self)`: Checks if the MFA ARN file exists in the AWS configuration directory.
- `check_mfa_profile_file(self)`: Checks if the profile file exists in the AWS configuration directory.
- `get_arn_from_file(self)`: Reads the MFA ARN from the MFA ARN file in the AWS configuration directory.
- `get_profile_from_file(self)`: Reads the profile name from the profile file in the AWS configuration directory.
- `validate_session(self)`: Validates the session for the specified profile name and prints an error message if any of the AWS access keys are not set.

Here's some documentation for each of the methods in this class:

- `__init__(self, profile_name="mfa-user", mfa_arn=None)`: This is the constructor for the `MFA` class. It initializes a new instance with the specified profile name and MFA ARN. If no profile name is specified, the default profile name is "mfa-user". If no MFA ARN is specified, it is set to `None`.
- `set_mfa_token(self, token)`: This method sets the MFA token for the instance.
- `set_mfa_arn(self, arn)`: This method sets the MFA ARN for the instance.
- `authenticate(self)`: This method authenticates with AWS using the specified MFA ARN and token. It returns a set of temporary credentials that can be used to access AWS resources.
- `set_credential(self, credentials)`: This method sets the AWS credentials for the specified profile name using the temporary credentials returned by `authenticate()`. It writes the credentials to the AWS credentials file in the user's home directory.
- `check_mfa_arn_file(self)`: This method checks if the MFA ARN file exists in the AWS configuration directory. If the file exists, it returns `True`. Otherwise, it returns `False`.
- `check_mfa_profile_file(self)`: This method checks if the profile file exists in the AWS configuration directory. If the file exists, it returns `True`. Otherwise, it returns `False`.
- `get_arn_from_file(self)`: This method reads the MFA ARN from the MFA ARN file in the AWS configuration directory. It returns the MFA ARN as a string.
- `get_profile_from_file(self)`: This method reads the profile name from the profile file in the AWS configuration directory. If the file exists, it returns the profile name as a string. Otherwise, it returns the default profile name ("mfa-user").
- `validate_session(self)`: This method validates the session for the specified profile name. If any of the AWS access keys are not set, it prints an error message. Otherwise, it prints a message

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "cli-aws-mfa",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "aws,mfa,virtual",
    "author": "imajeetyadav (Ajeet Yadav)",
    "author_email": "<hello@codingprotocols.com>",
    "download_url": "https://files.pythonhosted.org/packages/61/04/b961dfa328d47900f51c92407a8b7afeac36c7c0a950f7942a58caa833f9/cli-aws-mfa-0.0.10.tar.gz",
    "platform": null,
    "description": "\n# AWS CLI MFA\n\nDeveloped by Ajeet Yadav\n\n## Example of How To Use\n\n```\n# Setup ARN and profile name\ncli-aws-mfa init\n\n# Refresh Session Token\ncli-aws-mfa refresh \n\n```\n\n## Policy Used for CLI MFA\n\n```json\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Sid\": \"MustBeSignedInWithMFA\",\n            \"Effect\": \"Deny\",\n            \"NotAction\": [\n                \"iam:CreateVirtualMFADevice\",\n                \"iam:DeleteVirtualMFADevice\",\n                \"iam:ListVirtualMFADevices\",\n                \"iam:EnableMFADevice\",\n                \"iam:ResyncMFADevice\",\n                \"iam:ListAccountAliases\",\n                \"iam:ListUsers\",\n                \"iam:ListSSHPublicKeys\",\n                \"iam:ListAccessKeys\",\n                \"iam:ListServiceSpecificCredentials\",\n                \"iam:ListMFADevices\",\n                \"iam:GetAccountSummary\",\n                \"sts:GetSessionToken\"\n            ],\n            \"Resource\": \"*\",\n            \"Condition\": {\n                \"BoolIfExists\": {\n                    \"aws:MultiFactorAuthPresent\": \"false\"\n                }\n            }\n        }\n    ]\n}\n```\n\n## Here's a brief summary of the methods in this class:\n\n- `__init__(self, profile_name=\"mfa-user\", mfa_arn=None)`: Initializes a new `MFA` instance with the specified profile name and MFA ARN (Amazon Resource Name).\n- `set_mfa_token(self, token)`: Sets the MFA token for the instance.\n- `set_mfa_arn(self, arn)`: Sets the MFA ARN for the instance.\n- `authenticate(self)`: Authenticates with AWS using the specified MFA ARN and token, and returns a set of temporary credentials.\n- `set_credential(self, credentials)`: Sets the AWS credentials for the specified profile name using the temporary credentials returned by `authenticate()`.\n- `check_mfa_arn_file(self)`: Checks if the MFA ARN file exists in the AWS configuration directory.\n- `check_mfa_profile_file(self)`: Checks if the profile file exists in the AWS configuration directory.\n- `get_arn_from_file(self)`: Reads the MFA ARN from the MFA ARN file in the AWS configuration directory.\n- `get_profile_from_file(self)`: Reads the profile name from the profile file in the AWS configuration directory.\n- `validate_session(self)`: Validates the session for the specified profile name and prints an error message if any of the AWS access keys are not set.\n\nHere's some documentation for each of the methods in this class:\n\n- `__init__(self, profile_name=\"mfa-user\", mfa_arn=None)`: This is the constructor for the `MFA` class. It initializes a new instance with the specified profile name and MFA ARN. If no profile name is specified, the default profile name is \"mfa-user\". If no MFA ARN is specified, it is set to `None`.\n- `set_mfa_token(self, token)`: This method sets the MFA token for the instance.\n- `set_mfa_arn(self, arn)`: This method sets the MFA ARN for the instance.\n- `authenticate(self)`: This method authenticates with AWS using the specified MFA ARN and token. It returns a set of temporary credentials that can be used to access AWS resources.\n- `set_credential(self, credentials)`: This method sets the AWS credentials for the specified profile name using the temporary credentials returned by `authenticate()`. It writes the credentials to the AWS credentials file in the user's home directory.\n- `check_mfa_arn_file(self)`: This method checks if the MFA ARN file exists in the AWS configuration directory. If the file exists, it returns `True`. Otherwise, it returns `False`.\n- `check_mfa_profile_file(self)`: This method checks if the profile file exists in the AWS configuration directory. If the file exists, it returns `True`. Otherwise, it returns `False`.\n- `get_arn_from_file(self)`: This method reads the MFA ARN from the MFA ARN file in the AWS configuration directory. It returns the MFA ARN as a string.\n- `get_profile_from_file(self)`: This method reads the profile name from the profile file in the AWS configuration directory. If the file exists, it returns the profile name as a string. Otherwise, it returns the default profile name (\"mfa-user\").\n- `validate_session(self)`: This method validates the session for the specified profile name. If any of the AWS access keys are not set, it prints an error message. Otherwise, it prints a message\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "AWS CLI MFA - Easily Manage Session Token",
    "version": "0.0.10",
    "split_keywords": [
        "aws",
        "mfa",
        "virtual"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f45a912f567b73dda8fc8e4fb9a911ad98f0de0f0667e0a25d6f8420d7640b58",
                "md5": "a15482c1ad161abc3680d913404fc2fa",
                "sha256": "22d021147d4f032214d785e080ebed063cbc59cd0212f84f148dcda0c323be20"
            },
            "downloads": -1,
            "filename": "cli_aws_mfa-0.0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a15482c1ad161abc3680d913404fc2fa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 5270,
            "upload_time": "2023-04-27T07:08:20",
            "upload_time_iso_8601": "2023-04-27T07:08:20.041158Z",
            "url": "https://files.pythonhosted.org/packages/f4/5a/912f567b73dda8fc8e4fb9a911ad98f0de0f0667e0a25d6f8420d7640b58/cli_aws_mfa-0.0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6104b961dfa328d47900f51c92407a8b7afeac36c7c0a950f7942a58caa833f9",
                "md5": "f8fd6a7883d08424bab8510b021771cf",
                "sha256": "e444fa46344755d2383701e9ffe5ba016f33fbd079f3aeafee66faf6a25f501b"
            },
            "downloads": -1,
            "filename": "cli-aws-mfa-0.0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "f8fd6a7883d08424bab8510b021771cf",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 4712,
            "upload_time": "2023-04-27T07:08:21",
            "upload_time_iso_8601": "2023-04-27T07:08:21.663646Z",
            "url": "https://files.pythonhosted.org/packages/61/04/b961dfa328d47900f51c92407a8b7afeac36c7c0a950f7942a58caa833f9/cli-aws-mfa-0.0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-27 07:08:21",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "cli-aws-mfa"
}
        
Elapsed time: 0.05883s