Commit Graph

41 Commits

Author SHA1 Message Date
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
46bb670b8f Disable ACME when using custom ports
LetsEncrypt currently only supports ports 80/443 for ACME, so if
custom ports are used we need to disable automatically getting
certs.

Also changed it to only emit a warning when ports aren't
reachable from the internet, rather than failing.
2022-01-01 16:32:51 -07:00
Anders Pitman
f8281d95a4 Move some stuff into namedrop library 2021-12-30 20:57:28 -07:00
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
7c6077a0fe Implement admin domain with bootstrap domain
TakingNames.io now provides bootstrap domains, which simply
creates an A record based off the ip address of the requesting
server, without requiring any authorization. This allows
boringproxy to always use HTTPS, even when getting the admin
domain.
2021-12-19 21:24:52 -07:00
Anders Pitman
b9d07f9663 Prevent duplicate domains
Now checks to make sure a domain isn't already used by a previous
tunnel. This prevents accidental silent modifications to tunnels
and also fixes a bug where multiple entries were being made in
the authorized_keys file.
2021-12-03 17:50:02 -07:00
Anders Pitman
12ec55cf37 Clear authorized_keys before writing
Was writing both the old content of authorized_keys and the new
tunnel every time a tunnel was created. This essentially made the
file double in size for every new tunnel added.
2021-12-03 17:38:06 -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
e0ef693e99 Create authorized_keys file if it doesn't exist
Fixes #53
2021-02-15 12:24:54 -07:00
Anders Pitman
10c0958c36 Default to upserting tunnels 2021-01-23 09:17:28 -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
7034cb8671 Avoid unnecessary server certs
The server doesn't need to get certs unless TlsTermination is set
to server.
2020-11-28 11:53: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
738a637385 Change server to only manage server certs
Before it was getting certs for all tunnels, even if they were
set as client or passthrough TlsTermination.
2020-11-27 21:24:48 -07:00
Anders Pitman
78ca1fc1f8 Allow SSH server port to be configured at runtime 2020-11-26 20:13:50 -07: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
a4fa2862e4 Use random server ports for tunnels 2020-10-14 09:47:46 -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
96611f4804 Simplify public key generation
Intermediate string builder wasn't necessary.
2020-10-12 18:37:46 -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
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
2134407616 Remove deleted tunnels from authorized_keys file 2020-10-02 20:53:46 -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
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
10f79beec6 Add error handling for cert failure 2020-09-29 23:24:22 -06:00
Anders Pitman
58bd38befd Run go fmt 2020-09-29 20:12:54 -06:00
Anders Pitman
b351a4265d Replace persistTunnels with saveJson function 2020-09-28 22:49:52 -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