Commit Graph

30 Commits

Author SHA1 Message Date
Anders Pitman
cfcd781276 Filter UI requests through API
API is now the central control point for making authorized
requests. The current architecture is:

* db simply returns all data
* api uses tokens to filter data from db. It includes methods for
  returning objects, and HTTP endpoints for return JSON.
* ui calls the api functions to get filtered data.
2020-10-14 09:17:04 -06:00
Anders Pitman
5cd911f310 Automatically create admin user on first start
Also changed order that extractToken looks for tokens. Used to
be cookies then headers then query. Now in reverse, to make it
easier to override, ie for replacing cookies during login.
2020-10-13 09:48:03 -06:00
Anders Pitman
bf3f79fc63 Clean up unused attributes 2020-10-12 18:22:08 -06:00
Anders Pitman
e4c3379ed2 Move web ui into separate struct and rename file 2020-10-11 13:45:46 -06:00
Anders Pitman
ffc0d27338 Start implementing remote-controlled clients 2020-10-09 10:05:31 -06:00
Anders Pitman
6c2db42c2a Store full tunnel information in db
Now have a single Tunnel type which is returned on creation and
when querying the current tunnels.
2020-10-08 12:51:52 -06:00
Anders Pitman
274725b5c5 Add HTTP>HTTPS redirection
Required switching to TLS for LetsEncrypt, so I could disable
the HTTP ACME handler. Pretty sure there's a way to keep them
both enabled but this is fine for now.
2020-10-07 10:44:37 -06:00
Anders Pitman
f234049877 Add X-Forwarded-Host header to upstream requests 2020-10-07 09:18:04 -06:00
Anders Pitman
57e2e80ed4 Reuse httpClient 2020-10-06 10:22:03 -06:00
Anders Pitman
5b5f474853 Move sessions and tunnels into database 2020-10-05 23:25:36 -06:00
Anders Pitman
2c4b97c0e2 Switch from TLS to HTTP proxying
Allows a few things:

* Can terminate HTTP/2 without the upstream needing to implement
  it
* Allows modification of headers in both directions
* Allows logging at the proxy
2020-10-05 18:12:31 -06:00
Anders Pitman
80556785d0 Move admin page stuff into separate file 2020-10-05 16:13:01 -06:00
Anders Pitman
c285f0990f Run go fmt 2020-10-02 17:09:14 -06:00
Anders Pitman
be91ff62ef Use AdminDomain for ssh server address 2020-10-02 17:07:24 -06:00
Anders Pitman
8a37355bb6 Implement openssh key management
I had been moving in the direction of implementing a custom SSH
server in golang. That would be pretty easy if using a custom
application protocol, but I want to support tcpip-forward which
looks like it would be a lot more work. It also would be nice to
support generic CLI clients like OpenSSH.

The point of using SSH in the first place is that it's known to be a
solid tunneling solution. To that end, I've decided to rely on
OpenSSH for now, since that program may have tunneled more bits than any
other since the dawn of time. This requires a bit of hackery to generate
SSH keys and place them in authorized_keys (as well as shipping the
private key to the client), but I think this will work well for now.

Plus OpenSSH is already installed on pretty much every server
I'd expect to run boringproxy.
2020-10-02 16:57:09 -06:00
Anders Pitman
59c824bfca Start implementing custom ssh server
Turns out SSH has robust semantics for opening generic channels.
Looks like I'll be able to set up tunnels without ever needing to
forward ports on the server, since I can connect the channels with
a custom protocol.

Of course I'll eventually want to support generic SSH clients, but
this makes starting much easier.
2020-10-01 17:22:54 -06:00
Anders Pitman
84b7c0828e Start implementing custom client
Basic SSH plumbing in place. Go makes this way too easy.
2020-09-30 23:49:03 -06:00
Anders Pitman
10f79beec6 Add error handling for cert failure 2020-09-29 23:24:22 -06:00
Anders Pitman
9bd415af50 Implement add/delete tunnels from UI 2020-09-29 23:10:06 -06:00
Anders Pitman
bcd786e5d8 Get basic UI plumbing in place 2020-09-29 22:29:30 -06:00
Anders Pitman
bae4eaf02d Modify login for browser forms instead of API 2020-09-29 22:03:34 -06:00
Anders Pitman
0cb3250711 Add go.rice dependency 2020-09-29 20:51:57 -06:00
Anders Pitman
58bd38befd Run go fmt 2020-09-29 20:12:54 -06:00
Anders Pitman
42f4695381 Start implementing auth 2020-09-28 22:46:35 -06:00
Anders Pitman
501af0c3dc Start implementing main config 2020-09-28 14:07:54 -06:00
Anders Pitman
92affa7718 Implement tunnel persistence between restarts 2020-09-28 13:46:01 -06:00
Anders Pitman
f24b5fe77b Integrate CertMagic for auto TLS certs 2020-09-27 22:24:03 -06:00
Anders Pitman
09770d2c7a Split into separate files and add todo 2020-09-26 15:56:57 -06:00
Anders Pitman
c55b7283ec Implement tunnel delete 2020-09-26 15:47:56 -06:00
Anders Pitman
98a049b2e6 Implement basic SNI routing and HTTP admin stuff
* Tunnels work
* Can list and dynamically add tunnels via HTTP
2020-09-26 15:41:47 -06:00