Commit Graph

93 Commits

Author SHA1 Message Date
Andrew Dryga
2d083379c6 feat(portal): Internet resources (#6299)
They will be sent in the API for connlib 1.3 and above.

I think in future we can make a whole menu section called "Internet
Security" which will be a specialized UI for the new resource type (and
now show it in Resources list) to improve the user experience around it.

Closes #5852

---------

Signed-off-by: Andrew Dryga <andrew@dryga.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-08-27 23:11:17 +00:00
Andrew Dryga
8e4a4a7b05 feat(portal): Pre-check constraint conformation on client connect (#6431)
Closes #6216
2024-08-26 15:30:46 -06:00
Andrew Dryga
25a22b4780 chore(portal): Test that we only render resources once in WS API (#6394) 2024-08-21 17:16:19 -06:00
Andrew Dryga
c922ea29e9 fix(portal): Fix DNS wildcard support for Gateways (#6270) 2024-08-12 12:54:20 -06:00
Andrew Dryga
00b93f6b82 feat(portal): Wildcard dns with backwards compatibility (#6214)
If a new resource is created that will use format not supported by
previous client versions we temporarily show a warning:
<img width="683" alt="Screenshot 2024-08-07 at 2 28 57 PM"
src="https://github.com/user-attachments/assets/bbfdfc96-0c4b-4226-93c5-bc2b5fdb9d30">

It will also be excluded from `resources` list for older clients (below
1.2).

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-08-10 18:25:24 +00:00
Brian Manifold
0df2d34126 fix(portal): Update Resource definition in OpenAPI spec (#6234)
Update Resource definition in OpenAPI spec to include "connections" i.e.
which gateway groups/sites a new Resource would be connected to.

<img width="775" alt="Screenshot 2024-08-09 at 2 57 04 AM"
src="https://github.com/user-attachments/assets/502979b1-e928-4e36-91c0-ed7b62f7c4a8">
2024-08-09 22:45:20 +00:00
Jamil
83033d91ed fix(ux): Mention (Sites) on Gateway Groups section of REST API docs (#6161)
I'm thinking if we can just add `(Sites)` next the Gateway Groups title,
that will be enough for users to make the connection.
2024-08-02 19:50:30 +00:00
Andrew Dryga
bf06534caf fix(portal): Prevent races during relay selection by only using the ones connected for more than 5 seconds ago (#6111)
Closes #6099
Should push #6109 to not being needed short term.
2024-08-02 11:10:40 -06:00
Andrew Dryga
8e1eb2429d fix(portal): Decrease WS timeouts for relays and gateways (#6112)
Related to #6095
2024-07-31 16:34:52 -06:00
Brian Manifold
97df661626 fix(api): add missing path parameter (#6039) (#6041)
Looks like I forgot one:

https://validator.swagger.io/validator/debug?url=https%3A%2F%2Fapi.firez.one%2Fopenapi

Co-authored-by: Antoine <antoinelabarussias@gmail.com>
2024-07-25 15:23:20 +00:00
Brian Manifold
bdc4d85afa fix(api): fix generated openapi spec (#6008)
(External contribution)

Hi, first thanks to @bmanifold for his awesome work! I've not yet tested
the API but here is a first PR fixing various small mistakes in the
generated openapi spec:

Schema names cannot contain spaces
Add missing path parameters in the spec
Remove duplicated endpoint for creating an identity (not sure about
that, I'll let you check)
If you want to validate the generated spec you can paste it here:
https://editor.swagger.io/ (or at the bottow of your swagger ui)

Please review commit by commit

Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Antoine Labarussias <antoinelabarussias@gmail.com>
2024-07-24 15:59:15 +00:00
Brian Manifold
79c815fbbc feat(portal): Add REST API (#5579)
Why:

* In order to manage a large number of Firezone Sites, Resources,
Policies, etc... a REST API is needed as clicking through the UI is too
time consuming, as well as prone to error. By providing a REST API
Firezone customers will be able to manage things within their Firezone
accounts with code.
2024-07-20 04:20:43 +00:00
Andrew Dryga
c9a9c1864a fix(portal): Update client identity on every connection (#5697)
This identity must track the last sign in method used by the client

Closes #5633
2024-07-03 13:17:06 -06:00
Andrew Dryga
cfe777f389 fix(portal): Do not crash WebSocket when client version is invalid (#5525) 2024-06-26 18:50:43 -06:00
Andrew Dryga
66e0ee17e6 fix(portal): Prevent double-subscribing to various presence events (#5554)
Closes #5531
2024-06-25 19:36:27 -06:00
Andrew Dryga
40d7889dd1 fix(portal): Adopt LiveView 1.0 breaking changes (#5549)
Closes https://github.com/firezone/firezone/issues/5545
2024-06-25 13:30:46 -06:00
Andrew Dryga
eb7b3f62ab feat(portal): Select only compatible gateways during candidate selection (#5463) 2024-06-20 20:35:20 -06:00
Jamil
17ea02d1a9 fix(portal): Don't send null address_description (#5365)
In #5273, I assumed that connlib optionally expected
`address_description`, but this is not the case. That feature assumes
the admin will optionally enter `address_description` to **override**
the address shown in Clients. The Clients already expect an optional
type for `address_description` and implement the correct behavior.

This PR is a workaround to prevent breaking existing Clients until we
can be relatively sure most clients have upgraded, in ~2 months.
2024-06-14 01:56:16 +00:00
Jamil
7e533c42f8 refactor: Split releases for Clients and Gateways (#5287)
- Removes version numbers from infra components (elixir/relay)
- Removes version bumping from Rust workspace members that don't get
published
- Splits release publishing into `gateway-`, `headless-client-`, and
`gui-client-`
- Removes auto-deploying new infrastructure when a release is published.
Use the Deploy Production workflow instead.

Fixes #4397
2024-06-10 16:47:49 +00:00
Andrew Dryga
650d7d7998 feat(portal): Add Policy conditions (#5144)
Now policies can have additional conditions based on Client location
(country or IP range), IdP provider used for sign in or the current time
of the day at a given timezone. This covers use cases where employees
can access the production system only from certain countries (states can
be added later) or when contractors can only access internal tools
during working hours.

Closes https://github.com/firezone/firezone/issues/4743
Closes #4742
Closes #4741
Closes #4740


<img width="1728" alt="Screenshot 2024-05-31 at 13 50 53"
src="https://github.com/firezone/firezone/assets/1877644/55f509f2-0f49-4edb-8c03-7a5a6d884ccc">
<img width="1728" alt="Screenshot 2024-05-31 at 13 50 56"
src="https://github.com/firezone/firezone/assets/1877644/756bb03f-4024-4978-ac85-6daa918ae037">
<img width="1728" alt="Screenshot 2024-05-31 at 13 51 01"
src="https://github.com/firezone/firezone/assets/1877644/cf159a86-077f-4ada-9952-9e8d399d0dc1">
<img width="1728" alt="Screenshot 2024-05-31 at 13 51 03"
src="https://github.com/firezone/firezone/assets/1877644/c070719e-2d4b-41bd-ad03-430baf2dbe9b">
<img width="676" alt="Screenshot 2024-05-31 at 14 56 06"
src="https://github.com/firezone/firezone/assets/1877644/435a4951-479d-4371-99c4-29a055348175">
2024-06-09 12:46:35 -06:00
Thomas Eizinger
d27a7a3083 feat(relay): support custom turn port (#5208)
Original PR: #5130.

Co-authored-by: Antoine <antoinelabarussias@gmail.com>
2024-06-05 04:04:17 +00:00
Andrew Dryga
91983c3533 feat(portal): Send traffic filters to clients (#5202)
Closes #5201
2024-06-03 12:24:42 -06:00
Andrew Dryga
f5b4736f12 fix(portal): Fix edge cases with OIDC discovered in logs (#4777)
Can be reviewed commit by commit.
2024-05-11 09:37:28 -06:00
Andrew Dryga
20a7794d66 fix(portal): Fix traffic filtering to send port-less rules (#4778) 2024-04-25 17:35:47 -06:00
Andrew Dryga
733f6b0b42 feat(portal): Broadcast relays presence to gateways and add invalidate_ice_candidates messages (#4685)
Closes #4634
Closes #4674
2024-04-18 16:08:48 -06:00
Andrew Dryga
e1ef5f1e69 chore(portal): Add one more test for relays lb (#4638) 2024-04-16 10:08:00 -06:00
Andrew Dryga
1ace6d4ad4 chore(portal): Change name and structure of relays presence event (#4623) 2024-04-16 05:11:43 +00:00
Andrew Dryga
a0e69813c0 feat(portal): Broadcast relays presence updates to the client and return them in init (#4596)
`relays` will be removed from `prepare_connection` in a few weeks after
we release a version that reads them from `init` message. Keep in mind
technically `relays` list can be empty, it would be nice if clients
would log an error or show it in such cases.
2024-04-12 11:26:48 -06:00
Andrew Dryga
b0590fa532 chore(portal): Send metrics to Google Cloud Monitoring (#4564) 2024-04-10 13:04:59 -06:00
Andrew Dryga
1078c292d3 fix(portal): Ship hotfixes for various crash reports discovered in logs (#4538)
I'll merge and push this right away to prevent users from hitting edge
cases and our monitoring from triggering alerts.
2024-04-08 02:20:26 -06:00
Andrew Dryga
f29bf5010b chore(portal): Increase websocket api timeout to 307 seconds (#4489) 2024-04-03 17:24:07 -06:00
Jamil
1cfa80399e fix(connlib): Don't roll log files (#4390)
Fixes #4377 
Closes #3910 

If we decide to implement diagnostic log collection in the future it
will be opt-in and use something like Sentry.
2024-03-29 04:24:24 +00:00
Andrew Dryga
e56883ae33 chore(portal): Sign ref that is sent to the gateway (#4368)
Closes #4360
2024-03-28 15:29:39 -06:00
Andrew Dryga
fab95483e8 hotfix: reload dns config before sending it 2024-03-27 18:48:41 -06:00
Andrew Dryga
e9ad85e939 chore(portal): Encode client reply pid and socket ref instead of storing it (#4349) 2024-03-27 14:08:42 -06:00
Andrew Dryga
1cb6ab6dc4 chore(Portal): Remove simple forms, change navbar links, fix form styles (#4239)
Closes #4237
Closes #2015

There are new links in the navbar and the floating status badge is
replaced with a link in the burger menu too:


https://github.com/firezone/firezone/assets/1877644/2d72f6d7-a14a-4e56-808d-2e703eca158a
2024-03-25 10:24:24 -06:00
Andrew Dryga
370a45571c Track protocol in activities (#4215)
Closes #4046
Closes #3026
2024-03-19 12:26:12 -06:00
Andrew Dryga
f3c8c734ab feat(portal): Filtering, Fulltext Search, Pagination, Preloads (#3751)
On the domain side this PR extends `Domain.Repo` with filtering,
pagination, and ordering, along with some convention changes are
removing the code that is not needed since we have the filtering now.
This required to touch pretty much all contexts and code, but I went
through all public functions and added missing tests to make sure
nothing will be broken.

On the web side I've introduced a `<.live_table />` which is as close as
possible to being a drop-in replacement for the regular `<.table />`
(but requires to structure the LiveView module differently due to
assigns anyways). I've updated all the listing tables to use it.
2024-03-16 13:27:48 -06:00
Andrew Dryga
114696c0ba chore(infra): Split terraform files into folders and add domain to production app (#4172) 2024-03-16 11:54:06 -06:00
Jamil
6419b1d096 chore(portal): Fix static files (#3974)
Fixes issues with static files returning 404s
2024-03-05 17:43:14 +00:00
Andrew Dryga
bfe1fb0ff4 refactor(portal): unify format of error payloads in websocket connection (#3697)
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-02-28 23:06:52 +00:00
Jamil
127b97e588 fix(portal|website): Fix static paths for website and elixir (#3802)
Phoenix VerifiedRoutes expects directories for `statics` where we were
passing filenames too.

These are removed since they're not required -- all of the top level
files we need to serve at the root don't need VerifiedRoutes.

For the website, the files were named incorrectly.


The above issues were causing 404s on both the website and portal.
2024-02-28 20:03:42 +00:00
Jamil
17692ecf4d fix(portal|website): Fix favicons for dark mode (#3785) 2024-02-27 18:57:37 +00:00
Thomas Eizinger
e766407dfb feat!(portal): return relays as plain socket addresses (#3665)
Extracted out of #3391.

We don't actually need this for #3391 though because we've added a
compatibility layer during deserialization. But, it will be good to
remove that compat layer at some point which means we have to return the
addresses as plain socket addresses. Because that is a breaking change,
I decided to extract this into a different PR.

Co-authored-by: conectado <gabrielalejandro7@gmail.com>

---------

Co-authored-by: conectado <gabrielalejandro7@gmail.com>
2024-02-21 01:31:03 +00:00
Andrew Dryga
5b1e3ea1d1 feat(portal): Billing system (#3642) 2024-02-20 15:01:17 -06:00
Andrew Dryga
980246ae3b feat(portal): Broadcast resource sites (#3466)
Adds `client_address` field which should be passed down to clients to
nicely render copy-pasteable address. Client address MUST contain full
`address` field to prevent users from shooting themselves in the foot by
creating broken resources.

We also now broadcast a list of connected sites (gateway_groups) to the
client. When a `connection_request` response is sent a new field
`gateway_group_id` is added, this way the client can know which site
it's using, and if a resource is updated and `gateway_group_id` is
removed - it should restart the connection. The portal can not make such
a decision as it doesn't track active connections.

<img width="739" alt="Screenshot 2024-01-31 at 16 26 50"
src="https://github.com/firezone/firezone/assets/1877644/799bd354-40d5-4cc3-8ae9-9d228c5e466a">
<img width="678" alt="Screenshot 2024-01-31 at 16 27 01"
src="https://github.com/firezone/firezone/assets/1877644/782e47a5-43a8-4ba7-9245-61efbbe41f7f">
<img width="738" alt="Screenshot 2024-01-31 at 16 27 27"
src="https://github.com/firezone/firezone/assets/1877644/8c7a4edd-98d8-4e09-9e4f-09c2e5a890d0">
<img width="1728" alt="Screenshot 2024-01-31 at 16 27 49"
src="https://github.com/firezone/firezone/assets/1877644/ed8f7251-fb82-47df-9878-f7e7ae8cbcba">

This PR will be reabsed on `main` once #2240 is merged.
2024-02-09 08:36:37 -06:00
Andrew Dryga
a211f96109 feat(portal): Broadcast state changes to connected clients and gateways (#2240)
# Gateways
- [x] When Gateway Group is deleted all gateways should be disconnected
- [x] When Gateway Group is updated (eg. routing) broadcast to all
affected gateway to disconnect all the clients
- [x] When Gateway is deleted it should be disconnected
- [x] When Gateway Token is revoked all gateways that use it should be
disconnected

# Relays
- [x] When Relay Group is deleted all relays should be disconnected
- [x] When Relay is deleted it should be disconnected
- [x] When Relay Token is revoked all gateways that use it should be
disconnected

# Clients
- [x] Remove Delete Client button, show clients using the token on the
Actors page (#2669)
- [x] When client is deleted disconnect it
- [ ] ~When Gateway is offline broadcast to the Clients connected to it
it's status~
- [x] Persist `last_used_token_id` in Clients and show it in tokens UI

# Resources
- [x] When Resource is deleted it should be removed from all gateways
and clients
- [x] When Resource connection is removed it should be deleted from
removed gateway groups
- [x] When Resource is updated (eg. traffic filters) all it's
authorizations should removed

# Authentication
- [x] When Token is deleted related sessions are terminated
- [x] When an Actor is deleted or disabled it should be disconnected
from browser and client
- [x] When Identity is deleted it's sessions should be disconnected from
browser and client
- [x] ^ Ensure the same happens for identities during IdP sync
- [x] When IdP is disabled act like all actors for it are disabled?
- [x] When IdP is deleted act like all actors for it are deleted?

# Authorization
- [x] When Policy is created clients that gain access to a resource
should get an update
- [x] When Policy is deleted we need to all authorizations it's made
- [x] When Policy is disabled we need to all authorizations it's made
- [x] When Actor Group adds or removes a user, related policies should
be re-evaluated
- [x] ^ Ensure the same happens for identities during IdP sync

# Settings
- [x] Re-send init message to Client when DNS settings change

# Code
- [x] Crear way to see all available topics and messages, do not use
binary topics any more

---------

Co-authored-by: conectado <gabrielalejandro7@gmail.com>
2024-02-01 11:02:13 -06:00
Andrew Dryga
832fc3f2e3 Implement rest of TODOs after token refactoring (#3160)
- [x] Introduce api_client actor type and code to create and
authenticate using it's token
- [x] Unify Tokens usage for Relays and Gateways
- [x] Unify Tokens usage for magic links


Closes #2367
Ref #2696
2024-01-16 21:39:00 +00:00
Andrew Dryga
ce932ffd90 fix(portal): Remove token provider and implement separate flow for service accounts (#3146)
Closes #2501
2024-01-10 10:33:10 -06:00
Andrew Dryga
ed5437c881 security(portal): Rework auth tokens (#2696)
- [x] make sure that session cookie for client is stored separately from
session cookie for the portal (will close #2647 and #2032)
- [x] #2622
- [ ] #2501
- [ ] show identity tokens and allow rotating/deleting them (#2138)
- [ ] #2042
- [ ] use Tokens context for Relays and Gateways to remove duplication
- [x] #2823
- [ ] Expire LiveView sockets when subject is expired
- [ ] Service Accounts UI is ambiguous now because of token identity and
actual token shown
- [ ] Limit subject permissions based on token type

Closes #2924. Now we extend the lifetime for client tokens, but not for
browsers.
2024-01-09 13:36:21 -06:00