99designs / aws-vault

A vault for securely storing and accessing AWS credentials in development environments
MIT License
8.52k stars 820 forks source link

Touch ID support on macOS (Data Protection Keychain) #1243

Open alexw23 opened 6 months ago

alexw23 commented 6 months ago

Implementation Overview

Refactoring was mostly done upstream, dependent on the following merges:

A new dp-keychain was created as the breaking changes in (https://github.com/keybase/go-keychain/pull/76) made it the existing keychain unsuitable for this implementation. More details can be found in keyring/data_protection_keychain.go.

The file-based keychain used by aws-vault is nearing deprecation, although it will likely remain available for several years. Transitioning to the Data protection keychain is recommended due to its enhanced security.

Key Changes

Please review the latest documentation for detailed information on this implementation.

Deployment Structure Changes

The .dmg deployment now includes a embedded.provisionprofile within an app scaffold, changing from a single binary to an app bundle:

aws-vault.app/
└── Contents/
    ├── MacOS/
    │   └── aws-vault
    ├── Info.plist
    ├── embedded.provisionprofile
    └── _CodeSignature/
        └── CodeResources

This modification will require updates to the cask (using both app and binary stanza), I still need to do testing with homebrew to ensure there's no breaking changes.

Also GitHub actions will need the embedded.provisionprofile so this should be added in.

Participation Request

I welcome all testing and feedback on this implementation. As Go is not my primary language I'm open to any improvements. Any further code can be added as pull request against this branch.

Testing Instructions

Method 1: Build it yourself

  1. Review Documentation: Begin by reviewing the latest documentation to familiarize yourself with the new features and backend.
  2. Setup Development Environment: Follow these instructions for setting up a local development environment. This includes acquiring an Apple Developer ID and configuring the necessary Certificates and Provisioning Profiles. All commands and configurations are detailed in the documentation.
  3. Then you can build it as follows:
    $ make app
    $ aws-vault.app/Contents/MacOS/aws-vault --backend=dp-keychain ls

Method 2: Pre-built .dmg

  1. Download and Extract: Download the unofficial .dmg and extract the aws-vault.app from the .dmg to your preferred directory, such as ~/bin.
  2. Execute Commands: Use the new backend with the following shell command:
    $ ~/bin/aws-vault.app/Contents/MacOS/aws-vault --backend=dp-keychain ls

    Utilize the new copy method if you need to transfer credentials between keychains.

  3. Simplify Command Usage: Optionally, add the following lines to your ~/.zshrc or ~/.bash_profile:
    $ echo 'alias aws-vault="~/bin/aws-vault.app/Contents/MacOS/aws-vault"' >> ~/.zshrc
    $ echo 'export AWS_VAULT_BACKEND="dp-keychain"' >> ~/.zshrc

    Reload your shell configuration to apply these changes:

    $ source ~/.zshrc

Important: If and when this update is merged and released under the 99designs developer ID, when you use that release you won’t see credentials stored under different developer IDs, including those created under your own or mine. You will need to add these credentials again under the 99designs developer ID to maintain access. The copy method won’t work either.

Known Issues