Expand description
Reverse-proxy identity header authenticator.
§coqui-access-proxy
Reverse-proxy identity headers as an authenticator: a request from a trusted proxy address carries the account name in a header, the client certificate the proxy verified, or that certificate’s subject, and the configured directory supplies groups. Group claims in headers are never trusted.
The front proxy must verify the client certificate against its CA and drop the header
otherwise: this provider trusts what a trusted proxy forwards and checks no CA, so a proxy that
accepts unverified certificates (nginx ssl_verify_client optional_no_ca, HAProxy verify optional with ca-ignore-err) forwards certificates anyone can mint. Where it cannot, have the
consumer pin the certificate after the match.
§Features
- Trusted networks only — addresses and CIDR ranges; an empty list trusts nobody.
- Header, certificate or subject — an account header; the client certificate as nginx,
AWS ALB (URL-encoded PEM), Traefik (base64 DER) or Envoy (
x-forwarded-client-cert) forward it, read through account picks over its fields (SANs, subject, fingerprint); or a subject header, read through the same picks. An IP written as a DNS name counts as an IP. - Claims by default — a forwarded certificate is answered as its claims (subject and issuer
names, SANs, fingerprint, public key hash), for the consumer’s matcher to tie to an account;
accountpicks name the account in the provider instead. - Ambiguity refused — a header sent twice is
Invalid.
§Installation
cargo add coqui-access-proxy --git https://github.com/Boriken-Dev/coqui-accessBuild coqui-access-proxy-plugin for the loadable library.
§Quick start
Provider id coqui_access_proxy, configuration:
trusted = ["10.0.0.0/24", "::1"]
user_header = "x-remote-user" # optional; the default unless another header is set
certificate_header = "x-client-cert" # optional
certificate_encoding = "pem-url" # pem-url (nginx, ALB), der-base64 (Traefik), xfcc (Envoy)
subject_header = "x-client-subject" # optional
account = [ { field = "san.email", by = "email" }, { field = "subject.cn", by = "name" } ]
max_certificate_bytes = 16384Only configure headers the proxy overwrites.
§API overview
| Item | Purpose |
|---|---|
ProxyWord | The provider: new(config) and the Authenticator kind. |
ProxyWordConfig | The Guatiao configuration. |
CertificateEncoding | How a forwarded certificate is written: PemUrl, DerBase64, Xfcc. |
default_account, DEFAULT_MAX_CERTIFICATE_BYTES | The defaults: no picks (claims); 16 384 bytes. An empty account answers a forwarded certificate by its claims (by: "claims") for a matcher. |
field_of | Reads a field from a CN=a,O=b or /O=b/CN=a subject. |
§Development
cargo test -p coqui-access-proxy --all-features
cargo clippy -p coqui-access-proxy --all-targets --all-features -- -D warnings§Releasing
This project follows Semantic Versioning and keeps a
CHANGELOG.md.
Pushing a tag matching v* triggers the release workflow of the repository.
§License
MPL-2.0 — see LICENSE.
Structs§
- Proxy
Word - A reverse proxy’s identity headers as an Authenticator.
- Proxy
Word Config - Reverse-proxy trust and identity-header configuration.
Enums§
- Certificate
Encoding - How the certificate header is written.
Constants§
- DEFAULT_
MAX_ CERTIFICATE_ BYTES - The most bytes a certificate header may hold unless configured otherwise.
Traits§
- Proxy
Word Config Setters - The typed setters of
ProxyWordConfig, for any builder that holds its settings.
Functions§
- default_
account - The account picks by default: none. A forwarded certificate is then answered as its claims
(
by: "claims"), for the consumer’s matcher to tie to a directory account; a subject header, which carries no certificate, still names its common name, byname. - field_
of - Finds the first non-empty, case-insensitive subject field.