54 Commits

Author SHA1 Message Date
Jaime Pillora b9d12191f6 Fix race in tunnel waitGroup causing negative counter panic (#586)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 08:14:30 +10:00
Jaime Pillora 44310b6566 Enforce auth ACL on tunnel channels
Previously, authfile ACL restrictions were only checked during the
initial config handshake. This adds ACL enforcement at the tunnel
layer when processing SSH channel requests, ensuring that each
outbound connection is validated against the user's allowed addresses.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 20:47:37 +11:00
guangwu dca1156401 chore: remove refs to deprecated io/ioutil (#459)
thanks @testwill
2023-10-19 22:58:31 +11:00
Jaime Pillora 69093be1d9 Bump to Go 1.21 (#440)
Co-authored-by: cmeng <cmenginnz@gmail.com>
2023-08-19 11:00:41 +10:00
Jaime Pillora 556db3efad add EnvBool 2022-10-31 16:08:20 +11:00
invist 4f58a395f6 Update version.go (#288) 2022-10-31 15:54:57 +11:00
andres-portainer 3e703ae0fe Add locking around the connection count to fix a data race. (#342)
Co-authored-by: andres-portainer <andres-portainer@users.noreply.github.com>
2022-10-31 15:46:46 +11:00
fsiegmund 230f7147ee UDP buffer size override with CHISEL_UDP_MAX_SIZE environment variable (#367) 2022-10-31 15:41:44 +11:00
Jaime Pillora 6ddc09d281 document udp, log client connection failures, expose more settings via env-vars 2020-11-17 04:53:43 +11:00
Simon Rüegg 7d9a171676 Use SHA256 hashes for key fingerprints
Closes #214

Signed-off-by: Simon Rüegg <simon@rueggs.ch>
2020-11-09 19:24:25 +01:00
Shawn Hwei cd6468cc84 IPv6 remotes support (closes #197, thanks @shawnhwei)
* Support IPv6 remotes

* Adjust validation for IPv6 remotes

* IPv6 refactoring

* Further loosen remote part matching regex
2020-09-21 04:05:22 +10:00
Jaime Pillora c3aa71bec7 test: disable goroutine leak detection for windows 2020-09-03 07:54:26 +10:00
Jaime Pillora 2b0c451123 custom WaitGroup with DoneAll 2020-09-01 07:06:18 +10:00
Jaime Pillora 798ec04a6b fix stdio "cannot listen", fix udp goroutine leak 2020-08-29 01:27:08 +10:00
Jaime Pillora 4f33489f62 fix multiple getters panic 2020-08-22 22:29:13 +10:00
Jaime Pillora 7c997d2db8 added client tls skip-verify and ca flags (closes #129 closes #116)
thanks to @mvladev and @alfonso-presa, I couldn't merge your PRs since I've done a massive refactor, though I borrowed snippets from them
2020-07-23 07:12:49 +10:00
Jaime Pillora 0fb4af684f watch config file instead of dir (closes #170) 2020-07-23 05:40:23 +10:00
Jaime Pillora d8b404bd02 add tls (and auto-certificate) support 2020-07-23 05:11:28 +10:00
Jaime Pillora 3ae61e5d5d add ResetUsers server method (closes #175) 2020-07-23 01:29:57 +10:00
Jaime Pillora e3abdc607e udp listener cleanup, add early port listen checks 2020-07-23 01:26:47 +10:00
Jaime Pillora 33fa2010ab refactor 2020-07-20 20:17:24 +10:00
Jaime Pillora 2da7d92721 fix udp reconnects 2020-07-19 05:33:08 +10:00
Jaime Pillora edad853073 improved teardown and logging 2020-07-19 04:46:49 +10:00
Jaime Pillora 9ef78e9818 fix windows build 2020-07-18 11:29:02 +10:00
Jaime Pillora 53e72fe2ba add udp support, massive refactor and more (see below)
* split out share/ package into multiple subpackages
* added share/compat.go to keep backward compatibility(ish)
* moved shared tunnelling logic from client/server packages into share/tunnel/
* added remote protocol "<host>:<port>/<protocol>", currently supporting tcp and udp
* added an end-to-end test suite
* added TODO e2e tests as contribution targets
* added deep context integration for improved cleanup and cancellation
2020-07-18 11:05:53 +10:00
Jaime Pillora 591f95885f merge client stdio support (closes #166 thanks @BoleynSu!) 2020-06-17 21:44:37 +10:00
Boleyn Su a16c592dc8 This commit implements Feature Request #59
Now we can use the following command to connect to an SSH server through a chisel tunnel.
```bash
ssh -o ProxyCommand='/path/to/chisel client https://chisel.boleyn.su stdio:%h:%p' me@boleyn.su
```
2020-06-13 20:20:43 +09:00
Jaime Pillora 68050d031a merge client reverse+socks PR by @aus (closes #78)
- @aus's branch also includes PR for
custom headers, thanks @AkeemMcLennon  (closes #90)
- support client connections via socks
- add more architectures to the built releases
- remove vendor (go.sum will enforce correct deps)
2020-05-20 21:13:48 +10:00
aus 6d83df33d1 Merge branch 'client-socks' of https://github.com/aus/chisel into red 2019-08-28 11:46:40 -05:00
Anthony Lapenna f3a8df20e3 add a the ability to add/delete users dynamically (#107)
* add a the ability to add/delete users dynamically

* update the AddUser function to support multiple authorized addrs
2019-07-25 09:21:13 +10:00
aus 8607fa10b4 rework to support remote R:socks syntax 2019-02-23 15:09:25 -06:00
Patrick Othmer 97cbf8ce05 Fixing issue #74
Fixing issue #74.

Lock destroyed with u.Users = users. Lock not needed if we directly use Users.
2019-01-22 14:39:11 +01:00
Jaime Pillora 4a85f97336 bump protocol version 2018-12-29 23:36:44 +11:00
Jaime Pillora d96b66e70b merged #72 which adds reverse tunnelling (thanks @sunshineco!), fixed potential race, USR2 to print go stats, many small cleanups 2018-12-29 22:51:40 +11:00
Eric Sunshine 8724c90273 support reverse port forwarding
Normal port forwarding shares server ports to the client, allowing the
client to access ports on the server (or ports on other machines
accessible from the server). Sometimes, however, it is necessary to
share ports in the opposite direction, allowing the server to access
ports on the client (or ports on other machines accessible from the
client). Reverse port forwarding is analogous to ssh's -R forwarding
which complements normal -L forwarding.

Reverse port forwarding remotes are specified as
"R:<local-interface>:<local-port>:<remote-host>:<remote-port>", where
<local-interface> and <local-port> refer to the server side, and
<remote-host> and <remote-port> refer to the client side. For instance,
"R:2222:localhost:22" forwards port 2222 on the server to port 22 on the
client.
2018-12-23 16:25:44 -05:00
Eric Sunshine 5b5e3fafb9 remote: introduce notation for reverse port forwarding
An upcoming enhancement will add reverse port forwarding support (client
sharing its ports to the server) to complement the existing port
forwarding (server sharing its ports to the client). As a first step,
introduce notation for specifying a remote for reverse port forwarding;
i.e. "R:<local-interface>:<local-port>:<remote-host>:<remote-port>".

At this stage, reverse port forwarding remotes are recognized but never
actually created. A subsequent change will flesh out the functionality.
2018-12-23 16:25:44 -05:00
Eric Sunshine d670c83e2b handleTCPStream: relocate from server/ to share/
server/handleTCPStream() is sufficiently general to handle TCP stream
functionality for both the client and server. Therefore, move it to
share/ so it can be re-used by the client when chisel learns to
support reverse port forwarding, in which case TCP stream handling
will be done by the client rather than the server.
2018-12-23 16:25:44 -05:00
Eric Sunshine 777ce484f9 generalize connection statistics maintenance
Presently, only the server maintains connection statistics, however,
when reverse port forwarding is eventually supported by chisel, the
client will also want to do so. Rather than duplicating this
functionality in the client, generalize the existing functionality as
chshare.ConnStats, allowing it to be used by both client and server.
2018-12-23 16:25:44 -05:00
Eric Sunshine 58a7bc5518 proxy: support cancellation via context.Context
Once started, a TCPProxy never stops listening on the specified port.
This typically isn't a problem for the command-line chisel client since
the only time a proxy should stop listening is when the client itself
terminates. However, it will become a problem when chisel eventually
supports reverse port forwarding since the proxy will instead be running
on the server side, and the server will need to tear down those
listeners when the client disconnects. Therefore, teach TCPProxy to
shutdown via context.Context cancellation.
2018-12-23 16:25:44 -05:00
Eric Sunshine 25d9ab6293 proxy: relocate from client/ to share/
chclient.tcpProxy is sufficiently general to handle TCP port
forwarding for both client and server. Therefore, move it to share/ so
it can be re-used by the server when chisel learns to support reverse
port forwarding, in which case the proxy will be listening on the
server rather than the client as with normal port forwarding.
2018-12-23 16:25:44 -05:00
Jaime Pillora 5020daaf94 swap to go modules, re-vendor 2018-10-20 23:15:47 +11:00
Jaime Pillora b56ba689a8 merged health/version checks, more cleanup 2018-10-20 22:01:08 +11:00
Jaime Pillora 6997312c1f merge config file watch, minor cleanup 2018-10-20 21:35:49 +11:00
Rohith 1f07744c34 Users Reloading
The current implementation does not permit the reload on server configuration, this PR adds the feature permiting uses to dynamically reload config. Note, at the moment this does not kill off connection already authentication, I'll leave that to another PR
2018-01-17 11:35:02 +00:00
Jaime Pillora 12fec693f1 implement retry-now on SIGHUP (closes #51) 2017-11-24 01:02:25 +11:00
Jaime Pillora f7cbd77492 exit on bind failure (closes #31) 2017-04-15 11:58:49 +10:00
Jaime Pillora d818741c7d update dockerfile, default socks interface to localhost only 2017-04-07 21:49:44 +10:00
Jaime Pillora 6cb3ab2186 added SOCKS5 server support, added HTTP CONNECT Proxy client support, improved cli, improve docs, added badges 2017-04-07 20:18:15 +10:00
Jaime Pillora 6834725c7e merge --pid option, closes #26, thanks @xtyxtyx 2017-04-07 15:05:52 +10:00
Jaime Pillora 4f600f65d9 docs, added timeout to client handshake 2015-03-19 13:06:30 +11:00