Skip to content

Configuration

Environment Variables

All configuration is done via the .env file in the project root, which is read by docker-compose.yml.

Required

VariableDescription
BASIC_AUTH_USERNAMEHTTP Basic Auth username for the web UI and API
BASIC_AUTH_PASSWORDHTTP Basic Auth password (use a strong password)

Backend

VariableDefaultDescription
DATABASE_PATH/data/secure_proxy.dbPath to the SQLite database inside the container
PROXY_HOSTproxySquid container hostname (Docker service name)
PROXY_PORT3128Squid proxy port
CORS_ALLOWED_ORIGINShttp://localhost:8011,http://web:8011Comma-separated list of allowed CORS origins
PROXY_CONTAINER_NAMEsecure-proxy-proxy-1Docker container name used to send reconfigure signals

Web UI

VariableDefaultDescription
BACKEND_URLhttp://backend:5000Backend API URL (internal Docker network)
REQUEST_TIMEOUT30API request timeout in seconds
MAX_RETRIES5Maximum retry attempts for backend connection
BACKOFF_FACTOR1.0Exponential backoff multiplier for retries

WAF

VariableDefaultDescription
BACKEND_URLhttp://backend:5000Backend URL for sending WAF alert notifications
BASIC_AUTH_USERNAMEMust match the backend credential for /api/internal/alert
BASIC_AUTH_PASSWORDMust match the backend credential

Squid Configuration

The proxy/startup.sh script generates squid.conf at container start. You can provide a custom configuration by placing it at:

  • /config/custom_squid.conf (highest priority)
  • /config/squid.conf
  • /config/squid/squid.conf

If none of these exist, the base configuration in startup.sh is used.

WARNING

The startup script enforces direct-IP blocking rules regardless of your custom config. If they are missing, they are appended automatically.

Key Squid defaults

SettingValue
Proxy port3128
Memory cache256 MB
Disk cache2 GB at /var/spool/squid
Max object size100 MB
Connect timeout30 seconds
DNS timeout5 seconds

WAF Custom Rules

Create /config/waf_custom_rules.txt with one regex pattern per line. Lines starting with # are ignored. Patterns are compiled with re.IGNORECASE.

Example:

# Block requests containing specific keywords
badterm
(?i)malicious-pattern

The file is loaded at WAF container startup. Restart the waf service to reload.

SSL Certificates

If /config/ssl_cert.pem and /config/ssl_key.pem do not exist, they are auto-generated at startup (self-signed, 10-year validity, RSA 2048).

To use your own certificate:

bash
cp your-cert.pem config/ssl_cert.pem
cp your-key.pem config/ssl_key.pem
docker-compose restart proxy

Clients must trust this certificate to avoid browser warnings when HTTPS filtering is enabled.

Installing the certificate on clients

PlatformSteps
WindowsImport to "Trusted Root Certification Authorities" via certmgr.msc
macOSAdd to Keychain, then set trust for SSL
LinuxCopy to /usr/local/share/ca-certificates/ and run update-ca-certificates
MobileEmail the .pem file to the device and install via settings

Released under the MIT License.