Skip to content

Instantly share code, notes, and snippets.

@StevenACoffman
Last active January 21, 2019 17:38
Show Gist options
  • Select an option

  • Save StevenACoffman/2ca256578d325838742486a69dd7eb7f to your computer and use it in GitHub Desktop.

Select an option

Save StevenACoffman/2ca256578d325838742486a69dd7eb7f to your computer and use it in GitHub Desktop.
Codesigning AWS-Vault

Install Golang (skip if already done)

If you don't have golang installed, you need to do that and export GOPATH

if [[ ! $(go version 2>/dev/null) ]]
then
  brew install go --cross-compile-common
fi

export GOPATH=${GOPATH:-$HOME/go}
mkdir -p "$GOPATH"

LINE=$(cat << EOF
export GOPATH=$GOPATH
EOF
)

FILE=$HOME/.bash_profile
# Only append LINE if file does not already contain it
grep -qF "$LINE" "$FILE" || echo "$LINE" >> "$FILE"

Deal with signing aws-vault

  1. Start keychain access
  2. Keychain access -> Certificate assistance -> Create a certificate
  3. Name it whatever you like (I choose AWSVAULTSIGNER)
  4. Check "Let me override defaults"
  5. Just click continue until you reach "Extended Key Usage Extension" select "Code Signing"
  6. Just click continue until you reach the point to select Keychain, select the System keychain
  7. type codesign --force --sign name-of-certificate /Users/${HOME}/go/src/github.com/99designs/aws-vault/aws-vault in your console
  8. You can then sign your binary like this:
go get -u -v github.com/99designs/aws-vault
cd $GOPATH/src/github.com/99designs/aws-vault
make build
codesign --force --sign name-of-certificate ${GOPATH}/src/github.com/99designs/aws-vault/aws-vault
export PATH="$(PWD):$PATH"
# verify signature
codesign -dvv $(which aws-vault) 2>&1 | grep Authority

Verify signature

$ codesign -dvv $(which aws-vault) 2>&1 | grep Authority

Check out Apple's guide on it here, or find it in Keychain Access > Certificate Assistant > Create Certificate > Code Signing Certificate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment