Skip to content

Commit 02d76bb

Browse files
authored
DOC-734 Add --secrets CLI flag (#101)
1 parent 6422940 commit 02d76bb

File tree

1 file changed

+47
-7
lines changed

1 file changed

+47
-7
lines changed

modules/configuration/pages/secrets.adoc

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
= Secrets
2+
description: Methods for adding secrets to your Redpanda configuration without exposing them.
23

34
This topic outlines how to add secrets to a Redpanda Connect configuration without exposing them.
45

5-
== Using environment variables
6+
== Store secrets in environment variables
67

7-
One of the most prolific approaches to providing secrets to a service is via environment variables. Redpanda Connect allows you to inject the values of environment variables into a configuration with the interpolation syntax `+${FOO}+`, within a configuration it looks like this:
8+
A common way to securely pass secrets to a service is to use environment variables. Redpanda Connect allows you to inject the values of environment variables into a configuration with the interpolation syntax `+${SECRET}+`. For example:
89

910
[source,yml]
1011
----
@@ -15,14 +16,53 @@ thing:
1516
[NOTE]
1617
.Use quotes
1718
====
18-
Note that it would be valid to have `+super_secret: ${SECRET}+` above (without the quotes), but if `SECRET` is unset then the configuration becomes structurally different. Therefore, it's always best to wrap environment variable interpolations with quotes so that when the variable is unset you still have a valid configuration (with an empty string).
19+
It is valid to have `+super_secret: ${SECRET}+` above (without the quotes), but if `SECRET` is unset then the configuration becomes structurally different. Therefore, it's always best to wrap environment variable interpolations within quotes so that when the variable is unset you still have a valid configuration (with an empty string).
1920
====
2021

21-
More information about this syntax can be found on the xref:configuration:interpolation.adoc[interpolation field page].
22+
For more information about this syntax, see the xref:configuration:interpolation.adoc[interpolation field page].
2223

23-
== Using CLI flags
24+
== Look up secrets on a remote system at runtime
2425

25-
As an alternative to environment variables, you can set specific fields within a configuration using the CLI flag `--set`, where the syntax is a `<path>=<value>` pair:
26+
Starting with version 4.39.0, you can use the `rpk connect` CLI flag `--secrets` to look up secrets values on a remote system at runtime (for example, in your secrets management solution). This means that Redpanda Connect resolves interpolations in your configuration at runtime without setting environment variables.
27+
28+
29+
For example, you could run the following command to retrieve the value for `"$\{SECRET}"`, when the secret is stored on a Redis server.
30+
31+
```bash
32+
33+
rpk connect run ./config.yaml --secrets redis://secret:[email protected]
34+
35+
```
36+
The command tries to load the secret value from the specified Uniform Resource Name (URN) using the format `scheme://secret:server_address`.
37+
38+
You can specify multiple URNs separated by commas, which are tried in turn until a secrets value is successfully returned.
39+
40+
=== Supported remote systems
41+
42+
You can retrieve secrets from all of the following remote systems.
43+
44+
|===
45+
| Remote system | URN format
46+
47+
| AWS
48+
| `aws://region/prefix` +
49+
For example: `aws://eu-west-1/redpanda/`
50+
51+
| AZURE
52+
| `az://vault-uri/prefix`. The `vault-uri` value should not contain a `https://` prefix.
53+
54+
| GCP
55+
| `gcp://projectID/prefix` +
56+
For example: `gcp://project-id/redpanda-`
57+
58+
| Redis
59+
| `redis://secret:[email protected]`
60+
61+
|===
62+
63+
== Set secrets using shell commands
64+
65+
You can set specific fields within a configuration using the CLI flag `--set`, where the syntax is a `<path>=<value>` pair:
2666

2767
* `<path>`: A placeholder for the xref:configuration:field_paths.adoc[dot-separated path to the field being set].
2868
* `<value>`: The value you want to set the field to.
@@ -59,7 +99,7 @@ rpk connect run ./config.yaml \
5999

60100
Using this method lets you inject the secret into the configuration without leaking it into an environment variable.
61101

62-
== Avoiding leaked secrets
102+
== Avoid leaked secrets
63103

64104
There are a few ways in which configurations parsed by Redpanda Connect can be exported back out of the service. In all of these cases Redpanda Connect will attempt to scrub any field values within the config that are known secrets (any field marked as a secret in the docs).
65105

0 commit comments

Comments
 (0)