A fast TCP/UDP tunnel over HTTP
Chisel is a fast TCP/UDP tunnel, transported over HTTP, secured via SSH. Single executable including both client and server. Written in Go (golang). Chisel is mainly useful for passing through firewalls, though it can also be used to provide a secure endpoint into your network.
crypto/ssh)--min/max-retry-interval); keepalive pings time out, so silently dead connections (sleep/wake, NAT timeouts, server restarts) are detected and re-establishedssh -o ProxyCommand providing SSH over HTTPSee the latest release or download and install it now with curl https://i.jpillora.com/chisel! | bash
Binaries are built with the latest Go release, which sets the minimum OS versions: Windows 10 / Server 2016, macOS 12, Linux kernel 3.2, FreeBSD 12.2. For older systems (e.g. Windows 7), use release v1.8.1 or earlier.
docker run --rm -it jpillora/chisel --help
Images are multi-arch and published to both Docker Hub (jpillora/chisel) and GitHub Container Registry (ghcr.io/jpillora/chisel).
The package is maintained by the Fedora community. If you encounter issues related to the usage of the RPM, please use this issue tracker.
sudo dnf -y install chisel
$ go install github.com/jpillora/chisel@latest
You can run your own demo server in minutes (the old Heroku demo went away with Heroku's free tier). example/fly.toml deploys this chisel server to fly.io's free allowance:
$ chisel server --port $PORT --backend http://example.com
# listens on $PORT, proxies normal web requests to http://example.com
Deploy it with fly launch --copy-config from the example/ directory, then tunnel to any service running beside the server, e.g.:
$ chisel client https://<your-app>.fly.dev 3000
# connects to your chisel server,
# tunnels your localhost:3000 to the server's localhost:3000
Visiting your app's URL in a browser hits the server's default backend proxy and shows a copy of example.com.
$ chisel --help
Usage: chisel [command] [--help]
Version: X.Y.Z
Commands:
server - runs chisel in server mode
client - runs chisel in client mode
Read more:
https://github.com/jpillora/chisel
…
…
Encryption is always enabled. When you start up a chisel server, it will generate an in-memory ECDSA public/private key pair. The public key fingerprint (base64 encoded SHA256) will be displayed as the server starts. Instead of generating a random key, the server may optionally specify a key file, using the --keyfile option. When clients connect, they will also display the server's public key fingerprint. The client can force a particular fingerprint using the --fingerprint option. Legacy MD5 fingerprints are still accepted but must be the full 16-octet colon form — truncated prefixes are rejected. See the --help above for more information.
The server also caps inbound websocket message sizes before authentication (CHISEL_WS_READ_LIMIT, default 512 KiB), so unauthenticated peers cannot exhaust memory with oversized messages. The default sits comfortably above x/crypto/ssh's 256 KiB maximum transport packet, so no valid SSH packet is ever rejected. Only 0 disables the limit; negative values fall back to the safe default.
Using the --authfile option, the server may optionally provide a user.json configuration file to create a list of accepted users. The client then authenticates using the --auth option. See users.json for an example authentication configuration file. See the --help above for more information.
Notes on authfile behavior:
^ and $ (the server warns about unanchored patterns at load). The empty string "" matches everything.socks. Breaking: SOCKS5 previously bypassed the authfile entirely; servers running --socks5 with --authfile must grant socks to users who should keep proxy access (wildcard "" entries keep working).user:pass) are now a fatal startup error on both server and client — previously they silently disabled authentication.--auth user survives authfile reloads and wins name clashes with file users.Internally, this is done using the Password authentication method provided by SSH. Learn more about crypto/ssh here http://blog.gopheracademy.com/go-and-ssh/. Session opens/closes (with user, source address and remotes) and failed login attempts are logged at info level.
The simplest secure setup is --tls-domain, which provisions a LetsEncrypt certificate automatically (requires port 443 and a DNS record pointing at the server):
chisel server --port 443 --tls-domain chisel.example.com --auth user:pass
chisel client --auth user:pass https://chisel.example.com R:2222:localhost:22
To use your own certificate (self-signed or internal CA), generate a key/cert pair and point both sides at the right files:
chisel server --port 443 --tls-key key.pem --tls-cert cert.pem
chisel client --tls-ca ca.pem https://chisel.example.com 3000
For mutual TLS, also pass --tls-ca to the server and --tls-cert/--tls-key to each client. Note that TLS wraps chisel's transport from the outside; the inner SSH layer still encrypts and authenticates, so --fingerprint validation works with or without TLS.
Print a new private key to the terminal
chisel server --keygen -
# or save it to disk --keygen /path/to/mykey
Start your chisel server
jpillora/chisel server --keyfile '<ck-base64 string or file path>' -p 9312 --socks5
Connect your chisel client (using server's fingerprint)
chisel client --fingerprint '<see server output>' <server-address>:9312 socks
Point your SOCKS5 clients (e.g. OS/Browser) to:
<client-address>:1080
Now you have an encrypted, authenticated SOCKS5 connection over HTTP
Note: if the server also uses --authfile, users need an entry matching the token socks to use the proxy (see Authentication).
To let a specific client act as a SOCKS exit node, grant it the reverse-socks listener address (R:socks listens on the server's 127.0.0.1:1080):
{
"exituser:password": ["^R:127\\.0\\.0\\.1:1080$"]
}
chisel server --reverse --authfile users.json
chisel client --auth exituser:password <server-address> R:socks
# server-side consumers point SOCKS5 clients at 127.0.0.1:1080,
# and their traffic exits via the chisel client's network
See also the step-by-step reverse tunneling example.
chisel works through CDNs that support WebSockets. For Cloudflare: enable WebSockets, proxy (orange-cloud) the DNS record, and connect clients with https://. The CDN terminates TLS, but the inner SSH layer means --fingerprint validation still authenticates your chisel server end-to-end — the CDN cannot read or modify tunneled traffic. Keep --keepalive at its 25s default to stay under CDN idle timeouts, and note that proxies which strip Upgrade headers cannot carry chisel at all.
Less common knobs are environment variables, all read with a CHISEL_ prefix (e.g. CHISEL_WS_TIMEOUT=10s):
WS_TIMEOUT
client
45s
websocket handshake timeout
SSH_TIMEOUT
client
30s
ssh handshake timeout
CONFIG_TIMEOUT
server
10s
wait for the client's config request
SSH_WAIT
both
35s
how long new tunnels wait for an active connection
PING_TIMEOUT
both
keepalive interval
keepalive ping reply timeout (no pings if --keepalive 0)
DIAL_TIMEOUT
exit node
30s
tcp dial timeout for tunnel targets
WS_READ_LIMIT
both
524288
max inbound websocket message bytes (0 = no limit; negative = default)
WS_BUFF_SIZE
both
go default
websocket read/write buffer sizes
UDP_MAX_SIZE
both
9012
max udp packet bytes
UDP_DEADLINE
both
15s
udp flow read deadline and return-peer expiry
UDP_MAX_CONNS
both
100
max udp flows or return peers per tunnel
SHUTDOWN_GRACE
server
5s
http request drain time on shutdown
HOST, PORT, AUTH, and CHISEL_KEY/CHISEL_KEY_FILE are documented in the --help texts above.
Since WebSockets support is required:
github.com/jpillora/chisel/share contains the shared package