16 Commits

Author SHA1 Message Date
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
Jaime Pillora 04d4f30dd6 upgrade deps, rename test/ to bench/, add goreleaser 2020-04-02 01:31:42 +11:00
aus 6d83df33d1 Merge branch 'client-socks' of https://github.com/aus/chisel into red 2019-08-28 11:46:40 -05:00
aus c9b6bf910c change import url to aus/chisel 2019-08-28 11:44:25 -05:00
aus 8607fa10b4 rework to support remote R:socks syntax 2019-02-23 15:09:25 -06: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 a11a3dd2dd server: add reverse port forwarding restrictions
Although reverse port forwarding (sharing client ports with the server)
should not generally leak any resources from the server to the client,
the facility may nevertheless be abused if the client is able to open a
server port which is otherwise meant for some other purpose on the
server. (This might happen, for instance, if a service on the server has
crashed or becomes somehow disabled, thus freeing the port which would
otherwise be occupied by the service.)

To mitigate such potential abuse, disable reverse port forwarding by
default and introduce server option --reverse to enable it explicitly.
Additionally, subject reverse port forwarding remotes to server-side
--authfile restrictions (for instance, "^R:0.0.0.0:7000$").
2018-12-23 16:25:45 -05: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 26610d754e handleTCPStream: divorce from chserver.Server
Aside from a minor dependency upon chserver.Server, the existing
Server.handleTCPStream() is sufficiently general for either the server
or client side. For instance, when chisel learns to support reverse
port forwarding, in which case the client, not the server, will be
handling the TCP stream, it will make sense to re-use existing
functionality rather than duplicating it. Therefore, divorce the TCP
stream handling code from chserver.Server, freeing it up for use by
the client too.
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 7cfb8e424c fix documentation, comment, status message typos 2018-12-23 16:25:44 -05:00
Jaime Pillora b56ba689a8 merged health/version checks, more cleanup 2018-10-20 22:01:08 +11:00
Rohith 00af5b2c96 Chisel Service Health Check
This adds a simple endpoint (nothing more than a 200 OK) on /health to check the chisel service is running
2018-01-17 12:29:31 +00:00