
SSH 암호화를 사용하는 HTTP 기반의 빠른 TCP/UDP 터널로, 역방향 포트 포워딩, SOCKS5 프록시, 클라이언트 인증을 지원하여 안전한 네트워크 통과 및 방화벽 우회를 가능하게 합니다.
Chisel은 HTTP를 통해 전송되고 SSH로 보호되는 빠른 TCP/UDP 터널입니다. 클라이언트와 서버를 모두 포함하는 단일 실행 파일입니다. Go(golang)로 작성되었습니다. Chisel은 주로 방화벽을 우회하는 데 유용하며, 네트워크에 안전한 엔드포인트를 제공하는 데에도 사용할 수 있습니다.

crypto/ssh 경유)--min/max-retry-interval로 조정 가능); keepalive 핑이 타임아웃되므로 조용히 끊긴 연결(절전/재개, NAT 타임아웃, 서버 재시작)이 감지되어 다시 설정됩니다.ssh -o ProxyCommand를 지원하는 stdio를 통한 클라이언트 연결로 HTTP를 통한 SSH 제공최신 릴리스를 확인하거나 curl https://i.jpillora.com/chisel! | bash로 지금 바로 다운로드하여 설치하십시오.
바이너리는 최신 Go 릴리스로 빌드되며, 최소 OS 버전으로 Windows 10 / Server 2016, macOS 12, Linux 커널 3.2, FreeBSD 12.2가 설정됩니다. 이전 시스템(예: Windows 7)의 경우 릴리스 v1.8.1 이하를 사용하십시오.
```sh
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`).
### Fedora
The package is maintained by the Fedora community. If you encounter issues related to the usage of the RPM, please use this [issue tracker](https://bugzilla.redhat.com/buglist.cgi?bug_status=NEW&bug_status=ASSIGNED&classification=Fedora&component=chisel&list_id=11614537&product=Fedora&product=Fedora%20EPEL).```sh
sudo dnf -y install chisel
$ go install github.com/jpillora/chisel@latest
## 데모
몇 분 안에 나만의 데모 서버를 실행할 수 있습니다 (기존 Heroku 데모는 Heroku의 무료 티어와 함께 사라졌습니다). [`example/fly.toml`](https://github.com/jpillora/chisel/blob/HEAD/example/fly.toml)는 이 `chisel server`를 [fly.io](https://fly.io)의 무료 허용량에 배포합니다:```sh
$ chisel server --port $PORT --backend http://example.com
# listens on $PORT, proxies normal web requests to http://example.com
example/ 디렉터리에서 fly launch --copy-config로 배포한 다음, 서버 옆에서 실행 중인 서비스로 터널링하세요, 예를 들어:```sh
$ chisel client https://.fly.dev 3000
브라우저에서 앱의 URL을 방문하면 서버의 기본 백엔드 프록시를 거쳐 [example.com](http://example.com)의 복사본이 표시됩니다.
## 사용법
<!-- 이 도움말 텍스트를 직접 렌더링하거나,
또는 https://github.com/jpillora/md-tmpl을
$ md-tmpl -w README.md 와 함께 사용하세요. -->
<!--tmpl,code=plain:echo "$ chisel --help" && go run main.go --help | sed 's#0.0.0-src (go1\..*)#X.Y.Z#' -->``` plain
$ 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
$ chisel server --help
Usage: chisel server [options]
Options:
--host, Defines the HTTP listening host – the network interface
(defaults the environment variable HOST and falls back to 0.0.0.0).
--port, -p, Defines the HTTP listening port (defaults to the environment
variable PORT and falls back to port 8080).
--key, (deprecated use --keygen and --keyfile instead)
An optional string to seed the generation of a ECDSA public
and private key pair. All communications will be secured using this
key pair. Share the subsequent fingerprint with clients to enable detection
of man-in-the-middle attacks (defaults to the CHISEL_KEY environment
variable, otherwise a new key is generate each run).
--keygen, A path to write a newly generated PEM-encoded SSH private key file.
If users depend on your --key fingerprint, you may also include your --key to
output your existing key. Use - (dash) to output the generated key to stdout.
--keyfile, An optional path to a PEM-encoded SSH private key. When
this flag is set, the --key option is ignored, and the provided private key
is used to secure all communications. (defaults to the CHISEL_KEY_FILE
environment variable). Since ECDSA keys are short, you may also set keyfile
to the inline key string itself, exactly as printed by --keygen (a base64
string with a "ck-" prefix); no extra base64 encoding is needed.
--authfile, An optional path to a users.json file. This file should
be an object with users defined like:
{
"<user:pass>": ["<addr-regex>","<addr-regex>"]
}
when <user> connects, their <pass> will be verified and then
each of the remote addresses will be compared against the list
of address regular expressions for a match. Patterns are NOT
anchored by default: "10.0.0.1:80" also matches
"210.0.0.1:8080", and "." matches any character. Anchor your
patterns, e.g. "^10\.0\.0\.1:80$". The empty string ""
matches every address. Addresses will
always come in the form "<remote-host>:<remote-port>" for normal remotes,
"R:<local-interface>:<local-port>" for reverse port forwarding
remotes, and "socks" for SOCKS5 proxy access. Note that SOCKS5
access previously bypassed this list; existing authfiles which
should allow SOCKS5 must add an entry matching "socks" (the
empty wildcard "" matches everything, including "socks"). This
file will be automatically reloaded on change. Reloads apply
to new connections and to new tunnels of connected clients;
established tunnels are not interrupted.
--auth, An optional string representing a single user with full
access, in the form of <user:pass>. It is equivalent to creating an
authfile with {"<user:pass>": [""]}. If unset, it will use the
environment variable AUTH.
--keepalive, An optional keepalive interval. Since the underlying
transport is HTTP, in many instances we'll be traversing through
proxies, often these proxies will close idle connections. You must
specify a time with a unit, for example '5s' or '2m'. Defaults
to '25s' (set to 0s to disable).
--backend, Specifies another HTTP server to proxy requests to when
chisel receives a normal HTTP request. Useful for hiding chisel in
plain sight. --proxy is accepted as an alias for this flag.
--socks5, Allow clients to access the internal SOCKS5 proxy. See
chisel client --help for more information.
--reverse, Allow clients to specify reverse port forwarding remotes
in addition to normal remotes.
--tls-key, Enables TLS and provides optional path to a PEM-encoded
TLS private key. When this flag is set, you must also set --tls-cert,
and you cannot set --tls-domain.
--tls-cert, Enables TLS and provides optional path to a PEM-encoded
TLS certificate. When this flag is set, you must also set --tls-key,
and you cannot set --tls-domain.
--tls-domain, Enables TLS and automatically acquires a TLS key and
certificate using LetsEncrypt. Setting --tls-domain requires port 443.
You may specify multiple --tls-domain flags to serve multiple domains.
The resulting files are cached in the "$HOME/.cache/chisel" directory.
You can modify this path by setting the CHISEL_LE_CACHE variable,
or disable caching by setting this variable to "-". You can optionally
provide a certificate notification email by setting CHISEL_LE_EMAIL.
--tls-ca, a path to a PEM encoded CA certificate bundle or a directory
holding multiple PEM encode CA certificate bundle files, which is used to
validate client connections. The provided CA certificates will be used
instead of the system roots. This is commonly used to implement mutual-TLS.
--pid Generate pid file in current working directory
-v, Enable verbose logging
--help, This help text
Signals: The chisel process is listening for: a SIGINT or SIGTERM to begin a graceful shutdown (a second signal forces an immediate exit), a SIGUSR2 to print process stats, and a SIGHUP to short-circuit the client reconnect timer
Version: X.Y.Z
Read more: https://github.com/jpillora/chisel
<!--/tmpl-->
<!--tmpl,code=plain:echo "$ chisel client --help" && go run main.go client --help | sed 's#0.0.0-src (go1\..*)#X.Y.Z#' -->``` plain
$ chisel client --help
Usage: chisel client [options] <server> <remote> [remote] [remote] ...
<server> is the URL to the chisel server.
<remote>s are remote connections tunneled through the server, each of
which come in the form:
<local-host>:<local-port>:<remote-host>:<remote-port>/<protocol>
■ local-host defaults to 0.0.0.0 (all interfaces).
■ local-port defaults to remote-port.
■ remote-port is required*.
■ remote-host defaults to 127.0.0.1 (server localhost).
■ protocol defaults to tcp.
which shares <remote-host>:<remote-port> from the server to the client
as <local-host>:<local-port>, or:
R:<local-interface>:<local-port>:<remote-host>:<remote-port>/<protocol>
which does reverse port forwarding, sharing <remote-host>:<remote-port>
from the client to the server's <local-interface>:<local-port>.
example remotes
3000
example.com:3000
3000:google.com:80
192.168.0.5:3000:google.com:80
socks
5000:socks
R:2222:localhost:22
R:socks
R:5000:socks
stdio:example.com:22
1.1.1.1:53/udp
When the chisel server has --socks5 enabled, remotes can
specify "socks" in place of remote-host and remote-port.
The default local host and port for a "socks" remote is
127.0.0.1:1080. Connections to this remote will terminate
at the server's internal SOCKS5 proxy. When the server also
has --authfile set, SOCKS5 access requires an entry matching
the token "socks" in the user's address list.
When the chisel server has --reverse enabled, remotes can
be prefixed with R to denote that they are reversed. That
is, the server will listen and accept connections, and they
will be proxied through the client which specified the remote.
Reverse remotes specifying "R:socks" will listen on the server's
default socks port (1080) and terminate the connection at the
client's internal SOCKS5 proxy.
When stdio is used as local-host, the tunnel will connect standard
input/output of this program with the remote. This is useful when
combined with ssh ProxyCommand. You can use
ssh -o ProxyCommand='chisel client chiselserver stdio:%h:%p' \
[email protected]
to connect to an SSH server through the tunnel.
Options:
--fingerprint, A *strongly recommended* fingerprint string
to perform host-key validation against the server's public key.
Fingerprint mismatches will close the connection.
Fingerprints are generated by hashing the ECDSA public key using
SHA256 and encoding the result in base64.
Fingerprints must be 44 characters containing a trailing equals (=).
Legacy MD5 colon fingerprints (deprecated) are still accepted,
but only in their full 16-octet form; truncated prefixes are
rejected.
--auth, An optional username and password (client authentication)
in the form: "<user>:<pass>". These credentials are compared to
the credentials inside the server's --authfile. defaults to the
AUTH environment variable.
--keepalive, An optional keepalive interval. Since the underlying
transport is HTTP, in many instances we'll be traversing through
proxies, often these proxies will close idle connections. You must
specify a time with a unit, for example '5s' or '2m'. Defaults
to '25s' (set to 0s to disable).
--max-retry-count, Maximum number of times to retry before exiting.
Defaults to unlimited.
--min-retry-interval, Minimum wait time before retrying after a
disconnection. Defaults to 1 second.
--max-retry-interval, Maximum wait time before retrying after a
disconnection. Defaults to 5 minutes.
--proxy, An optional HTTP CONNECT or SOCKS5 proxy which will be
used to reach the chisel server. Authentication can be specified
inside the URL. Credentials must be URL-encoded; for example a
"#" in the password must be written as "%23".
For example, http://admin:[email protected]:8081
or: socks://admin:[email protected]:1080
The socks://, socks5:// and socks5h:// schemes are equivalent:
DNS is always resolved by the proxy.
--header, Set a custom header in the form "HeaderName: HeaderContent".
Can be used multiple times. (e.g --header "Foo: Bar" --header "Hello: World")
--hostname, Optionally set the 'Host' header (defaults to the host
found in the server url).
--sni, Override the ServerName when using TLS (defaults to the
hostname).
--tls-ca, An optional root certificate bundle used to verify the
chisel server. Only valid when connecting to the server with
"https" or "wss". By default, the operating system CAs will be used.
--tls-skip-verify, Skip server TLS certificate verification of
chain and host name (if TLS is used for transport connections to
server). If set, client accepts any TLS certificate presented by
the server and any host name in that certificate. This only affects
transport https (wss) connection. Chisel server's public key
may be still verified (see --fingerprint) after inner connection
is established.
--tls-key, a path to a PEM encoded private key used for client
authentication (mutual-TLS).
--tls-cert, a path to a PEM encoded certificate matching the provided
private key. The certificate must have client authentication
enabled (mutual-TLS).
--pid Generate pid file in current working directory
-v, Enable verbose logging
--help, This help text
Signals:
The chisel process is listening for:
a SIGINT or SIGTERM to begin a graceful shutdown
(a second signal forces an immediate exit),
a SIGUSR2 to print process stats, and
a SIGHUP to short-circuit the client reconnect timer
Version:
X.Y.Z
Read more:
https://github.com/jpillora/chisel
암호화는 항상 활성화됩니다. chisel 서버를 시작하면 메모리 내 ECDSA 공개/개인 키 쌍이 생성됩니다. 공개 키 지문(base64로 인코딩된 SHA256)은 서버가 시작될 때 표시됩니다. 서버는 임의의 키를 생성하는 대신 --keyfile 옵션을 사용하여 키 파일을 지정할 수도 있습니다. 클라이언트가 연결되면 서버의 공개 키 지문도 표시됩니다. 클라이언트는 --fingerprint 옵션을 사용하여 특정 지문을 강제할 수 있습니다. 레거시 MD5 지문은 여전히 허용되지만 전체 16옥텟 콜론 형식이어야 하며, 잘린 접두사는 거부됩니다. 자세한 내용은 위의 --help를 참조하세요.
또한 서버는 인증 전에 인바운드 websocket 메시지 크기를 제한합니다(CHISEL_WS_READ_LIMIT, 기본값 512 KiB). 따라서 인증되지 않은 피어가 과도하게 큰 메시지로 메모리를 소진시킬 수 없습니다. 기본값은 x/crypto/ssh의 최대 전송 패킷 256 KiB보다 충분히 높게 설정되어 있어 유효한 SSH 패킷이 거부되지 않습니다. 0만이 제한을 비활성화하며, 음수 값은 안전한 기본값으로 대체됩니다.
--authfile 옵션을 사용하여 서버는 허용된 사용자 목록을 생성하는 user.json 구성 파일을 선택적으로 제공할 수 있습니다. 클라이언트는 --auth 옵션을 사용하여 인증합니다. 인증 구성 파일의 예는 users.json을 참조하세요. 자세한 내용은 위의 --help를 참조하세요.
authfile 동작에 대한 참고 사항:
^와 $로 앵커 처리하세요(서버는 로드 시 앵커 처리되지 않은 패턴에 대해 경고합니다). 빈 문자열 ""은 모든 것과 일치합니다.socks 토큰과 일치하는 항목에 의해 제어됩니다. 주요 변경 사항: SOCKS5는 이전에 authfile을 완전히 우회했습니다. --authfile과 함께 --socks5를 실행하는 서버는 프록시 접근 권한을 유지해야 하는 사용자에게 socks를 부여해야 합니다(와일드카드 "" 항목은 계속 작동합니다).user:pass)은 이제 서버와 클라이언트 모두에서 치명적인 시작 오류입니다 — 이전에는 자동으로 인증을 비활성화했습니다.--auth 사용자는 authfile 다시 로드 후에도 유지되며 파일 사용자와 이름이 충돌할 때 우선합니다.내부적으로 이는 SSH에서 제공하는 Password 인증 방법을 사용하여 수행됩니다. crypto/ssh에 대해 자세히 알아보려면 http://blog.gopheracademy.com/go-and-ssh/를 참조하세요. 세션 열기/닫기(사용자, 소스 주소 및 원격지 포함)와 실패한 로그인 시도는 정보 수준으로 기록됩니다.
가장 간단한 보안 설정은 --tls-domain으로, LetsEncrypt 인증서를 자동으로 프로비저닝합니다(포트 443과 서버를 가리키는 DNS 레코드 필요).```sh
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
자체 서명 또는 내부 CA 인증서를 사용하려면 키/인증서 쌍을 생성하고 양쪽에서 올바른 파일을 가리키도록 하십시오:```sh
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.
새 개인 키를 터미널에 출력합니다
chisel server --keygen -
# or save it to disk --keygen /path/to/mykey
chisel 서버를 시작합니다
jpillora/chisel server --keyfile '<ck-base64 string or file path>' -p 9312 --socks5
chisel 클라이언트를 연결합니다(서버의 지문 사용)
chisel client --fingerprint '<see server output>' <server-address>:9312 socks
SOCKS5 클라이언트(예: OS/브라우저)를 다음 주소로 지정합니다:
<client-address>:1080
이제 HTTP를 통한 암호화되고 인증된 SOCKS5 연결이 완성됩니다
참고: 서버가 --authfile도 사용하는 경우, 사용자가 프록시를 사용하려면 socks 토큰과 일치하는 항목이 필요합니다(인증 참조).
특정 클라이언트가 SOCKS 종료 노드로 동작하게 하려면, 해당 클라이언트에 역방향 SOCKS 리스너 주소를 부여하세요(R:socks는 서버의 127.0.0.1:1080에서 수신 대기합니다):```json
{
"exituser:password": ["^R:127\.0\.0\.1:1080$"]
}
Input content is missing. Please provide the Markdown text for translation.```sh
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
단계별 역방향 터널링 예제도 참조하세요.
chisel은 WebSockets을 지원하는 CDN을 통해 작동합니다. Cloudflare의 경우: WebSockets을 활성화하고, DNS 레코드를 프록시(주황색 구름)로 설정한 다음, 클라이언트를 https://로 연결하세요. CDN이 TLS를 종료하지만, 내부 SSH 계층 덕분에 --fingerprint 검증은 여전히 chisel 서버를 종단 간 인증합니다 — CDN은 터널링된 트래픽을 읽거나 수정할 수 없습니다. --keepalive를 기본값인 25s로 유지하여 CDN 유휴 시간 초과를 피하고, Upgrade 헤더를 제거하는 프록시는 chisel을 전혀 전달할 수 없다는 점에 유의하세요.
자주 쓰이지 않는 설정은 환경 변수로 제공되며, 모두 CHISEL_ 접두사로 읽습니다(예: CHISEL_WS_TIMEOUT=10s):
HOST, PORT, AUTH, CHISEL_KEY/CHISEL_KEY_FILE은 위의 --help 텍스트에 문서화되어 있습니다.
WebSockets 지원이 필요하므로:
github.com/jpillora/chisel/share에는 공유 패키지가 포함되어 있습니다github.com/jpillora/chisel/server에는 서버 패키지가 포함되어 있습니다github.com/jpillora/chisel/client에는 클라이언트 패키지가 포함되어 있습니다1.0 - 최초 릴리스1.1 - 단순 대칭 암호화를 ECDSA SSH로 대체1.2 - SOCKS5(서버) 및 HTTP CONNECT(클라이언트) 지원 추가1.3 - 역방향 터널링 지원 추가1.4 - 임의 HTTP 헤더 지원 추가1.5 - 역방향 SOCKS 지원 추가(@aus 작성)1.6 - 클라이언트 stdio 지원 추가(@BoleynSu 작성)1.7 - UDP 지원 추가1.8 - scratch Docker 이미지로 전환1.9 - Go 1.21로 업그레이드. --key 시드에서 --key{gen,file}을 사용하는 P256 키 문자열로 전환(@cmenginnz 작성)1.10 - Go 1.22로 업그레이드. 릴리스에 , , 추가. 잘못된 버전 비교 수정.1.11.x 이하에서 업그레이드할 때 다음 네 가지 변경 사항에 대한 조치가 필요할 수 있습니다:
--authfile (v1.11.7부터 적용): 프록시 액세스를 유지해야 하는 사용자는 socks 토큰과 일치하는 authfile 항목이 필요합니다(와일드카드 ""는 계속 작동). 인증을 참조하세요. 거부된 요청은 서버 측에 Denied connection to socks (ACL)로 기록됩니다.--fingerprint: 잘린 레거시 MD5 지문은 거부됩니다. 서버와 클라이언트가 출력하는 전체 SHA256 지문을 사용하세요(전체 16-옥텟 MD5 콜론 형식은 여전히 허용되지만 더 이상 권장되지 않습니다).--auth 값은 <user>:<pass> 형식이어야 합니다 — 콜론이 없는 문자열은 이제 조용히 인증을 비활성화하는 대신 시작 시 실패합니다.--max-retry-count를 사용하는 chisel client는 연결 시도가 소진되면 이제 0이 아닌 코드로 종료합니다. $?를 확인하는 스크립트와 systemd Restart=on-failure 유닛은 이를 인지하게 됩니다.MIT © Jaime Pillora
| 변수 | 측 | 기본값 | 용도 |
|---|
WS_TIMEOUT | 클라이언트 | 45s | websocket 핸드셰이크 시간 초과 |
SSH_TIMEOUT | 클라이언트 | 30s | ssh 핸드셰이크 시간 초과 |
CONFIG_TIMEOUT | 서버 | 10s | 클라이언트의 구성 요청 대기 시간 |
SSH_WAIT | 양쪽 | 35s | 새 터널이 활성 연결을 기다리는 시간 |
PING_TIMEOUT | 양쪽 | keepalive 간격 | keepalive ping 응답 시간 초과(--keepalive 0이면 ping 없음) |
DIAL_TIMEOUT | 출구 노드 | 30s | 터널 대상에 대한 tcp 다이얼 시간 초과 |
WS_READ_LIMIT | 양쪽 | 524288 | 최대 인바운드 websocket 메시지 바이트(0 = 제한 없음, 음수 = 기본값) |
WS_BUFF_SIZE | 양쪽 | Go 기본값 | websocket 읽기/쓰기 버퍼 크기 |
UDP_MAX_SIZE | 양쪽 | 9012 | 최대 udp 패킷 바이트 |
UDP_DEADLINE | 출구 노드 | 15s | udp 흐름 읽기 마감 시간 및 유휴 정리 기간 |
UDP_MAX_CONNS | 출구 노드 | 100 | 터널당 최대 동시 udp 흐름 수 |
SHUTDOWN_GRACE | 서버 | 5s | 종료 시 http 요청 드레이닝 시간 |
.rpm.deb.apk1.11 - Go 1.25.1로 업그레이드. 모든 의존성 업데이트.1.12 - (미출시) 안정성 및 보안 개선:
CHISEL_PING_TIMEOUT), 절전/복귀, NAT 시간 초과 및 서버 재시작 후 끊어진 연결이 즉시 재연결됩니다--socks5 + --authfile 사용 시 SOCKS5 액세스에는 이제 socks와 일치하는 authfile 항목이 필요합니다(와일드카드 "" 항목은 계속 작동)--fingerprint는 전체 SHA256 형식(또는 전체 16-옥텟 MD5 콜론 형식)이어야 합니다--auth user)은 조용히 인증을 비활성화하는 대신 치명적인 시작 오류가 됩니다CHISEL_DIAL_TIMEOUT, 기본값 30s)CHISEL_SHUTDOWN_GRACE). 두 번째 신호는 강제 종료됩니다CHISEL_UDP_MAX_CONNS)CHISEL_WS_READ_LIMIT)--max-retry-count가 소진되면 0이 아닌 코드로 종료합니다. 새 --min-retry-interval(기본값 1s) 추가. --proxy에 socks5:// 허용go install 빌드는 실제 버전을 보고합니다. 세션 및 실패한 로그인은 info 수준으로 기록됩니다latest / X / X.Y 태그가 승격됩니다