Skip to content
Merged
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
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.21-alpine AS builder
FROM golang:1.24-alpine AS builder

WORKDIR /build/vault_dump
COPY . .
Expand All @@ -8,7 +8,7 @@ RUN apk add --no-cache git make \
&& make linux-amd64 \
&& adduser -D -g '' vault_dump

FROM alpine:3.20
FROM alpine:3.22

COPY --from=builder /build/vault_dump/build/vault_dump-linux-amd64 /usr/bin/vault_dump
COPY --from=builder /etc/passwd /etc/passwd
Expand Down
19 changes: 9 additions & 10 deletions cmd/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand All @@ -32,7 +32,6 @@ package cmd

import (
"encoding/json"
"io/ioutil"
"os"
"time"

Expand Down Expand Up @@ -165,7 +164,7 @@ func runDump() {
os.Exit(1)
}

wOErr := ioutil.WriteFile(core.OutFile, []byte(output), 0600)
wOErr := os.WriteFile(core.OutFile, []byte(output), 0600)
if wOErr != nil {
core.Logger.Error("failed to write output file",
"file", core.OutFile)
Expand Down
19 changes: 9 additions & 10 deletions cmd/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
Expand All @@ -32,7 +32,6 @@ package cmd

import (
"encoding/json"
"io/ioutil"
"os"
"sort"

Expand Down Expand Up @@ -195,7 +194,7 @@ func runRestore() {
core.IsRestore = true
core.KeyRing = core.LoadKey()

encDump, err := ioutil.ReadFile(core.InFile)
encDump, err := os.ReadFile(core.InFile)
if err != nil {
core.Logger.Error("cannot read input file", "file",
core.InFile, "err", err)
Expand Down
5 changes: 2 additions & 3 deletions core/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package core
import (
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
Expand Down Expand Up @@ -90,7 +89,7 @@ func LoadKey() crypto.KeyRing {
}

for _, keyfile := range KeyFile {
raw_key, err := ioutil.ReadFile(keyfile)
raw_key, err := os.ReadFile(keyfile)
if err != nil {
Logger.Error("unable to read file", "key", keyfile, "err", err)
os.Exit(1)
Expand Down Expand Up @@ -181,7 +180,7 @@ func Authenticate() (*vault.Client, error) {
Logger.Warn("cannot determine home directory")
}

fileToken, err := ioutil.ReadFile(
fileToken, err := os.ReadFile(
fmt.Sprintf("%s/.vault-token", home))

if err != nil {
Expand Down
62 changes: 29 additions & 33 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,55 +1,51 @@
module github.com/PyratLabs/vault_dump

go 1.21
go 1.24.0

require (
github.com/ProtonMail/gopenpgp/v2 v2.7.5
github.com/ProtonMail/gopenpgp/v2 v2.9.0
github.com/hashicorp/go-hclog v1.6.3
github.com/hashicorp/vault/api v1.14.0
github.com/hashicorp/vault/api v1.22.0
github.com/mitchellh/go-homedir v1.1.0
github.com/spf13/cobra v1.8.1
github.com/spf13/viper v1.19.0
github.com/spf13/cobra v1.10.1
github.com/spf13/viper v1.21.0
)

require (
github.com/ProtonMail/go-crypto v1.0.0 // indirect
github.com/ProtonMail/go-crypto v1.3.0 // indirect
github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect
github.com/cenkalti/backoff/v3 v3.2.2 // indirect
github.com/cloudflare/circl v1.3.9 // indirect
github.com/fatih/color v1.17.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/go-jose/go-jose/v4 v4.0.2 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cloudflare/circl v1.6.1 // indirect
github.com/fatih/color v1.18.0 // indirect
github.com/fsnotify/fsnotify v1.9.0 // indirect
github.com/go-jose/go-jose/v4 v4.1.3 // indirect
github.com/go-viper/mapstructure/v2 v2.4.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/go-retryablehttp v0.7.8 // indirect
github.com/hashicorp/go-rootcerts v1.0.2 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.1.8 // indirect
github.com/hashicorp/go-secure-stdlib/parseutil v0.2.0 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
github.com/hashicorp/go-sockaddr v1.0.6 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/go-sockaddr v1.0.7 // indirect
github.com/hashicorp/hcl v1.0.1-vault-7 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-colorable v0.1.14 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/ryanuber/go-glob v1.0.0 // indirect
github.com/sagikazarmark/locafero v0.6.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/sagikazarmark/locafero v0.12.0 // indirect
github.com/spf13/afero v1.15.0 // indirect
github.com/spf13/cast v1.10.0 // indirect
github.com/spf13/pflag v1.0.10 // indirect
github.com/subosito/gotenv v1.6.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/exp v0.0.0-20240613232115-7f521ea00fb8 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
golang.org/x/time v0.5.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
go.yaml.in/yaml/v3 v3.0.4 // indirect
golang.org/x/crypto v0.42.0 // indirect
golang.org/x/net v0.44.0 // indirect
golang.org/x/sys v0.36.0 // indirect
golang.org/x/text v0.29.0 // indirect
golang.org/x/time v0.13.0 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
)
Loading