Skip to content

florintp-onboarding/vaultswitch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

A tool to switch between Vault binaries on MAC ARM64

license

Install the utility script in the default HOMEBREW bin directory

The current repository is used for initial setup and work with a fast Vault binary switch utility.

Please note: The script is tested and validated to work on MAC OS on ARM 64 platforms having HOMEBREW as install manager.

Prerequisites:

Install Homebrew (if it is not already present)

  1. Install Homebrew from Homebrew
  1. Clone this repository gh repo clone florintp-onboarding/vaultswitch

  2. Install the script into HOMEBREW/bin directory

    cd vaultswitch
    chmod +rx vaultswitch
    cp -p vaultswitch /opt/homebrew/bin
    

TODO :

  • Validate the Releases by checking the HASHICORP repository
  • Validate the prebuilt binary version
  • Suppress the ECHO if not running in interactive mode.
  • Check signature of the binary before switch
  • Enclosed code blocks with {
  • Added timestamp on actions performed

Review the default Vault versionand variables

HOMEBREW_CELLAR and HOMEBREW_PATH are by default initialized on Homebrew installation. If the Homebrew was correctly installed you do not need to update those variable paths.

  1. Execute the script without arguments

  2. Execute the script vaultswitch with syntax:

    vaultswitch [ [1.14.4+ent] | [vault_v1.13.4] ]
    
  • Example 1 ( archive and binary not found ):

    vaultswitch
    Trying to switch to Vault version 1.15.0
     Working... Downloading... https://releases.hashicorp.com/vault/1.15.0/vault_1.15.0_darwin_arm64.zip Done.
     Unzipping vault_1.15.0_darwin_arm64.zip... Done.
    Extracted and switched Vault to 1.15.0. Done.
    
  • Example 2 (binary already present in the Cellar - just making the switch of binary):

    vaultswitch
     Trying to switch to Vault version 1.15.0
    Found binary and switched Vault to 1.15.0. Done.
    
  • Example 3 ( download and prepare all the Vault versions from 1.14.x using the release directory):

    for v in $(curl -q https://releases.hashicorp.com/vault| grep '<a href="/vault/1.14'| egrep -v 'hsm|beta|-alpha|-rc1|fips'|cut -d '>' -f2 |cut -d '<' -f 1|sort -u |sed 's/vault_//g') ; do
     vaultswitch $v
    done

    The output might look like:

    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                     Dload  Upload   Total   Spent    Left  Speed
    100 67683    0 67683    0     0   926k      0 --:--:-- --:--:-- --:--:-- 1016k
    Vault Release 1.14.0 found on the HASHICORP repository.
    Using custom release: 1.14.0
    Trying to switch to Vault version 1.14.0
    No valid binary found in Cellar / Homebrew/bin or missing prebuilt archive.
    Working... Downloading... https://releases.hashicorp.com/vault/1.14.0/vault_1.14.0_darwin_arm64.zip
    Done.
     Unzipping vault_1.14.0_darwin_arm64.zip... Done.
     Extracted and switched Vault to 1.14.0. Done.
    Vault v1.14.0 (13a649f860186dffe3f3a4459814d87191efc321), built 2023-06-19T11:40:23Z
    Vault Release 1.14.0+ent found on the HASHICORP repository.
    Using custom release: 1.14.0+ent
    Trying to switch to Vault version 1.14.0+ent
    No valid binary found in Cellar / Homebrew/bin or missing prebuilt archive.
    Working... Downloading... https://releases.hashicorp.com/vault/1.14.0+ent/vault_1.14.0+ent_darwin_arm64.zip
    Done.
    ...
    Trying to switch to Vault version vault_1.14.4+ent
    Working... Downloading... https://releases.hashicorp.com/vault/1.14.4+ent/vault_1.14.4+ent_darwin_arm64.zip Done.
     Unzipping vault_1.14.4+ent_darwin_arm64.zip... Done.
    Extracted and switched Vault to 1.14.4+ent. Done.

About

Utility to fast switch between Vault binaries on MAC

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages