aws-vault

授权协议 MIT License
开发语言 JavaScript
所属分类 应用工具、 终端/远程登录
软件类型 开源软件
地区 不详
投 递 者 蓟浩旷
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

AWS Vault

Continuous Integration

AWS Vault is a tool to securely store and access AWS credentials in a development environment.

AWS Vault stores IAM credentials in your operating system's secure keystore and then generates temporary credentials from those to expose to your shell and applications. It's designed to be complementary to the AWS CLI tools, and is aware of your profiles and configuration in ~/.aws/config.

Check out the announcement blog post for more details.

Installing

You can install AWS Vault:

  • by downloading the latest release
  • on macOS with Homebrew Cask: brew install --cask aws-vault
  • on macOS with MacPorts: port install aws-vault
  • on Windows with Chocolatey: choco install aws-vault
  • on Windows with Scoop: scoop install aws-vault
  • on Linux with Homebrew on Linux: brew install aws-vault
  • on Arch Linux: pacman -S aws-vault
  • on FreeBSD: pkg install aws-vault
  • with Nix: nix-env -i aws-vault
  • on OpenSUSE: enable devel:languages:go repo then zypper install aws-vault (sometimes version lags)

Documentation

Config, usage, tips and tricks are available in the USAGE.md file.

Vaulting Backends

The supported vaulting backends are:

Use the --backend flag or AWS_VAULT_BACKEND environment variable to specify.

Quick start

# Store AWS credentials for the "jonsmith" profile
$ aws-vault add jonsmith
Enter Access Key Id: ABDCDEFDASDASF
Enter Secret Key: %%%

# Execute a command (using temporary credentials)
$ aws-vault exec jonsmith -- aws s3 ls
bucket_1
bucket_2

# open a browser window and login to the AWS Console
$ aws-vault login jonsmith

# List credentials
$ aws-vault list
Profile                  Credentials              Sessions
=======                  ===========              ========
jonsmith                 jonsmith                 -

How it works

aws-vault uses Amazon's STS service to generate temporary credentials via the GetSessionToken or AssumeRole API calls. These expire in a short period of time, so the risk of leaking credentials is reduced.

AWS Vault then exposes the temporary credentials to the sub-process in one of two ways

  1. Environment variables are written to the sub-process. Notice in the below example how the AWS credentials get written out
    $ aws-vault exec jonsmith -- env | grep AWS
    AWS_VAULT=jonsmith
    AWS_DEFAULT_REGION=us-east-1
    AWS_REGION=us-east-1
    AWS_ACCESS_KEY_ID=%%%
    AWS_SECRET_ACCESS_KEY=%%%
    AWS_SESSION_TOKEN=%%%
    AWS_SECURITY_TOKEN=%%%
    AWS_SESSION_EXPIRATION=2020-04-16T11:16:27Z
  2. Local EC2 Instance Metadata server is started. This approach has the advantage that anything that uses Amazon's SDKs will automatically refresh credentials as needed, so session times can be as short as possible. The downside is that only one can run per host and because it binds to 169.254.169.254:80, your sudo password is required.

The default is to use environment variables, but you can opt-in to the local instance metadata server with the --server flag on the exec command.

Roles and MFA

Best-practice is to create Roles to delegate permissions. For security, you should also require that users provide a one-time key generated from a multi-factor authentication (MFA) device.

First you'll need to create the users and roles in IAM, as well as setup an MFA device. You can then set up IAM roles to enforce MFA.

Here's an example configuration using roles and MFA:

[default]
region = us-east-1

[profile jonsmith]
mfa_serial = arn:aws:iam::111111111111:mfa/jonsmith

[profile foo-readonly]
source_profile = jonsmith
role_arn = arn:aws:iam::22222222222:role/ReadOnly

[profile foo-admin]
source_profile = jonsmith
role_arn = arn:aws:iam::22222222222:role/Administrator
mfa_serial = arn:aws:iam::111111111111:mfa/jonsmith

[profile bar-role1]
source_profile = jonsmith
role_arn = arn:aws:iam::333333333333:role/Role1
mfa_serial = arn:aws:iam::111111111111:mfa/jonsmith

[profile bar-role2]
source_profile = bar-role1
role_arn = arn:aws:iam::333333333333:role/Role2
mfa_serial = arn:aws:iam::111111111111:mfa/jonsmith

Here's what you can expect from aws-vault

Command Credentials Cached MFA
aws-vault exec jonsmith --no-session Long-term credentials No No
aws-vault exec jonsmith session-token session-token Yes
aws-vault exec foo-readonly role No No
aws-vault exec foo-admin session-token + role session-token Yes
aws-vault exec foo-admin --duration=2h role role Yes
aws-vault exec bar-role2 session-token + role + role session-token Yes
aws-vault exec bar-role2 --no-session role + role role Yes

Development

The macOS release builds are code-signed to avoid extra prompts in Keychain. You can verify this with:

$ codesign --verify --verbose $(which aws-vault)

If you are developing or compiling the aws-vault binary yourself, you can generate a self-signed certificate by accessing Keychain Access > Certificate Assistant > Create Certificate -> Certificate Type: Code Signing. You can then sign your binary with:

$ go build .
$ codesign --sign <Name of certificate created above> ./aws-vault

References and Inspiration

  • 我们在之前的文章中已经尝试获取s3的所有存储的文件大小和 最后修改时间 清洗入库。 现在可以 对 s3存储进行 精细化的 优化了。比如 对s3存储进行分层优化。 这样可以把我们的成本 明显的降低。 s3的存储目前有6层,具体什么样的数据 选择 哪种, 本篇文章进行分析。 s3存储 提供的 分层类型 Amazon S3 提供一系列适合不同使用案例的存储类。 1、S3 标准(适用于频繁访问的数据的通用

  • AWS Certificate Manager 是一项服务,可帮助您轻松地预置、管理和部署公有和私有安全套接字层/传输层安全性 (SSL/TLS) 证书,以便用于 AWS 服务和您的内部互联资源。SSL/TLS 证书用于保护网络通信的安全,并确认网站在 Internet 上的身份以及资源在私有网络上的身份。使用 AWS Certificate Manager,您无需再为购买、上传和续订 SSL/T

  • 在使用AWS Service的过程中,经常需要给AWS Service发http请求进行交互,比如对DynamoDB的CURD操作,S3上传或者下载文件等等。这些请求发送出去之后AWS会对请求中包含的Credentials进行验证,只有通过验证之后才会进行相应的操作,这就保证了安全性。 AWS Credentials AWS Credentials包含以下四部分内容: { "AccessKey

  • https://d1.awsstatic.com/Security/pdfs/Model_Checking_Boot_Code_From_AWS_Data_Centers.pdf   https://aws.amazon.com/security/provable-security/   https://github.com/diffblue/cbmc

  • What can I do with Cloudwatch Dashboards - Creates awesome dashboards to see what is happening with your AWS environment. Alarms - Allows you to set Alarms that notify you when particular thresholds a

  • http://blog.linuxacademy.com/linux/converting-your-aws-ec2-rds-instances-to-amazon-vpc/

  • 我正在创建一个AWS实例,并试图在创建时运行一个Vault服务器。我的问题是创建过程永远不会结束,因为服务器没有在后台运行。这是我的配置: resource "aws_instance" "web" { ami = "ami-466768ac" instance_type = "t2.micro" key_name = "my_key" tags { Name = "Vault" } provis

  • 由于一些众所周知的原因,AWS China 和AWS Global在使用上有很多不同。本文总结有以下几点: 在Region里面,AWC China 与AWS global是没有直接连接的。你在global的region 选项里也不会看见China的选项。 AWS China 有自己的domain 比起其他region来说,AWS China提供的服务更少。不支持: Amazon AppStream

  • 目录 AWS 上的 DevOps 在 AWS 上部署 5G 网络的好处之一是,用户可以根据需要,使用一系列的 AWS DevOps 开发者工具集来轻松快速地创建新开发、新测试、新切片、以及生产环境。 使用 AWS 开发者工具构建 CI/CD pipeline: AWS CodeCommit AWS CodeBuild AWS CodePipeline AWS CodeDeploy AWS Code

 相关资料
  • 我想知道使用AWS OpsWorks与AWS Beanstalk和AWS CloudFormation的优缺点是什么? 我感兴趣的是一个可以自动伸缩的系统,它可以处理任意数量的并发web请求(从每分钟1000个请求到1000万rpm),包括一个可以自动伸缩的数据库层。 理想情况下,我希望有效地共享一些硬件资源,而不是为每个应用程序提供单独的实例。在过去,我主要使用EC2实例RDS Cloudtop

  • AWS

    介绍如何在AWS上获取在云联壹云平台需要使用的配置参数。 获取AWS的访问密钥 使用AWS主账号(或拥有AdministratorAccess管理权限的子账号)登录AWS管理控制台,单击 “IAM” 菜单项,进入IAM控制面板页面。 单击左侧菜单栏 “用户” 菜单项,进入用户管理列表,单击用户名名称项,进入指定用户详情页面。注意需要选择有足够管理权限的用户。 单击“安全证书”页签。 单击 “创建访

  • AWS

    AWS Global Infrastructure AWS Global Cloud - A single global cloud, is made up of devices and Services in many regions. AWS Region - A physical location around the world where Amazon have equipment(de

  • aws

    A collection of bash shell scripts for automating various tasks with Amazon Web Services using the AWS CLI and jq. https://github.com/swoodford/aws Table of contents Why Getting Started What's Include

  • 我使用的是AWS SQS服务,很难定义SQS队列上的权限。在我的设置中,我使用的是AWS Lambda服务,当一个对象被推到S3存储桶上时会触发该服务。 然而,让我简短地提问,这是我想要实现的: 对象被推送到S3存储桶中 正如您可以从前面的用例中看到的,我希望我的AWS Lambda方法是唯一可以向SQS队列发送消息的应用程序。我试图设置一个原则和一个条件“sourceArn”。但是它们都不起作用

  • 我有一个Powershell Lambda,我希望通过AWS CDK部署它,但在运行时遇到问题。 通过手动发布AWSPowerShellLambda部署Powershell可以: 但是,与CDK一起部署的同一脚本不会记录到CloudWatch日志,即使它具有以下权限: powershell脚本当前仅包含以下行,在CLI上由Publish AWSPowerShellLambda部署时可以工作: 注意