dumbproxy

repository·master·Indexed 21 days ago

https://github.com/senseunit/dumbproxy

A simple, scriptable, and secure HTTP/SOCKS5 forward proxy designed for cross-platform deployment. It features TLS automation via ACME (Let's Encrypt, BuyPass), proxy chaining, JavaScript-based access filtering, and multiple authentication methods including static, basicfile, HMAC, mTLS, and Redis.

Tokens
8.5K
Snippets
24
Records
32
Agent score
25%

What's inside dumbproxy

  1. Configure authentication via the -auth parameter

    master

    Authentication is configured by passing a URI to the -auth parameter. The URI scheme determines the authentication method, and query parameters define the provider's settings. You can chain multiple authentication providers together using the else parameter to fall back to another provider if the current one fails.

    # Example of chaining static auth to a basicfile auth
    -auth 'static://?username=root&password=mycoolpass&else=basicfile://?path=/etc/dumbproxy.htpasswd'
  2. Install dumbproxy

    master

    You can install dumbproxy using several methods depending on your environment:

    From Source

    Run the following command within the source directory:

    go install .

    Using Snap

    sudo snap install dumbproxy

    Using Docker

    You can run dumbproxy as a background service using the official Docker image. Example for a proxy with static authentication:

    docker run -d \
        --security-opt no-new-privileges \
        -p 8080:8080 \
        --restart unless-stopped \
        --name dumbproxy \
        ghcr.io/senseunit/dumbproxy -auth 'static://?username=admin&password=123456'

    Binary Downloads

    Pre-built binaries are available on the GitHub releases page.

    go install .
    # OR
    sudo snap install dumbproxy
    # OR
    docker run -d --security-opt no-new-privileges -p 8080:8080 --restart unless-stopped --name dumbproxy ghcr.io/senseunit/dumbproxy -auth 'static://?username=admin&password=123456'
  3. Configure HTTPS proxy in browsers

    master

    Using an HTTPS proxy (HTTP-over-TLS) in browsers requires specific configuration because standard proxy settings often only support plaintext HTTP.

    Windows (System-wide)

    1. Open system network proxy settings.
    2. Enable the setup script option.
    3. Use a PAC (Proxy Auto-Config) script format: data:,function FindProxyForURL(u, h){return "HTTPS example.com:8080";}

    Firefox

    • Option 1 (PAC): In proxy settings, select "Automatic proxy configuration URL" and provide the same data:,function... string used for Windows.
    • Option 2 (Extension): Use a browser extension like Proxy SwitchyOmega that explicitly supports HTTPS proxies.

    Chrome

    • Option 1 (CLI): Launch via command line: chromium-browser --proxy-server='https://example.com:8080'
    • Option 2 (Extension): Use Proxy SwitchyOmega.
  4. Use dumbproxy on Android

    master

    To use dumbproxy on Android, use the DumDum app (available via F-Droid or GitHub):

    1. Run your dumbproxy instance on a reachable server.
    2. In DumDum, tap the + icon and choose HTTP(S).
    3. Configure the connection details.
    4. Crucial: Set the "Encryption" parameter to tls for HTTPS proxies.
    5. If using a self-signed certificate, enable "Ignore Proxy SSL Certificate" in DumDum's Settings > Advanced > Connection.
  5. Use a configuration file for dumbproxy

    master

    Instead of passing many command-line arguments, you can use a configuration file with the -config flag.

    Format Specification:

    • The format is RFC 4180 CSV, but uses a space (" ") as a field separator instead of a comma.
    • # is used for comments.
    • Lines with a single field are treated as boolean flags.
    • Lines with two or more fields are treated as a key and its value.
    • Extra fields on a line are joined with spaces.
    # Example dp.cfg
    bind-address 127.0.0.1:10443
    proxyproto
    auth basicfile://?path=/etc/dumbproxy.htpasswd
    cert /etc/letsencrypt/live/proxy.example.com/fullchain.pem
    key /etc/letsencrypt/live/proxy.example.com/privkey.pem

    To run using this config:

    dumbproxy -config dp.cfg
  6. Configure TLS and Autocert for dumbproxy

    master

    dumbproxy can serve traffic over TLS using pre-issued certificates or by automatically issuing them via ACME (Let's Encrypt/etc.).

    Using Pre-issued Certificates

    Use -cert and -key to provide your certificate and private key. You can also use -cafile to authenticate clients with certificates (sets ClientAuth to VerifyClientCertIfGiven).

    Using Autocert (Automatic TLS)

    Enable automatic certificate management with the -autocert flag.

    Key Autocert Options:

    • -autocert-email: Email for ACME registration.
    • -autocert-acme: Custom ACME endpoint (defaults to Let's Encrypt).
    • -autocert-http: Listen address for the HTTP-01 challenge handler.
    • -autocert-whitelist: A comma-separated list of domains allowed to use autocert.
    • -autocert-dir: Path to a directory for the autocert cache.
    • -autocert-cache-redis: A Redis URL for the autocert cache.
    • -autocert-cache-redis-cluster: A Redis Cluster URL for the autocert cache.
    • -autocert-local-cache-ttl: Enables in-memory caching for certificates with a specified TTL.

    Note on Encryption: If using a remote cache (Redis), you can encrypt cache entries using -autocert-cache-enc-key (hex-encoded) or the DUMBPROXY_CACHE_ENC_KEY environment variable.

    # Example: Using pre-issued certificates
    dumbproxy -cert /path/to/cert.pem -key /path/to/key.pem
    
    # Example: Enabling autocert with a specific email and Redis cache
    dumbproxy -autocert -autocert-email user@example.com -autocert-cache-redis redis://localhost:6379
  7. Run a plain HTTP/SOCKS5 proxy

    master

    To start a basic proxy on a specific port with Basic authentication, use the -bind-address and -auth flags. By default, dumbproxy listens on port 8080 if no address is specified.

    dumbproxy -bind-address :1234 -auth 'static://?username=admin&password=123456'
  8. Expose a remote HTTPS proxy as a local plaintext proxy

    master

    You can use dumbproxy as a bridge to turn a remote HTTPS proxy into a local plaintext HTTP proxy. This is useful for applications that do not support TLS-wrapped proxy connections.

    Example: Basic bridge

    dumbproxy -bind-address 127.0.0.1:8080 -proxy 'https://login:password@example.org'

    This exposes a local proxy on 127.0.0.1:8080 that forwards traffic to example.org:443 using the provided credentials.

    Example: mTLS bridge

    dumbproxy -bind-address 127.0.0.1:8080 -proxy 'https://example.org?cert=cert.pem&key=key.pem&cafile=ca.pem'
  9. Run an HTTPS proxy with automatic Let's Encrypt certificates

    master

    To run an HTTP proxy over TLS (HTTPS proxy) with automatic certificate management via Let's Encrypt, use the -autocert flag.

    dumbproxy -bind-address :443 -auth 'static://?username=admin&password=123456' -autocert
  10. Run an HTTPS proxy with BuyPass automatic certificates

    master

    If you prefer BuyPass for ACME certificates, provide the BuyPass ACME directory, an email address, and an HTTP port for the ACME challenge via the following flags:

    • -autocert-acme: The ACME directory URL (e.g., https://api.buypass.com/acme/directory)
    • -autocert-email: Your contact email
    • -autocert-http: The port used for the HTTP-01 challenge
    dumbproxy \
    	-bind-address :443 \
    	-auth 'static://?username=admin&password=123456' \
    	-autocert \
    	-autocert-acme 'https://api.buypass.com/acme/directory' \
    	-autocert-email YOUR-EMAIL@EXAMPLE.ORG \
    	-autocert-http :80
  11. Run an HTTPS proxy behind an Nginx reverse proxy using Proxy Protocol

    master

    When running dumbproxy behind a reverse proxy like Nginx that performs SNI routing, you should enable the -proxyproto flag so dumbproxy can receive the original client connection information. You must also provide the certificate and key files manually using -cert and -key.

    dumbproxy \
    	-bind-address 127.0.0.1:10443 \
    	-proxyproto \
    	-auth basicfile://?path=/etc/dumbproxy.htpasswd \
    	-cert=/etc/letsencrypt/live/proxy.example.com/fullchain.pem \
    	-key=/etc/letsencrypt/live/proxy.example.com/privkey.pem

    Nginx Configuration Requirement: Your Nginx stream block must have proxy_protocol on; enabled in the server context to communicate with dumbproxy.

    stream {
    	ssl_preread on;
    
    	map $ssl_preread_server_name $backend {
    		proxy.example.com dumbproxy;
    		...
    	}
    
    	upstream dumbproxy {
    		server 127.0.0.1:10443;
    	}
    
    	server {
    		listen 443;
    		listen [::]:443;
    		proxy_protocol on;
    		proxy_pass $backend;
    	}
    }
  12. Use HMAC authentication

    master

    The hmac scheme uses HMAC-signatures passed via Basic Authentication. The username is the user login, and the password must be a URL-safe base64 string of expire_timestamp || hmac_sha256(secret, "dumbproxy grant token v1" || username || expire_timestamp).

    Dumbproxy provides a built-in signer: dumbproxy -hmac-sign <HMAC key> <username> <validity duration>.

    Parameters:

    • secret: Hex-encoded HMAC secret key. Can also be set via DUMBPROXY_HMAC_SECRET environment variable. Generate a key with openssl rand -hex 32 or dumbproxy -hmac-genkey.
    • hidden_domain: Same as static provider.
    • else: (Optional) URL of the next auth provider to chain to if authentication fails.
    # Example HMAC auth
    -auth 'hmac://?secret=your_hex_secret'