|
| 1 | +# Pinaka Rust Proxy - Environment Configuration Template |
| 2 | +# Copy this file to .env and fill in your values |
| 3 | + |
| 4 | +# ============================================ |
| 5 | +# Server Configuration |
| 6 | +# ============================================ |
| 7 | +PROXY_HOST=0.0.0.0 |
| 8 | +PROXY_PORT=443 |
| 9 | + |
| 10 | +# ============================================ |
| 11 | +# TLS/SSL Configuration |
| 12 | +# ============================================ |
| 13 | +# Path to TLS certificate and private key |
| 14 | +# For Let's Encrypt: /etc/letsencrypt/live/your-domain.com/fullchain.pem |
| 15 | +# For self-signed: /path/to/your/cert.pem |
| 16 | +TLS_CERT_PATH=/etc/letsencrypt/live/your-domain.com/fullchain.pem |
| 17 | +TLS_KEY_PATH=/etc/letsencrypt/live/your-domain.com/privkey.pem |
| 18 | + |
| 19 | +# ============================================ |
| 20 | +# JWT Authentication |
| 21 | +# ============================================ |
| 22 | +# Secret key for JWT validation (MUST be 32+ characters) |
| 23 | +JWT_SECRET=your_secret_key_at_least_32_characters_long |
| 24 | + |
| 25 | +# JWT algorithm (HS256, HS384, or HS512) |
| 26 | +JWT_ALGORITHM=HS256 |
| 27 | + |
| 28 | +# Optional: JWT issuer and audience validation (recommended for production) |
| 29 | +# JWT_ISSUER=your-issuer |
| 30 | +# JWT_AUDIENCE=your-audience |
| 31 | + |
| 32 | +# ============================================ |
| 33 | +# Rate Limiting |
| 34 | +# ============================================ |
| 35 | +# Requests per minute per token |
| 36 | +RATE_LIMIT_REQUESTS_PER_MINUTE=10000 |
| 37 | + |
| 38 | +# Burst capacity (allows temporary bursts above the rate limit) |
| 39 | +RATE_LIMIT_BURST_SIZE=500 |
| 40 | + |
| 41 | +# Token bucket TTL in seconds (cleanup old buckets) |
| 42 | +RATE_LIMIT_BUCKET_TTL_SECONDS=300 |
| 43 | + |
| 44 | +# Maximum number of token buckets to track |
| 45 | +RATE_LIMIT_MAX_BUCKETS=10000 |
| 46 | + |
| 47 | +# ============================================ |
| 48 | +# HTTP Proxy Configuration |
| 49 | +# ============================================ |
| 50 | +# Enable HTTP forwarding (GET, POST, etc.) in addition to CONNECT |
| 51 | +HTTP_PROXY_ENABLED=true |
| 52 | + |
| 53 | +# Maximum request body size (bytes) - 100MB default |
| 54 | +MAX_REQUEST_BODY_SIZE=104857600 |
| 55 | + |
| 56 | +# Maximum response body size (bytes) - 100MB default |
| 57 | +MAX_RESPONSE_BODY_SIZE=104857600 |
| 58 | + |
| 59 | +# Connection timeout (seconds) |
| 60 | +CONNECT_TIMEOUT_SECONDS=10 |
| 61 | + |
| 62 | +# Read timeout (seconds) |
| 63 | +READ_TIMEOUT_SECONDS=30 |
| 64 | + |
| 65 | +# Write timeout (seconds) |
| 66 | +WRITE_TIMEOUT_SECONDS=30 |
| 67 | + |
| 68 | +# ============================================ |
| 69 | +# Backend API Integration (Optional) |
| 70 | +# ============================================ |
| 71 | +# Backend URL for request logging |
| 72 | +BACKEND_URL=https://your-backend.com |
| 73 | + |
| 74 | +# Probe node identification |
| 75 | +PROBE_NODE_NAME=probe-node-1 |
| 76 | +PROBE_NODE_REGION=us-east |
| 77 | + |
| 78 | +# Log batch configuration |
| 79 | +LOG_BATCH_SIZE=100 |
| 80 | +LOG_BATCH_INTERVAL_SECS=5 |
| 81 | + |
| 82 | +# ============================================ |
| 83 | +# DNS & SSRF Protection |
| 84 | +# ============================================ |
| 85 | +# DNS cache size |
| 86 | +DNS_CACHE_SIZE=5000 |
| 87 | + |
| 88 | +# DNS cache TTL (seconds) |
| 89 | +DNS_CACHE_TTL_SECONDS=60 |
| 90 | + |
| 91 | +# DNS resolver timeout (seconds) |
| 92 | +DNS_RESOLVER_TIMEOUT_SECONDS=5 |
| 93 | + |
| 94 | +# ============================================ |
| 95 | +# IP Tracking (Multi-IP Detection) |
| 96 | +# ============================================ |
| 97 | +# Maximum unique IPs allowed per token |
| 98 | +MAX_IPS_PER_TOKEN=5 |
| 99 | + |
| 100 | +# IP tracker cache size |
| 101 | +IP_TRACKER_CACHE_SIZE=10000 |
| 102 | + |
| 103 | +# IP tracker TTL (seconds) |
| 104 | +IP_TRACKER_TTL_SECONDS=3600 |
| 105 | + |
| 106 | +# ============================================ |
| 107 | +# Mixed Content Policy (v0.2.0+) |
| 108 | +# ============================================ |
| 109 | +# Policy for handling HTTP requests with HTTPS Referer/Origin |
| 110 | +# Options: |
| 111 | +# - allow: Pass through all HTTP requests (default, no warnings suppression) |
| 112 | +# - upgrade: Try to upgrade HTTP→HTTPS, with configurable failure handling |
| 113 | +# - block: Block all HTTP requests with HTTPS Referer (strict mode) |
| 114 | +MIXED_CONTENT_POLICY=allow |
| 115 | + |
| 116 | +# Action to take when HTTPS upgrade fails (only used when policy=upgrade) |
| 117 | +# Options: |
| 118 | +# - warn: Log warning and allow HTTP request (recommended, lenient) |
| 119 | +# - fallback: Silently allow HTTP request on upgrade failure |
| 120 | +# - block: Return 502 Bad Gateway on upgrade failure (may break sites) |
| 121 | +UPGRADE_FAILURE_ACTION=warn |
| 122 | + |
| 123 | +# Timeout for HTTPS availability probe in milliseconds |
| 124 | +UPGRADE_PROBE_TIMEOUT=1000 |
| 125 | + |
| 126 | +# ============================================ |
| 127 | +# Logging |
| 128 | +# ============================================ |
| 129 | +# Rust log level (error, warn, info, debug, trace) |
| 130 | +# Use info for production, debug for troubleshooting |
| 131 | +RUST_LOG=info |
0 commit comments