Skip to content

Commit

Permalink
Merge pull request #23 from serokell/karandit/fix-README-example
Browse files Browse the repository at this point in the history
[Chore] Fix snippet in README
  • Loading branch information
rvem authored May 9, 2023
2 parents e4ec077 + 335c890 commit 1b4943a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,32 +26,32 @@ in {
vaultPrefix = "kv/servers/${config.networking.hostName}";
vaultAddress = "https://vault.example.com:8200";
# Define a secret called `something`, with default options.
secrets.example = {};
# Define a secret called `mysecret`, with default options.
secrets.mysecret = {};
};
services.example = {
services.myservice = {
enable = true;
environmentFile = "${vs.something}/environment";
environmentFile = "${vs.mysecret}/environment";
};
}
```

In this example, we define a secret `example` for a service also called
`example`. The AppRole used to log in will be `example` as well. In order to
In this example, we define a secret `mysecret` for a service called
`myservice`. The AppRole used to log in will be `myservice`. In order to
log in using such an AppRole, it first needs to be created in Vault, and
credentials for it need to be generated, and placed in
`/etc/vault-secrets.env.d/example`. This file should be formatted according to
`/etc/vault-secrets.env.d/myservice`. This file should be formatted according to
systemd `EnvironmentFile`, and contain the variables `VAULT_ROLE_ID` and
`VAULT_SECRET_ID`, both of which are UUID provided by Vault. Using the
script generators documented below significantly simplifies the process.

The secrets themselves will be fetched from Vault from two specific paths under
`vaultPrefix`. In this example, it will query `kv/servers/hostname/environment`
and `kv/servers/hostname/secrets`. Any keys defined in `environment` will be
dumped into `/run/secrets/example/environment` in a format suitable for usage
dumped into `/run/secrets/mysecret/environment` in a format suitable for usage
with systemd `EnvironmentFile`. Any keys defined in `secrets` will be dumped
into individual files under `/run/secrets/example`, named after the keys, and
into individual files under `/run/secrets/mysecret`, named after the keys, and
containing the corresponding value. The values of `secrets` may optionally be
flagged as `base64` encoded, which is recommended if you need to store binary
data or multiline text, as Vault has a bad habit of mangling these.
Expand Down

0 comments on commit 1b4943a

Please sign in to comment.