Commit Graph

47 Commits

Author SHA1 Message Date
Anders Pitman
4150f87aec Merge branch 'update-master' into merge-upstream 2021-01-06 10:22:11 -07:00
Anders Pitman
abe36a58d1 Merge pull request #29 from arp242/admin-domain
Use "fmt.Print()" instead of "log.Print()" when asking for admin domain
2021-01-05 09:31:16 -07:00
Martin Tournoij
384b42ef54 Use "fmt.Print()" instead of "log.Print()" when asking for admin domain
When using "boringproxy server" it asks for the admin domain. All grand,
but it looks rather strange:

	2021/01/05 22:11:05 Starting up
	2021/01/05 22:11:05 Enter Admin Domain:
	[cursor is here]

It wasn't really clear to me this was asking a question, as it includes
the date like a log message and the cursor is on the next line.

So, change it to just fmt.Print()

Maybe the "starting up" should also be moved a bit further down, but
that would conflict with my other PR 🙃
2021-01-05 22:12:25 +08:00
Martin Tournoij
a67253c55a Add usage information
Before not giving any command didn't really give much feedback beyond
"invalid arguments". This adds a basic usage message, and tells people
that you can use "boringproxy server -h".

I moved the "Starting up" log message because otherwise that would get
printed when asking for "server -h".

I also added error checks for the flag parsing; I think this isn't
*strictly* needed, but I remember running in to problems once by
omitting it (although I've forgotten what that problem was, exactly).
2021-01-05 22:04:08 +08: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
140c102c32 Implement specifying cert directory
Also fixed a bug where client TLS termination was failing to get
new certs I believe because the TLS listener hadn't started up
yet. I didn't notice it before because I'm running the client and
server on the same machine and the server currently gets certs on
startup even for non-server TLS tunnels
2020-11-27 21:20:38 -07:00
Anders Pitman
b6d01d59a9 Implement client TLS termination
Managed to reuse the same proxy function the server uses.
2020-11-27 15:36:07 -07:00
Anders Pitman
733b0439e6 Begin implementing TLS passthrough
Basically working, but still needs:

* UI for selecting TLS passthrough
* Client Let's Encrypt integration for automatically getting certs.
* More testing. The changes were pretty invasive.
2020-11-26 22:37:51 -07:00
Anders Pitman
78ca1fc1f8 Allow SSH server port to be configured at runtime 2020-11-26 20:13:50 -07:00
Anders Pitman
6652b76d04 Don't intercept /api requests 2020-11-26 19:51:50 -07:00
Anders Pitman
c7efb826ae Fix Jellyfin
Services like Jellyfin weren't working apparently because the upstream
requests were using chunked encoding. Reading the entire request body
and forwarding it on seems to fix it.

Also overriding the Host header for upstream requests.
2020-11-03 10:24:41 -07:00
Anders Pitman
d0f3ab89db Output login link on first start 2020-10-29 18:49:59 -06:00
Anders Pitman
4f09c7ada1 Pass through upstream redirects 2020-10-29 13:03:35 -06:00
Anders Pitman
444ab10260 Remove config
Only admin-domain CLI parameter now required for running server.
2020-10-27 15:47:17 -06:00
Anders Pitman
fd0451fa3b Implement password-protected tunnels 2020-10-20 20:03:59 -06:00
Anders Pitman
84e00161bd Implement request logging
Added logs to stdout, and cleaned up some of the stderr ones.
2020-10-18 19:29:57 -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
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