A production-ready authorization service implementing the Envoy External Authorization API with a flexible, policy-driven framework and full observability.
- 🚀 Production-Ready — Graceful shutdown, health endpoints, structured logging, comprehensive Prometheus metrics
- 🔌 Extensible — Plugin-based analysis and match controller system
- 📜 Policy DSL — Express complex authorization logic with validated boolean expressions
- 🌍 GeoIP & ASN — Built-in MaxMind integration for IP geolocation and ASN lookups
- 📍 Geofencing — Geographic access control with GeoJSON polygon matching
- 🗄️ External Data Sources — Redis and PostgreSQL support for dynamic IP/ASN allow/deny lists
- 🏷️ Header Injection — Enrich requests with analysis metadata
- 📊 Full Observability — Detailed metrics, structured logs, health checks
- ⚡ High Performance — Concurrent controller execution, intelligent caching
Compose authorization policies like:
# Allow corporate network OR partners, but block known threats
authorizationPolicy: "(corporate-network || partner-ips) && !blocked-ips"# Allow only trusted ASNs from allowed regions
authorizationPolicy: "trusted-cloud-providers && europe-region"Using Docker:
docker run -p 9001:9001 -p 9090:9090 \
-v $(pwd)/config.yaml:/config.yaml \
ghcr.io/gtriggiano/envoy-authorization-service:latest \
start --config /config.yamlUsing pre-built binaries:
Download from releases:
# Example for Linux AMD64
curl -LO https://github.com/gtriggiano/envoy-authorization-service/releases/latest/download/envoy-authorization-service-linux-amd64
chmod +x envoy-authorization-service-linux-amd64
./envoy-authorization-service-linux-amd64 start --config config.yaml# Simple IP allowlist example
matchControllers:
- name: corporate-network
type: ip-match
settings:
cidrList: corporate-ips.txt
authorizationPolicy: "corporate-network"The service processes authorization requests through a three-phase pipeline:
- Analysis Phase — Extract and enrich request metadata (GeoIP, ASN, User-Agent, etc.)
- Match Phase — Run match controllers concurrently to evaluate the request
- Policy Evaluation — Combine match verdicts using boolean logic to allow or deny
All controllers run concurrently for maximum performance. Analysis results are available to match controllers and can be injected as headers to upstream services.
Learn more about the architecture →
maxmind-asn— IP-to-ASN lookupsmaxmind-geoip— IP-to-location (city, country, coordinates)ua-detect— User-Agent parsing (browser, OS, device, bots)
ip-match— Match against CIDR listsip-match-database— Dynamic IP matching via Redis/PostgreSQLasn-match— Match against ASN listsasn-match-database— Dynamic ASN matching via Redis/PostgreSQLgeofence-match— Geographic polygon matching with GeoJSON
Metrics endpoint: http://localhost:9090/metrics
- Request rates and latencies by authority, verdict, and culprit controller
- Controller execution times and error rates
- Database query performance and cache hit rates
- In-flight request counts
Health checks:
GET /healthz— Liveness probeGET /readyz— Readiness probe
- TLS/mTLS — Secure gRPC connections with optional client certificate authentication
- Policy Bypass — Test mode to log denials without blocking requests
- Custom Headers — Inject dynamic headers to upstream and downstream requests
- Graceful Shutdown — Configurable timeout for clean termination
- Cache Control — TTL-based caching for database-backed controllers
Full configuration reference →
Optimize CIDR and ASN lists:
# Remove redundant CIDR entries
envoy-authorization-service synthesize-cidr-list --file ips.txt --overwrite
# Deduplicate ASN entries
envoy-authorization-service synthesize-asn-list --file asns.txt --overwrite
# Validate GeoJSON files
envoy-authorization-service validate-geojson --file regions.geojson- Get Started — Step-by-step setup guide
- Architecture — Understand the request flow
- Policy DSL — Write authorization policies
- Examples — Real-world configurations
- Deployment Guides — Docker, Kubernetes, observability
Docker Compose:
services:
auth-service:
image: ghcr.io/gtriggiano/envoy-authorization-service:latest
ports:
- "9001:9001" # gRPC
- "9090:9090" # Metrics
volumes:
- ./config.yaml:/config.yaml
command: start --config /config.yamlContributions are welcome! Please feel free to submit issues or pull requests.