Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Support macos touchid #131

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
language: go

osx_image: xcode8.3
install: ./scripts/ci_install.sh

go:
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ $(BIN)-windows-386.exe: $(SRC)
GOOS=windows GOARCH=386 go build -o $@ -ldflags="$(FLAGS)" .

release: $(BIN)-linux-amd64 $(BIN)-darwin-amd64 $(BIN)-windows-386.exe
codesign -s $(CERT) $(BIN)-darwin-amd64
codesign -s "$(CERT)" $(BIN)-darwin-amd64

clean:
rm -f $(BIN)-*-*
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,19 @@ Developed with golang, to install run:
go get github.com/99designs/aws-vault
```

## Self-signing your binary

Binaries that call Keychain need to be signed, otherwise they always show the "allow access" prompt. Releases are signed by 99designs certificates, but if you are actively developing and want to mimic the behaviour of a signed release you can generate a self-signed code signing certificate.

Check out Apple's guide on it [here](http://web.archive.org/web/20090119080759/http://developer.apple.com/documentation/Security/Conceptual/CodeSigningGuide/Procedures/chapter_3_section_2.html), or find it in `Keychain Access > Certificate Assistant > Create Certificate > Code Signing Certificate`.

You can then sign your binary like this:

```bash
make build
codesign -s "Name of my certificate" ./aws-vault
```

## References and Inspiration

* https://github.com/pda/aws-keychain
Expand Down
1 change: 1 addition & 0 deletions cli/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ func ExecCommand(app *kingpin.Application, input ExecCommandInput) {
val, err := creds.Get()
if err != nil {
app.Fatalf(vault.FormatCredentialError(input.Profile, profiles, err))
return
}

if input.StartServer {
Expand Down
9 changes: 8 additions & 1 deletion cli/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var GlobalFlags struct {
Debug bool
Backend string
PromptDriver string
Biometrics bool
}

func ConfigureGlobals(app *kingpin.Application) {
Expand All @@ -42,17 +43,23 @@ func ConfigureGlobals(app *kingpin.Application) {
OverrideDefaultFromEnvar("AWS_VAULT_PROMPT").
EnumVar(&GlobalFlags.PromptDriver, promptsAvailable...)

app.Flag("biometrics", "Use biometric authentication if supported").
OverrideDefaultFromEnvar("AWS_VAULT_BIOMETRICS").
BoolVar(&GlobalFlags.Biometrics)

app.PreAction(func(c *kingpin.ParseContext) (err error) {
if !GlobalFlags.Debug {
log.SetOutput(ioutil.Discard)
}
if keyringImpl == nil {
keyringImpl, err = keyring.Open(KeyringName, GlobalFlags.Backend)
}
if globals.Biometrics {
keyring.Config.UseBiometrics = true
}
if awsConfigFile == nil {
awsConfigFile, err = vault.NewConfigFromEnv()
}
return err
})

}
100 changes: 97 additions & 3 deletions vendor/github.com/99designs/keyring/keychain.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions vendor/github.com/99designs/keyring/keyring.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions vendor/github.com/lox/go-touchid/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions vendor/github.com/lox/go-touchid/touchid.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions vendor/vendor.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,12 @@
"revision": "efeae48c0b272ac15a6c0b53129285b2b0ed828d",
"revisionTime": "2017-08-10T04:31:23Z"
},
{
"checksumSHA1": "kEyCzFEzVLWWRauNn0Nzxg2pg6Q=",
"path": "github.com/lox/go-touchid",
"revision": "619cc8e578d0ef916aa29c806117c370f9d621cb",
"revisionTime": "2017-07-12T10:52:33Z"
},
{
"checksumSHA1": "AXacfEchaUqT5RGmPmMXsOWRhv8=",
"path": "github.com/mitchellh/go-homedir",
Expand Down