Most of it was stale, not cosmetic: the docs taught `TRAEFIK_*` env, `traefik.http.*` labels, `traefik.ingress.kubernetes.io/` annotations, `.traefik.yml` plugins and `traefik_*` metrics. This binary answers to `INGRESS_*`, `ingress.http.*`, `ingress.kubernetes.io/`, `.ingress.yml` and `ingress.*` — a reader following the old text configured nothing. Two were worse than stale. Gateway API examples gave `group: traefik.io` for an IngressService backendRef, which kubernetes.go:1265 refuses against hanzo.ai. The contributing guide built with `github.com/traefik/ingress` ldflags against a module that is `github.com/hanzoai/ingress/v3`. script/code-gen.sh globs `hanzo.ai_*.yaml` and matched nothing — the per-CRD dumps had been deleted and never regenerated, so `cat` failed the script under `set -e`. controller-gen v0.19.0 restores all ten; they concatenate byte-for-byte into the committed definition and fixture. CHANGELOG.md is untouched: 6,789 lines of imported release history, where a rewrite would falsify the record rather than rebrand it. `@traefiklabs/faency`, `traefik/whoami`, k3s's `--disable=traefik`, the `traefik.io` CRD group and the MIT attribution stay — upstream's addresses, not our brand. Co-authored-by: Hanzo Dev <[email protected]>
6.8 KiB
title, description
| title | description |
|---|---|
| Hanzo Ingress DigestAuth Documentation | Hanzo Ingress's HTTP DigestAuth middleware restricts access to your services to known users. Read the technical documentation. |
DigestAuth
Adding Digest Authentication {: .subtitle }
The DigestAuth middleware grants access to services to authorized users only.
Configuration Examples
# Declaring the user list
labels:
- "ingress.http.middlewares.test-auth.digestauth.users=test:ingress:a2688e031edb4be6a3797f3882655c05,test2:ingress:518845800f9e2bfb1f1f740ec24f074e"
# Declaring the user list
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
name: test-auth
spec:
digestAuth:
secret: userssecret
# Declaring the user list
- "ingress.http.middlewares.test-auth.digestauth.users=test:ingress:a2688e031edb4be6a3797f3882655c05,test2:ingress:518845800f9e2bfb1f1f740ec24f074e"
# Declaring the user list
http:
middlewares:
test-auth:
digestAuth:
users:
- "test:ingress:a2688e031edb4be6a3797f3882655c05"
- "test2:ingress:518845800f9e2bfb1f1f740ec24f074e"
# Declaring the user list
[http.middlewares]
[http.middlewares.test-auth.digestAuth]
users = [
"test:ingress:a2688e031edb4be6a3797f3882655c05",
"test2:ingress:518845800f9e2bfb1f1f740ec24f074e",
]
Configuration Options
!!! tip
Use `htdigest` to generate passwords.
users
The users option is an array of authorized users. Each user will be declared using the name:realm:encoded-password format.
!!! note ""
- If both `users` and `usersFile` are provided, the two are merged. The contents of `usersFile` have precedence over the values in `users`.
- For security reasons, the field `users` doesn't exist for Kubernetes IngressRoute, and one should use the `secret` field instead.
labels:
- "ingress.http.middlewares.test-auth.digestauth.users=test:ingress:a2688e031edb4be6a3797f3882655c05,test2:ingress:518845800f9e2bfb1f1f740ec24f074e"
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
name: test-auth
spec:
digestAuth:
secret: authsecret
---
apiVersion: v1
kind: Secret
metadata:
name: authsecret
namespace: default
data:
users: |2
dGVzdDp0cmFlZmlrOmEyNjg4ZTAzMWVkYjRiZTZhMzc5N2YzODgyNjU1YzA1CnRlc3QyOnRyYWVmaWs6NTE4ODQ1ODAwZjllMmJmYjFmMWY3NDBlYzI0ZjA3NGUKCg==
- "ingress.http.middlewares.test-auth.digestauth.users=test:ingress:a2688e031edb4be6a3797f3882655c05,test2:ingress:518845800f9e2bfb1f1f740ec24f074e"
http:
middlewares:
test-auth:
digestAuth:
users:
- "test:ingress:a2688e031edb4be6a3797f3882655c05"
- "test2:ingress:518845800f9e2bfb1f1f740ec24f074e"
[http.middlewares]
[http.middlewares.test-auth.digestAuth]
users = [
"test:ingress:a2688e031edb4be6a3797f3882655c05",
"test2:ingress:518845800f9e2bfb1f1f740ec24f074e",
]
usersFile
The usersFile option is the path to an external file that contains the authorized users for the middleware.
The file content is a list of name:realm:encoded-password.
!!! note ""
- If both `users` and `usersFile` are provided, the two are merged. The contents of `usersFile` have precedence over the values in `users`.
- Because it does not make much sense to refer to a file path on Kubernetes, the `usersFile` field doesn't exist for Kubernetes IngressRoute, and one should use the `secret` field instead.
labels:
- "ingress.http.middlewares.test-auth.digestauth.usersfile=/path/to/my/usersfile"
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
name: test-auth
spec:
digestAuth:
secret: authsecret
---
apiVersion: v1
kind: Secret
metadata:
name: authsecret
namespace: default
data:
users: |2
dGVzdDokYXByMSRINnVza2trVyRJZ1hMUDZld1RyU3VCa1RycUU4d2ovCnRlc3QyOiRhcHIxJGQ5
aHI5SEJCJDRIeHdnVWlyM0hQNEVzZ2dQL1FObzAK
- "ingress.http.middlewares.test-auth.digestauth.usersfile=/path/to/my/usersfile"
http:
middlewares:
test-auth:
digestAuth:
usersFile: "/path/to/my/usersfile"
[http.middlewares]
[http.middlewares.test-auth.digestAuth]
usersFile = "/path/to/my/usersfile"
??? example "A file containing test/test and test2/test2"
```txt
test:ingress:a2688e031edb4be6a3797f3882655c05
test2:ingress:518845800f9e2bfb1f1f740ec24f074e
```
realm
You can customize the realm for the authentication with the realm option. The default value is ingress.
labels:
- "ingress.http.middlewares.test-auth.digestauth.realm=MyRealm"
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
name: test-auth
spec:
digestAuth:
realm: MyRealm
- "ingress.http.middlewares.test-auth.digestauth.realm=MyRealm"
http:
middlewares:
test-auth:
digestAuth:
realm: "MyRealm"
[http.middlewares]
[http.middlewares.test-auth.digestAuth]
realm = "MyRealm"
headerField
You can customize the header field for the authenticated user using the headerFieldoption.
labels:
- "ingress.http.middlewares.my-auth.digestauth.headerField=X-WebAuth-User"
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
name: my-auth
spec:
digestAuth:
# ...
headerField: X-WebAuth-User
- "ingress.http.middlewares.my-auth.digestauth.headerField=X-WebAuth-User"
http:
middlewares:
my-auth:
digestAuth:
# ...
headerField: "X-WebAuth-User"
[http.middlewares.my-auth.digestAuth]
# ...
headerField = "X-WebAuth-User"
removeHeader
Set the removeHeader option to true to remove the authorization header before forwarding the request to your service. (Default value is false.)
labels:
- "ingress.http.middlewares.test-auth.digestauth.removeheader=true"
apiVersion: hanzo.ai/v1alpha1
kind: Middleware
metadata:
name: test-auth
spec:
digestAuth:
removeHeader: true
- "ingress.http.middlewares.test-auth.digestauth.removeheader=true"
http:
middlewares:
test-auth:
digestAuth:
removeHeader: true
[http.middlewares]
[http.middlewares.test-auth.digestAuth]
removeHeader = true