Commit Graph

143 Commits

Author SHA1 Message Date
Anders Pitman
7df93c0821 Highlight selected page
Needed to change HTML architecture to inline multiple independent
copies of the menu. There might be a cleaner way to do this, but
it will work for now.
2020-10-15 13:01:15 -06:00
Anders Pitman
102bb152de Remove references to colored buttons 2020-10-15 10:45:07 -06:00
Anders Pitman
20b473e61f Switch to monochrome buttons 2020-10-15 10:42:38 -06:00
Anders Pitman
f911ca3b1a Implement logout button 2020-10-15 10:05:09 -06:00
Anders Pitman
4c78059e66 Overhaul UI architecture
Learned about the :target CSS selector, which can be used to
replace content depending on the current URL hash. This allows
making a sort of single page app without JavaScript.

Currently experimenting with returning all the pages in a single
request, then switching between them with :target. Seems to be
working quite well so far.
2020-10-15 09:50:12 -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
a4fa2862e4 Use random server ports for tunnels 2020-10-14 09:47:46 -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
df6daa5bbd Forgot to add some of the templates 2020-10-13 11:29:56 -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
f6faa9c6a7 Add tokens page 2020-10-13 10:32:46 -06:00
Anders Pitman
617444946d Break menu into separate file 2020-10-13 10:04:12 -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
8d6e4c2fe8 Rename file 2020-10-12 22:26:56 -06:00
Anders Pitman
02f9887b9d Implement alert dialog 2020-10-12 22:26:33 -06:00
Anders Pitman
9cc1a8afa6 Implement user delete 2020-10-12 22:17:36 -06:00
Anders Pitman
d3b25d5c38 Implement adding users from UI 2020-10-12 19:51:13 -06:00
Anders Pitman
238b66fb9b Handle webui auth in central location 2020-10-12 19:13:43 -06:00
Anders Pitman
a749fc0b46 Share HTML head section amongst pages 2020-10-12 18:39:35 -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
bf3f79fc63 Clean up unused attributes 2020-10-12 18:22:08 -06:00
Anders Pitman
31ea48365f Use Post/Redirect/Get pattern for login 2020-10-11 15:22:58 -06:00
Anders Pitman
2ca7800ca6 Replace email login with direct token login 2020-10-11 15:18:33 -06:00
Anders Pitman
1e25527ab2 Rename sessions to tokens/tokenData 2020-10-11 14:27:32 -06:00
Anders Pitman
9da8ca987e Run go fmt 2020-10-11 14:16:49 -06:00
Anders Pitman
d04804e8ac Include styles on login page 2020-10-11 14:10:30 -06:00
Anders Pitman
e4c3379ed2 Move web ui into separate struct and rename file 2020-10-11 13:45:46 -06:00
Anders Pitman
1b4e6beb61 Implement confirm dialog
Also moved shared styles to separate file which is included by
templates.
2020-10-11 13:32:10 -06:00
Anders Pitman
af539f4d68 Add menu to ui 2020-10-11 11:13:08 -06:00
Anders Pitman
1070c53107 Add some color to the buttons 2020-10-11 10:35:30 -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
41bd4759eb Add ETag hash to tunnel responses 2020-10-10 08:20:17 -06:00
Anders Pitman
eaddc4441a Change delete link into button 2020-10-09 10:15:55 -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
13e998e87d Restrict file permissions before writing key 2020-10-07 09:04:01 -06:00
Anders Pitman
bf54f27815 Add tunnel creation script 2020-10-06 19:00:40 -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
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
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