Skip to content

Commit

Permalink
feat(docs): add GA4 and restructure docs
Browse files Browse the repository at this point in the history
  • Loading branch information
FalcoSuessgott committed Apr 7, 2024
1 parent 3991f78 commit cb9a907
Show file tree
Hide file tree
Showing 24 changed files with 109 additions and 122 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,17 @@

## Features
* Support KV version 1 & version 2 (no need to specify the version `vkv` will automatically detect the engines version)
* **CI/CD Integrations for [Gitlab, GitHub, Azure Devops](https://falcosuessgott.github.io/vkv/cicd/gitlab/)**
* **CI/CD Integrations for [Gitlab, GitHub, Azure Devops](https://falcosuessgott.github.io/vkv/cicd_gitlab)**
* support all Vault Auth Env Vars and `VKV_LOGIN_COMMAND` for avoiding having to hardcode the `VAULT_TOKEN` ([example](https://falcosuessgott.github.io/vkv/authentication/))
* recursively print secrets of any KV Engine in `json`, `yaml`, `markdown` and [other formats](https://falcosuessgott.github.io/vkv/export/formats/)
* recursively print secrets of any KV Engine in `json`, `yaml`, `markdown` and [other formats](https://falcosuessgott.github.io/vkv/export_formats/)
* engine export shows the secret version as well as its [custom metadata](https://developer.hashicorp.com/vault/docs/commands/kv/metadata)
* customize the output (show only-keys, only-paths, mask/unmask secrets) via [flags or environment](https://falcosuessgott.github.io/vkv/export/)
* print the CRUD-capabilities of the authenticated token for each KV-path (format: `policy`)
* print secrets in `export <key>=<value>` format for env var exporting (format: `export`)
* [import](https://falcosuessgott.github.io/vkv/06_import/) secrets back to Vault from `vkv`'s `json` or `yaml` format output
* save and restore KVv2 snapshots (including namespaces) ([kubernetes](https://falcosuessgott.github.io/vkv/advanced_examples/kubernetes/) example)
* list all KVv2-engines or namespaces for scripting purposes ([fzf](https://falcosuessgott.github.io/vkv/advanced_examples/fzf/) example)
* more handy [snippets](https://falcosuessgott.github.io/vkv/advanced_examples/diff/) using `fzf`, `sops` & `diff`,
* [import](https://falcosuessgott.github.io/vkv/import/) secrets back to Vault from `vkv`'s `json` or `yaml` format output
* save and restore KVv2 snapshots (including namespaces) ([kubernetes](https://falcosuessgott.github.io/vkv/example_kubernetes/) example)
* list all KVv2-engines or namespaces for scripting purposes ([fzf](https://falcosuessgott.github.io/vkv/example_fzf/) example)
* more handy [snippets](https://falcosuessgott.github.io/vkv/example_diff/) using `fzf`, `sops` & `diff`,

Checkout the [Quickstart](https://falcosuessgott.github.io/vkv/quickstart/) Guide to learn more about `vkv`

Expand Down
6 changes: 4 additions & 2 deletions docs/authentication/index.md → docs/authentication.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Authentication

`vkv` supports all of Vaults [environment variables](https://www.vaultproject.io/docs/commands#environment-variables). In order to authenticate you will have to set at least `VAULT_ADDR` and `VAULT_TOKEN`.

### MacOS/Linux
## MacOS/Linux
```
export VAULT_ADDR="http://127.0.0.1:8200"
export VAULT_TOKEN="hvs.XXX"
vkv export --path <KVv2-path>
```

### Windows
## Windows
```
SET VAULT_ADDR=http://127.0.0.1:8200
SET VAULT_TOKEN=s.XXX
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
3 changes: 2 additions & 1 deletion docs/configuration/index.md → docs/configuration.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Configuration
`vkv` and all its subcommands are highly configurable using environment variables.

Checkout the subcommands documentation aswell as the help messages (`vkv <subcommand> --help`) to see the available environment variables.
Checkout the subcommands documentation as well as the help messages (`vkv <subcommand> --help`) to see the available environment variables.

## Mode
You can control the executed subcommand of `vkv` by setting `VKV_MODE` to either on of:
Expand Down
1 change: 1 addition & 0 deletions docs/development/index.md → docs/development.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Development
Clone this repository and run:

```sh
Expand Down
4 changes: 2 additions & 2 deletions docs/advanced_examples/diff.md → docs/example_diff.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@

# diff
`vkv` can be used to compare secrets across Vault servers or KV engines.

```bash
Expand All @@ -8,4 +8,4 @@
Here is an example using `diff`, the `|` indicates the changed entry per line:

## Demo
![gif](../assets/diff.gif)
![gif](assets/diff.gif)
5 changes: 3 additions & 2 deletions docs/advanced_examples/direnv.md → docs/example_direnv.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# direnv
You can use `vkv` and [`direnv`](https://direnv.net/) to autimatically source KV secrets in your shell.

### Prerequisites
## Prerequisites
* Install [direnv](https://direnv.net/) and hook into your shell

### Demo
## Demo

Create in a project a `.envrc` file:
```bash
Expand Down
4 changes: 3 additions & 1 deletion docs/advanced_examples/fzf.md → docs/example_fzf.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# fzf

using `vault secrets list` and a little bit of `jq`-logic, we can get a list of all KV-engines visible for the token.

If we pipe this into `fzf` we can get a handy little preview-app:
Expand All @@ -7,4 +9,4 @@ vkv list engines --all --include-ns-prefix | fzf --preview 'vkv export -e ${}'
```

## Demo
![gif](../assets/fzf.gif)
![gif](assets/fzf.gif)
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
# Kubernetes

`vkv` comes in container images, which enable you to run scheduled snapshots in a kubernetes cluster.

The idea is to schedule a cronjob which snapshots a vault server and writes the snapshot files to a persistent volume.

Here is a minimum working `k3s` using `local-storage` example:


### create the volume directories
## create the volume directories

```bash
# on a k3s node
mkdir -p /data/volume/pv1
chmod 777 /data/volume/pv1 # for testing
```

### create a pv
## create a pv

```yaml
apiVersion: v1
Expand All @@ -39,7 +40,7 @@ spec:
- worker-node # change
```
### create a pvc
## create a pvc
```yaml
kind: PersistentVolumeClaim
apiVersion: v1
Expand All @@ -54,7 +55,7 @@ spec:
storage: 5Gi
```
### create a cronjob
## create a cronjob
```yaml
apiVersion: batch/v1
kind: CronJob
Expand Down Expand Up @@ -90,7 +91,7 @@ spec:
claimName: pvc
```
### verify snapshots
## verify snapshots
if everything went correct, you should see the following:
```bash
Expand All @@ -100,7 +101,7 @@ drwxr-xr-x. 2 root root 108 5. Jan 09:50 vkv-export-20230105095000
drwxr-xr-x. 2 root root 108 5. Jan 09:51 vkv-export-20230105095100
```

### some last thoughts
## some last thoughts
Obviously this approach is just for development purposes. In order to make it production ready, you should consider changing some things, such as:

* inject the environments from a ConfigMap
Expand Down
6 changes: 4 additions & 2 deletions docs/advanced_examples/sops.md → docs/example_sops.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# sops

In order to store the secret export created by `vkv` [sops](https://github.com/mozilla/sops#encrypting-using-hashicorp-vault) can be used.
This example shows how to encrypt & decrypt `vkv` exported secrets using `sops` and Vaults transit engine:

### Prerequisites
## Prerequisites
* Install [sops](https://github.com/mozilla/sops/releases)

### Demo
## Demo
```bash
export VAULT_ADDR="https://vault.server"
export VAULT_TOKEN="hvs.XXXX"
Expand Down
7 changes: 1 addition & 6 deletions docs/export/index.md → docs/export.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Export
## vkv export

recursively list secrets from Vaults KV2 engine in various formats
Expand All @@ -23,9 +24,3 @@ vkv export [flags]
-f, --format string available output formats: "base", "json", "yaml", "export", "policy", "markdown", "template" (env: VKV_EXPORT_FORMAT) (default "base")
-h, --help help for export
```

### SEE ALSO

* [vkv](vkv.md) - the swiss army knife when working with Vault KVv2 engines

###### Auto generated by spf13/cobra on 19-Nov-2023
File renamed without changes.
9 changes: 2 additions & 7 deletions docs/import/index.md → docs/import.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Import
# vkv import

import secrets from vkv's json or yaml output
Expand All @@ -19,15 +20,9 @@ vkv import [flags]
-s, --silent do not output secrets (env: VKV_IMPORT_SILENT)
```

### SEE ALSO

* [vkv](vkv.md) - the swiss army knife when working with Vault KVv2 engines

###### Auto generated by spf13/cobra on 19-Nov-2023

## read secrets from STDIN

The `-` in `vkv import -`, tells `vkv` do read data via STDIN. The idea of `vkv import -` is, in order to copy/mirror KV-v2 secrets or complete engines across diferrent Vault Servers or Namespaces, you can simply pipe
The `-` in `vkv import -`, tells `vkv` do read data via STDIN. The idea of `vkv import -` is, in order to copy/mirror KV-v2 secrets or complete engines across different Vault Servers or Namespaces, you can simply pipe
`vkv`s output into the `vkv import` command:

```bash
Expand Down
12 changes: 6 additions & 6 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@

## Features
* Support KV version 1 & version 2 (no need to specify the version `vkv` will automatically detect the engines version)
* **CI/CD Integrations for [Gitlab, GitHub, Azure Devops](https://falcosuessgott.github.io/vkv/cicd/gitlab/)**
* **CI/CD Integrations for [Gitlab, GitHub, Azure Devops](https://falcosuessgott.github.io/vkv/cicd_gitlab)**
* support all Vault Auth Env Vars and `VKV_LOGIN_COMMAND` for avoiding having to hardcode the `VAULT_TOKEN` ([example](https://falcosuessgott.github.io/vkv/authentication/))
* recursively print secrets of any KV Engine in `json`, `yaml`, `markdown` and [other formats](https://falcosuessgott.github.io/vkv/export/formats/)
* recursively print secrets of any KV Engine in `json`, `yaml`, `markdown` and [other formats](https://falcosuessgott.github.io/vkv/export_formats/)
* engine export shows the secret version as well as its [custom metadata](https://developer.hashicorp.com/vault/docs/commands/kv/metadata)
* customize the output (show only-keys, only-paths, mask/unmask secrets) via [flags or environment](https://falcosuessgott.github.io/vkv/export/)
* print the CRUD-capabilities of the authenticated token for each KV-path (format: `policy`)
* print secrets in `export <key>=<value>` format for env var exporting (format: `export`)
* [import](https://falcosuessgott.github.io/vkv/06_import/) secrets back to Vault from `vkv`'s `json` or `yaml` format output
* save and restore KVv2 snapshots (including namespaces) ([kubernetes](https://falcosuessgott.github.io/vkv/advanced_examples/kubernetes/) example)
* list all KVv2-engines or namespaces for scripting purposes ([fzf](https://falcosuessgott.github.io/vkv/advanced_examples/fzf/) example)
* more handy [snippets](https://falcosuessgott.github.io/vkv/advanced_examples/diff/) using `fzf`, `sops` & `diff`,
* [import](https://falcosuessgott.github.io/vkv/import/) secrets back to Vault from `vkv`'s `json` or `yaml` format output
* save and restore KVv2 snapshots (including namespaces) ([kubernetes](https://falcosuessgott.github.io/vkv/example_kubernetes/) example)
* list all KVv2-engines or namespaces for scripting purposes ([fzf](https://falcosuessgott.github.io/vkv/example_fzf/) example)
* more handy [snippets](https://falcosuessgott.github.io/vkv/example_diff/) using `fzf`, `sops` & `diff`,

Checkout the [Quickstart](https://falcosuessgott.github.io/vkv/quickstart/) Guide to learn more about `vkv`
12 changes: 7 additions & 5 deletions docs/installation/index.md → docs/installation.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
### cURL
# Installation

## cURL
```bash
version=$(curl https://api.github.com/repos/falcosuessgott/vkv/releases/latest -s | jq .name -r)
curl -OL "https://github.com/FalcoSuessgott/vkv/releases/download/${version}/vkv_$(uname)_$(uname -m).tar.gz"
Expand All @@ -7,7 +9,7 @@ chmod u+x vkv
./vkv version
```

### Packages
## Packages
`vkv` is releases RPM- & DEB packages and Windows & MacOS Binaries.

You can find and download all artifacts in the [release](https://github.com/FalcoSuessgott/vkv/releases) section.
Expand All @@ -27,21 +29,21 @@ tar xzf vkv_<version>.tar.gz
chmod u+x ./vkv
```

### Using `go`
## Using `go`
```bash
go install github.com/FalcoSuessgott/vkv@latest
vkv
```

### From Sources
## From Sources
```bash
# requires go to be installed
git clone https://github.com/FalcoSuessgott/vkv
cd vkv
go install
```

### Docker
## Docker
```bash
# ghcr.io
docker run -e VAULT_ADDR="${VAULT_ADDR}" -e VAULT_TOKEN="${VAULT_TOKEN}" ghcr.io/falcosuessgott/vkv
Expand Down
9 changes: 2 additions & 7 deletions docs/engines/index.md → docs/list_engines.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# List Engines
## vkv list engines

list all KVv2 engines
Expand All @@ -15,10 +16,4 @@ vkv list engines [flags]
-a, --all list all KV engines recursively from the specified namespaces (env: VKV_LIST_ENGINES_ALL)
-f, --format string available output formats: "base", "json", "yaml" (env: VKV_LIST_ENGINES_FORMAT) (default "base")
-h, --help help for engines
```

### SEE ALSO

* [vkv list](vkv_list.md) - list namespaces or KV engines

###### Auto generated by spf13/cobra on 19-Nov-2023
```
10 changes: 3 additions & 7 deletions docs/namespaces/index.md → docs/list_namespaces.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# List Namespaces

## vkv list namespaces

list all namespaces
Expand All @@ -14,10 +16,4 @@ vkv list namespaces [flags]
-a, --all list all namespaces recursively from the specified namespace (env: VKV_LIST_NAMESPACES_ALL)
-f, --format string available output formats: "base", "json", "yaml" (env: VKV_LIST_NAMESPACES_FORMAT (default "base")
-h, --help help for namespaces
```

### SEE ALSO

* [vkv list](vkv_list.md) - list namespaces or KV engines

###### Auto generated by spf13/cobra on 19-Nov-2023
```
Loading

0 comments on commit cb9a907

Please sign in to comment.