Authentication
Authentication
Section titled “Authentication”vcpkg-harbor supports optional authentication to secure your binary cache.
Authentication Types
Section titled “Authentication Types”No Authentication (Default)
Section titled “No Authentication (Default)”By default, authentication is disabled. Anyone can read and write to the cache.
VCPKG_AUTH_ENABLED=falseToken Authentication
Section titled “Token Authentication”Use a static API token for simple authentication.
VCPKG_AUTH_ENABLED=trueVCPKG_AUTH_TYPE=tokenVCPKG_AUTH_TOKEN=your-secret-tokenClients must include the token in requests:
# Using curlcurl -H "Authorization: Bearer your-secret-token" http://localhost:15151/health
# vcpkg configuration (in vcpkg-configuration.json){ "binary-sources": [ { "kind": "http", "uri": "http://localhost:15151/{name}/{version}/{sha}", "headers": { "Authorization": "Bearer your-secret-token" } } ]}HTTP Basic Authentication
Section titled “HTTP Basic Authentication”Use username/password authentication.
VCPKG_AUTH_ENABLED=trueVCPKG_AUTH_TYPE=basicVCPKG_AUTH_BASIC_USERS=admin:password,user:pass123Clients authenticate with standard HTTP Basic auth:
# Using curlcurl -u admin:password http://localhost:15151/health
# vcpkg with basic auth URLexport VCPKG_BINARY_SOURCES="http,http://admin:password@localhost:15151/{name}/{version}/{sha}"Public Endpoints
Section titled “Public Endpoints”The following endpoints are always public (no authentication required):
/health- Health check/health/live- Liveness probe/health/ready- Readiness probe/metrics- Prometheus metrics/- Dashboard (when enabled)/packages/*- Package browsing (dashboard)/stats- Statistics (dashboard)
Security Recommendations
Section titled “Security Recommendations”Warning: Production Security For production deployments:
- Use HTTPS: Deploy behind a reverse proxy with TLS
- Strong tokens: Generate cryptographically secure tokens
- Rotate credentials: Regularly rotate API tokens
- Network isolation: Use private networks where possible
Generating Secure Tokens
Section titled “Generating Secure Tokens”# Generate a random tokenpython -c "import secrets; print(secrets.token_urlsafe(32))"Reverse Proxy with TLS
Section titled “Reverse Proxy with TLS”Example nginx configuration:
server { listen 443 ssl; server_name vcpkg-cache.example.com;
ssl_certificate /etc/ssl/certs/vcpkg-cache.crt; ssl_certificate_key /etc/ssl/private/vcpkg-cache.key;
location / { proxy_pass http://localhost:15151; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; }}