From 94f794970f9b84847da90fc243be3b48244bb56b Mon Sep 17 00:00:00 2001 From: sudoforge <9c001b67637a@sudoforge.com> Date: Fri, 12 May 2023 22:51:04 -0700 Subject: [PATCH] feat: add support for gopass as a credential store This change adds support for `gopass` as a credential store, based on the `pass` implementation. Closes: #138 Closes: #166 Signed-off-by: sudoforge <9c001b67637a@sudoforge.com> --- .github/workflows/build.yml | 6 + Dockerfile | 31 ++++- Makefile | 5 +- README.md | 25 ++-- gopass/cmd/main.go | 10 ++ gopass/gopass.go | 236 ++++++++++++++++++++++++++++++++++++ gopass/gopass_test.go | 87 +++++++++++++ 7 files changed, 388 insertions(+), 12 deletions(-) create mode 100644 gopass/cmd/main.go create mode 100644 gopass/gopass.go create mode 100644 gopass/gopass_test.go diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 201281b7..7fda5158 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -63,6 +63,12 @@ jobs: run: | sudo apt-get update sudo apt-get install -y dbus-x11 gnome-keyring libsecret-1-dev pass + - + name: Install gopass + env: + GOPASS_VERSION: v1.15.5 + run: go install github.com/gopasspw/gopass@${{ env.GOPASS_VERSION }} + - name: GPG conf if: ${{ matrix.os == 'ubuntu-20.04' }} diff --git a/Dockerfile b/Dockerfile index 41432719..3078f386 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,6 +5,7 @@ ARG XX_VERSION=1.2.1 ARG OSXCROSS_VERSION=11.3-r7-debian ARG GOLANGCI_LINT_VERSION=v1.51.1 ARG DEBIAN_FRONTEND=noninteractive +ARG GOPASS_VERSION=v1.15.5 ARG PACKAGE=github.com/docker/docker-credential-helpers @@ -68,12 +69,19 @@ RUN xx-apt-get install -y binutils gcc libc6-dev libgcc-10-dev libsecret-1-dev p FROM base AS test ARG DEBIAN_FRONTEND +ARG GOPASS_VERSION RUN xx-apt-get install -y dbus-x11 gnome-keyring gpg-agent gpgconf libsecret-1-dev pass +RUN --mount=type=bind,target=. \ + --mount=type=cache,target=/root/.cache \ + --mount=type=cache,target=/go/pkg/mod \ + GOFLAGS='' go install github.com/gopasspw/gopass@${GOPASS_VERSION} RUN --mount=type=bind,target=. \ --mount=type=cache,target=/root/.cache \ --mount=type=cache,target=/go/pkg/mod </dev/null + gopass config core.autopush false 1>/dev/null + gopass config core.autosync false 1>/dev/null + gopass config core.exportkeys false 1>/dev/null + gopass config core.notifications false 1>/dev/null + gopass config core.color false 1>/dev/null + gopass config core.nopager true 1>/dev/null + gopass init --crypto gpgcli --storage fs 7D851EB72D73BDA0 + gpg -k mkdir /out @@ -106,7 +127,8 @@ RUN --mount=type=bind,target=. \ --mount=type=bind,source=/tmp/.revision,target=/tmp/.revision,from=version <