A proxy service for serving LDAP user avatars as images.
ldap-image-proxy serves LDAP user images at a simple URL like https://example.com/.avatars/{username}. It was built so LDAP avatar bytes can be exposed as an HTTP image source for services using OIDC's picture claim.
It does one thing:
- looks up a user by username or email in LDAP;
- reads the configured avatar attribute;
- serves the image with a cache TTL (
Cache-Control) and a local/tmpcache; - optionally resizes the image with a Gravatar-style
?s=<pixels>query parameter, clamped to 16-2048 pixels with a default of 256, or returns the original image with?s=orig/?s=original.
It serves HTTP only - terminate TLS at a reverse proxy in front of it.
Warning
This repository is mirrored to GitHub. The SourceHut repository is the primary one.
ldap-image-proxy is meant for self-hosted setups that have:
- LDAP users with avatar bytes stored in an attribute;
- a need for a stable image URL.
| Path | Description |
|---|---|
cmd/ldap-image-proxy |
Main application entrypoint |
cmd/healthcheck |
Docker-specific healthcheck entrypoint |
internal/config |
Environment variable parsing and validation |
internal/ldap |
LDAP client and search filter handling |
internal/logs |
Zerolog setup |
internal/web |
HTTP routes, middleware and response handling |
| Topic | Purpose |
|---|---|
| Configuration overview | Runtime model and request flow |
| Environment variables | Reference for every LIP_* variable |
| Deployment | Binary, Docker, Docker Compose and reverse proxy deployment guidance |
| LDAP | LDAP presets, custom filters and avatar setup |
- Go 1.27+
taskgolangci-lint
task generate
task build
task run
task test
task lint- Start from
.env.exampleordocs/environment-variables.md. - For local development, place the required
LIP_*variables in.env; the committed.envrcloads it with direnv.
The Go module path is git.sr.ht/~icikowski/ldap-image-proxy. Documentation links should treat SourceHut as the primary forge.
When contributing:
- Run
task generateafter template, asset, or UI source changes. - Run
task fmt,task lint, andtask testbefore sending changes. - Update the docs when configuration, deployment behavior, or schemas change.
- Keep changes focused and operator-friendly.
Published images:
icikowski/ldap-image-proxyghcr.io/icikowski/ldap-image-proxy
See docs/deployment.md for full examples.
Licensed under the GNU AGPL v3. See LICENSE.
Code was written in spare time, without AI assistance as I find vibed crap unmaintainable. Contributions are welcome, but every contributor is expected to review and test the code they submit and to be responsive to feedback on it. I will not merge contributions that I have not personally reviewed and tested.
Use at your own risk, and expect a personal project with limited support and no SLA. Contributions are welcome, but I can't promise any specific turnaround time or feature roadmap.