From bfa5f2f991a0d78772d9deefeaf77009087126e1 Mon Sep 17 00:00:00 2001 From: Michael Tibben Date: Thu, 3 Sep 2020 21:26:43 +1000 Subject: [PATCH 1/2] Hack around DNS resolution issues on Android --- Makefile | 7 +++++-- go.mod | 1 + go.sum | 2 ++ main.go | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index d98083cbf..1511327fa 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ install: aws-vault cp -a ./aws-vault $(INSTALL_DIR) codesign --options runtime --timestamp --sign "$(CERT_ID)" $(INSTALL_DIR)/aws-vault || true -binaries: aws-vault-linux-amd64 aws-vault-linux-arm64 aws-vault-linux-ppc64le aws-vault-linux-arm7 aws-vault-darwin-amd64 aws-vault-windows-386.exe aws-vault-freebsd-amd64 +binaries: aws-vault-linux-amd64 aws-vault-linux-arm64 aws-vault-linux-ppc64le aws-vault-linux-arm7 aws-vault-android-amd64 aws-vault-darwin-amd64 aws-vault-windows-386.exe aws-vault-freebsd-amd64 clean: rm -f ./aws-vault ./aws-vault-*-* ./SHA256SUMS @@ -40,6 +40,9 @@ aws-vault-linux-ppc64le: $(SRC) aws-vault-linux-arm7: $(SRC) GOOS=linux GOARCH=arm GOARM=7 go build $(BUILD_FLAGS) -o $@ . +aws-vault-android-arm64: $(SRC) + GOOS=android GOARCH=arm64 go build $(BUILD_FLAGS) -o $@ . + aws-vault-windows-386.exe: $(SRC) GOOS=windows GOARCH=386 go build $(BUILD_FLAGS) -o $@ . @@ -47,4 +50,4 @@ aws-vault-darwin-amd64.dmg: aws-vault-darwin-amd64 ./bin/create-dmg aws-vault-darwin-amd64 $@ SHA256SUMS: binaries aws-vault-darwin-amd64.dmg - shasum -a 256 aws-vault-freebsd-amd64 aws-vault-linux-amd64 aws-vault-linux-arm64 aws-vault-linux-ppc64le aws-vault-linux-arm7 aws-vault-windows-386.exe aws-vault-darwin-amd64.dmg > $@ + shasum -a 256 aws-vault-freebsd-amd64 aws-vault-linux-amd64 aws-vault-linux-arm64 aws-vault-linux-ppc64le aws-vault-linux-arm7 aws-vault-android-arm64 aws-vault-windows-386.exe aws-vault-darwin-amd64.dmg > $@ diff --git a/go.mod b/go.mod index 5564a7cef..854a401b4 100644 --- a/go.mod +++ b/go.mod @@ -12,6 +12,7 @@ require ( github.com/google/go-cmp v0.5.2 github.com/keybase/go-keychain v0.0.0-20200502122510-cda31fe0c86d // indirect github.com/mitchellh/go-homedir v1.1.0 + github.com/mtibben/androiddnsfix v0.0.0-20200903112207-1169bfc0deaa github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 github.com/smartystreets/goconvey v1.6.4 // indirect golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a diff --git a/go.sum b/go.sum index 7394ad23c..17921eddf 100644 --- a/go.sum +++ b/go.sum @@ -44,6 +44,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mtibben/androiddnsfix v0.0.0-20200903112207-1169bfc0deaa h1:jyhyxLoqYdxnIBeBeOXqLgrHySVirAgKKP5GBk1dsPA= +github.com/mtibben/androiddnsfix v0.0.0-20200903112207-1169bfc0deaa/go.mod h1:Cu3Rcze2YUpuTWfggCBafY8U9/ckCksdAiONQ7XDvB8= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= diff --git a/main.go b/main.go index 7e1f10fa5..4f1c62c40 100644 --- a/main.go +++ b/main.go @@ -5,6 +5,7 @@ import ( "github.com/99designs/aws-vault/v6/cli" "github.com/alecthomas/kingpin" + _ "github.com/mtibben/androiddnsfix" ) // Version is provided at compile time From d4887cef76443beb5b803caca0de8e12f0243b46 Mon Sep 17 00:00:00 2001 From: Michael Tibben Date: Mon, 7 Sep 2020 19:52:16 +1000 Subject: [PATCH 2/2] Build a static version of the android binary --- Makefile | 2 +- go.mod | 2 +- go.sum | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 1511327fa..d1e3bbbaa 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ aws-vault-linux-arm7: $(SRC) GOOS=linux GOARCH=arm GOARM=7 go build $(BUILD_FLAGS) -o $@ . aws-vault-android-arm64: $(SRC) - GOOS=android GOARCH=arm64 go build $(BUILD_FLAGS) -o $@ . + GOOS=linux GOARCH=arm64 go build -tags='androiddnsfix' $(BUILD_FLAGS) -o $@ . aws-vault-windows-386.exe: $(SRC) GOOS=windows GOARCH=386 go build $(BUILD_FLAGS) -o $@ . diff --git a/go.mod b/go.mod index 854a401b4..f8eebc9fb 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,7 @@ require ( github.com/google/go-cmp v0.5.2 github.com/keybase/go-keychain v0.0.0-20200502122510-cda31fe0c86d // indirect github.com/mitchellh/go-homedir v1.1.0 - github.com/mtibben/androiddnsfix v0.0.0-20200903112207-1169bfc0deaa + github.com/mtibben/androiddnsfix v0.0.0-20200907095054-ff0280446354 github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 github.com/smartystreets/goconvey v1.6.4 // indirect golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a diff --git a/go.sum b/go.sum index 17921eddf..a393fcd59 100644 --- a/go.sum +++ b/go.sum @@ -46,6 +46,8 @@ github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mtibben/androiddnsfix v0.0.0-20200903112207-1169bfc0deaa h1:jyhyxLoqYdxnIBeBeOXqLgrHySVirAgKKP5GBk1dsPA= github.com/mtibben/androiddnsfix v0.0.0-20200903112207-1169bfc0deaa/go.mod h1:Cu3Rcze2YUpuTWfggCBafY8U9/ckCksdAiONQ7XDvB8= +github.com/mtibben/androiddnsfix v0.0.0-20200907095054-ff0280446354 h1:aS4S9U7xE7bwYB6gn/X0BteBAasVEfQwPV5k8trGXW4= +github.com/mtibben/androiddnsfix v0.0.0-20200907095054-ff0280446354/go.mod h1:Cu3Rcze2YUpuTWfggCBafY8U9/ckCksdAiONQ7XDvB8= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=