Commit Graph

39 Commits

Author SHA1 Message Date
Anders Pitman
b795ee0bc9 Remove unused custom SSH key code
Was originally planning to allow people to upload public keys to
use for tunnels, but so far no one has asked for this and I
haven't needed it.
2021-12-21 13:14:01 -07:00
Anders Pitman
2b74f6ee0c Implement selecting tunnel port
This is useful for when you want to use boringproxy more like a
normal reverse proxy, ie if boringproxy and your service are on
the same machine, you can just use the port of the service as the
tunnel port and boringproxy will forward directly to it without
using SSH.

This would normally be used with no client set.
2021-02-16 18:37:31 -07:00
Anders Pitman
8753c11f57 Fix invalid method HTTP error code
Fixes #54
2021-02-15 11:50:27 -07:00
Anders Pitman
8e743ad304 Properly set owner on tunnel creation 2021-01-22 22:03:57 -07:00
Anders Pitman
e09a7d91df Override tunnel SSH server ports at runtime
This is a bit of a hack. Problem is if the server is restarted
with a different SSH port, all the tunnels in the db have the
incorrect port setting, so we're overriding at runtime.

Really should update all the db entries but that's messy too.

Probably the real solution is to decouple runtime tunnel settings
from permanent tunnel settings, and only store the permanent ones
in the db.
2021-01-13 10:22:19 -07:00
Anders Pitman
20f7d53c0f Rename instances of BoringProxy
Full name isn't necessary now that it's a library.

BoringProxy -> Server
BoringProxyClient -> Client
BoringProxyConfig -> Config
2020-12-07 21:50:33 -07:00
Anders Pitman
45f609b8ba Move executable into separate package
Enables us to move towards being able to import as a library.
2020-12-07 21:41:45 -07:00
Anders Pitman
c08671bd13 Implement setting TlsTermination on server 2020-11-27 16:01:40 -07:00
Anders Pitman
98a6ff52fc Delete tokens when user is deleted
Also added DeleteUser to API
2020-10-30 18:50:24 -06:00
Anders Pitman
27aeb57336 Clean up api code organization 2020-10-30 18:38:57 -06:00
Anders Pitman
6b9f9aa413 Implement creating users and tokens from REST API 2020-10-29 17:56:38 -06:00
Anders Pitman
4fd830167f Fix more security holes 2020-10-27 15:21:56 -06:00
Anders Pitman
51dce1876d Fix token delete security bug 2020-10-27 14:48:22 -06:00
Anders Pitman
f6fee2b8c0 Check permissions for deleting tunnels 2020-10-27 14:39:44 -06:00
Anders Pitman
b3f1636be6 Fix some security issues
* The CSS styles were leaking information about tunnels, even for
  things like the login page, which can be sent to anyone.
* Tokens could be created for any user by any user.
2020-10-26 12:18:51 -06:00
Anders Pitman
1abc141d13 Make client selection a dropdown
Also implemented adding and deleting clients through the API.
2020-10-24 16:48:53 -06:00
Anders Pitman
1607d41e5c Add button for downloading private keys
Allows users to access tunnels using standard SSH clients.
2020-10-24 14:12:18 -06:00
Anders Pitman
8477391273 Implement using custom SSH keys 2020-10-23 20:56:55 -06:00
Anders Pitman
fd0451fa3b Implement password-protected tunnels 2020-10-20 20:03:59 -06:00
Anders Pitman
85a5004cc7 Implement raw TCP tunnels
Just needed to add an option to allow external connections to the
ports from the server, then set the proper values in the
authorized_keys file and on the client.
2020-10-20 19:14:04 -06:00
Anders Pitman
9882017d5a Add ClientAddress
Allows tunnels to specify what address the client with connect to
for upstream connections.

Also changed the tunnel-adder UI.

Also fixed a bug where invalid domains would crash. Needed to
properly return an error dialog.
2020-10-20 18:52:32 -06:00
Anders Pitman
770440ef79 Handle DeleteTunnel for UI in API 2020-10-14 10:42:54 -06:00
Anders Pitman
b0c888221d Clean up CreateTunnel error handling 2020-10-14 10:33:06 -06:00
Anders Pitman
fb8d379663 Create UI tunnels through API 2020-10-14 10:29:19 -06:00
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
85d67e262a Do more authorization checking
Limit certain information based on user and whether they're an
admin.
2020-10-13 11:21:42 -06:00
Anders Pitman
1e25527ab2 Rename sessions to tokens/tokenData 2020-10-11 14:27:32 -06:00
Anders Pitman
41bd4759eb Add ETag hash to tunnel responses 2020-10-10 08:20:17 -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
f234049877 Add X-Forwarded-Host header to upstream requests 2020-10-07 09:18:04 -06:00
Anders Pitman
03baac2c7b Implement tunnel delete for /api 2020-10-06 19:00:20 -06:00
Anders Pitman
57e2e80ed4 Reuse httpClient 2020-10-06 10:22:03 -06:00
Anders Pitman
6ee5a5d3f4 Move /tunnels GET to /api 2020-10-05 23:37:03 -06:00
Anders Pitman
5b5f474853 Move sessions and tunnels into database 2020-10-05 23:25:36 -06:00
Anders Pitman
f712499773 Get username and home dir from system 2020-10-03 20:40:14 -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