Commit Graph

52 Commits

Author SHA1 Message Date
Filipe Pina
bcbb2e9f6e linting: should replace errors.New(fmt.Sprintf(...)) with fmt.Errorf(...) (golint) 2022-07-07 07:49:17 +01:00
Anders Pitman
fd3af1154c Add custom ACME CA support for client 2022-05-11 16:18:35 -06:00
Anders Pitman
da7396dc31 Remove print 2022-02-24 14:51:28 -07:00
Anders Pitman
dcb06497ad Implement overriding SSH server per tunnel
This lets you use a proxy for connecting to the SSH server, which
is useful on networks that block SSH/port 22. For example you can
use the boringproxy tuntls command to create a proxy that will
tunnel the client's SSH connections over TLS to the server.

It's all very meta and forces at least double encryption, but it
could be useful.
2022-02-24 14:33:13 -07:00
Anders Pitman
197e202d69 Implement raw server TLS tunnels
Also cleaned up things a bit by moving the ProxyTcp logic into
a separate file and sharing it between the client and server.
2022-02-24 14:12:09 -07:00
Anders Pitman
3b639adec8 Fix client TLS bug
Wasn't properly handling the ACME protocol for raw TLS tunnels.
2022-02-23 17:30:02 -07:00
Anders Pitman
cca2b06827 Don't set admin user by default
This created a bug that prevented determining the user from the
token.
2022-02-19 09:44:06 -07:00
Anders Pitman
0eab8db4d6 Simplify client creation API
Previously it was RESTful and required both a user and client
name in order to PUT new clients. Now this information is taken
from the token if possible (user is always available, client name
may not be) and a simple POST /clients endpoint is provided.
2022-02-17 14:40:17 -07:00
Anders Pitman
ca6667cede Add flag to use Let's Encrypt staging 2022-02-17 14:08:32 -07:00
Anders Pitman
08e1beba6e Fix auto TLS cert bug for Client TLS tunnels
It wasn't grabbing certs automatically.
2022-02-17 13:58:20 -07:00
Anders Pitman
272acb9d95 Merge branch 'master' of github.com:boringproxy/boringproxy into raw-tls-tunnels 2022-02-14 12:37:06 -07:00
Willem@105.pve1.lan
7d740b7c31 proxyRequest with ClientAddress and not localhost 2022-02-14 17:38:52 +02:00
Anders Pitman
3be1f0b48c Implement raw TLS tunnels
My testing shows this works for WebSockets.
2022-02-11 13:04:59 -07:00
Anders Pitman
6bfa3e9a47 Only use X-Forwarded-For if not behind proxy
Since you can't trust it when it comes directly from clients.
2022-01-07 12:33:43 -07:00
Anders Pitman
f8281d95a4 Move some stuff into namedrop library 2021-12-30 20:57:28 -07:00
Anders Pitman
e4b6598274 Don't follow redirects in client HTTP client 2021-10-02 11:04:47 -06:00
Anders Pitman
37774429df Fix cancellation 2021-02-17 10:56:29 -07:00
Anders Pitman
420b02c093 Pass context down 2021-01-23 11:25:29 -07:00
Anders Pitman
56e9f0244b Remove more log.Fatals
Also tried to simplify the sync logic somewhat.
2021-01-23 11:16:50 -07:00
Anders Pitman
884a887b6a Return errors instead of exiting
Also removed one level of goroutine from BoreTunnel
2021-01-23 10:07:26 -07:00
Anders Pitman
dd7bbf7314 Set some JSON encoding options 2021-01-22 22:04:14 -07:00
Anders Pitman
c0f884f049 Improve argument parsing and error messages 2021-01-08 14:18:51 -07:00
Anders Pitman
4150f87aec Merge branch 'update-master' into merge-upstream 2021-01-06 10:22:11 -07: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
aea6c6d2f0 Make client easier to import into other code 2020-12-10 23:14:34 -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
28a67a4285 Fix client TLS termination bug
Problem had to do with certmagic. Details in code.
2020-11-28 11:48:23 -07:00
Anders Pitman
19b843ea40 Implement specifying ACME email as argument 2020-11-27 22:17:07 -07:00
Anders Pitman
d09391cc75 Add option to use custom DNS server for client
This is useful for systems like Android which doesn't follow
normal DNS conventions like /etc/resolv.conf, so normal golang
DNS (ie when CGO_ENABLED=0) fails on Android.
2020-11-27 21:31:32 -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
c08671bd13 Implement setting TlsTermination on server 2020-11-27 16:01:40 -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
58e38d7f19 Implement HTTPS requests from client to upstreams
Can now put "https://" in front of Client Address to force it to
use TLS. It doesn't do any verification of the upstream cert. This
is intended to work similarly to the way ngrok does it:

https://ngrok.com/docs#http-local-https
2020-11-22 13:49:48 -07:00
Anders Pitman
0f3482f836 Reorder todo 2020-10-28 12:59:40 -06:00
Anders Pitman
4fd830167f Fix more security holes 2020-10-27 15:21:56 -06:00
Anders Pitman
7f595c2b0d Start client tunnels concurrently 2020-10-24 17:00:42 -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
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
91d82ff987 Switch client to use go SSH client
Was previously shelling out to `ssh`.

As part of this, I also needed to fix a standing bug where
connections weren't properly being closed.
2020-10-17 16:07:56 -06:00
Anders Pitman
e4c3379ed2 Move web ui into separate struct and rename file 2020-10-11 13:45:46 -06:00
Anders Pitman
6d6c0b46bc Reduce number of client panics 2020-10-10 10:04:37 -06:00
Anders Pitman
eb4d6903c7 Implement client tunnel synchronization
Client now polls server state and updates tunnels to match.
2020-10-10 09:55:07 -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
57e2e80ed4 Reuse httpClient 2020-10-06 10:22:03 -06:00
Anders Pitman
f712499773 Get username and home dir from system 2020-10-03 20:40:14 -06:00
Anders Pitman
7a91738029 Implement basic client
It pretty much only accomplishes what you can already do with a
normal SSH client. The difference is that keys are generated on
the fly by the server and transmitted for the client to use for
the tunnel.
2020-10-02 20:36:28 -06:00
Anders Pitman
c285f0990f Run go fmt 2020-10-02 17:09:14 -06:00