From 56567464a5955ce6be66769ddec4acea90ac36b5 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 3 Oct 2022 07:35:27 -0500 Subject: docs --- docs/config.md | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'docs') diff --git a/docs/config.md b/docs/config.md index 5ad80033..a4c1c8ee 100644 --- a/docs/config.md +++ b/docs/config.md @@ -558,6 +558,12 @@ By default, a random JWT secret key is generated at each start. It is convenient The JWT TTL option determines how long issued JWTs are valid, defaulting to 7 days. +API keys can be configured to allow for secure communication without requiring the caller to obtain a JWT by signing in with a username and password. Each key must be given a name and a key with a length between 16 and 255 characters (inclusive). Callers may then supply one of the configured keys in the `X-API-Key` header when making web requests. Remember that API keys are secrets, so keep them safe. + +An optional comma separated list of [CIDRs](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) can be defined for each key, which will restrict usage of the key to callers with a remote IP address that falls within one of the defined CIDRs. The default CIDR list for each key is `0.0.0.0/0,::0`, which applies to any IP address (IPv4 or IPv6). + +A common use case for CIDR filtering might be to restrict API access to clients within your home network. Assuming your network uses the common `192.168.1.x` addressing, you could specify a `cidr` of `192.168.1.0/24`, which would apply to any IP between `192.168.1.1` and `192.168.1.254`, inclusive. + | Command-Line | Environment Variable | Description | | ---------------- | -------------------- | --------------------------------------------------- | | `-X\|--no-auth` | `NO_AUTH` | Determines whether authentication is to be disabled | @@ -576,6 +582,10 @@ web: jwt: key: ~ ttl: 604800000 + api_keys: + my_api_key: + key: + cidr: 0.0.0.0/0,::/0 ``` # Filters -- cgit v1.2.3 From 074b185d046602f450104fefb24b9e69acdb4c7c Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 3 Oct 2022 07:45:53 -0500 Subject: clarify proxy use case --- docs/config.md | 2 ++ 1 file changed, 2 insertions(+) (limited to 'docs') diff --git a/docs/config.md b/docs/config.md index a4c1c8ee..50ff5f6c 100644 --- a/docs/config.md +++ b/docs/config.md @@ -564,6 +564,8 @@ An optional comma separated list of [CIDRs](https://en.wikipedia.org/wiki/Classl A common use case for CIDR filtering might be to restrict API access to clients within your home network. Assuming your network uses the common `192.168.1.x` addressing, you could specify a `cidr` of `192.168.1.0/24`, which would apply to any IP between `192.168.1.1` and `192.168.1.254`, inclusive. +Note that CIDR filtering may not work as expected behind a reverse proxy, ingress controller, or load balancer, because the remote IP address will be that of the device that's handling ingress. This application doesn't support the `X-Forwarded-For` header (or anything like it) because a bad actor can easily fake it. If you wish to use CIDR filtering in this scenario, you'll need to do it at the point of ingress to your network. + | Command-Line | Environment Variable | Description | | ---------------- | -------------------- | --------------------------------------------------- | | `-X\|--no-auth` | `NO_AUTH` | Determines whether authentication is to be disabled | -- cgit v1.2.3 From 6028ae895cf9832a3ecce4cabdbd73bd98940b73 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 3 Oct 2022 07:48:26 -0500 Subject: document --generate-api-key --- docs/config.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/config.md b/docs/config.md index 50ff5f6c..a4bcfc5c 100644 --- a/docs/config.md +++ b/docs/config.md @@ -560,6 +560,8 @@ The JWT TTL option determines how long issued JWTs are valid, defaulting to 7 da API keys can be configured to allow for secure communication without requiring the caller to obtain a JWT by signing in with a username and password. Each key must be given a name and a key with a length between 16 and 255 characters (inclusive). Callers may then supply one of the configured keys in the `X-API-Key` header when making web requests. Remember that API keys are secrets, so keep them safe. +You can generate a random, 32 bit API key by starting the application with `-k` or `--generate-api-key` at the command line. + An optional comma separated list of [CIDRs](https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing) can be defined for each key, which will restrict usage of the key to callers with a remote IP address that falls within one of the defined CIDRs. The default CIDR list for each key is `0.0.0.0/0,::0`, which applies to any IP address (IPv4 or IPv6). A common use case for CIDR filtering might be to restrict API access to clients within your home network. Assuming your network uses the common `192.168.1.x` addressing, you could specify a `cidr` of `192.168.1.0/24`, which would apply to any IP between `192.168.1.1` and `192.168.1.254`, inclusive. @@ -790,9 +792,10 @@ flags: The application can be run in "command mode", causing it to execute a command and quit immediately. Available commands are: -| Command | Description | -| --------------------- | --------------------------------------------------- | -| `-v\|--version` | Display the current application version | -| `-h\|--help` | Display available command-line arguments | -| `-e\|--envars` | Display available environment variables | -| `-g\|--generate-cert` | Generate an X509 certificate and password for HTTPS | +| Command | Description | +| ------------------------ | --------------------------------------------------- | +| `-v\|--version` | Display the current application version | +| `-h\|--help` | Display available command-line arguments | +| `-e\|--envars` | Display available environment variables | +| `-g\|--generate-cert` | Generate an X509 certificate and password for HTTPS | +| `-k\|--generate-api-key` | Generate a random 32 bit API key | -- cgit v1.2.3