Commit Graph

89 Commits

Author SHA1 Message Date
Brian Manifold
06791d2d05 refactor(portal): API persistent IDs (#7182)
In order for the firezone terraform provider to work properly, the
Resources and Policies need to be able to be referenced by their
`persistent_id`, specifically in the portal API.
2024-11-07 20:45:56 +00:00
Andrew Dryga
b3c2e54460 feat(portal): New version of the WS control protocol (#6761)
TODOs:
- [x] Switch to sending messages instead of replies
- [ ] Do not hide pre-filtered resources and render them with an error
instead (in case we will want to expose that on a client later)
- [x] Figure out how to generate PSK so that it stays across WS
connections
2024-10-16 10:57:54 -06:00
Andrew Dryga
3652839b1a feat(portal): Allow updating policies and resources (#6690)
Now you can "edit" any fields on the policy, when one of fields that
govern the access is changed (resource, actor group or conditions) a new
policy will be created and an old one is deleted. This will be
broadcasted to the clients right away to minimize downtime. New policy
will have it's own flows to prevent confusion while auditing. To make
experience better for external systems we added `persistent_id` that
will be the same across all versions of a given policy.

Resources work in a similar fashion but when they are replaced we will
also replace all corresponding policies.

An additional nice effect of this approach is that we also got
configuration audit log for resources and policies.

Fixes #2504
2024-09-18 13:06:05 -06:00
Brian Manifold
716623a993 feat(portal): Add IDP sync error email notifications (#6483)
This adds a feature that will email all admins in a Firezone Account
when sync errors occur with their Identity Provider.

In order to avoid spamming admins with sync error emails, the error
emails are only sent once every 24 hours. One exception to that is when
there is a successful sync the `sync_error_emailed_at` field is reset,
which means in theory if an identity provider was flip flopping between
successful and unsuccessful syncs the admins would be emailed more than
once in a 24 hours period.

### Sample Email Message
<img width="589" alt="idp-sync-error-message"
src="https://github.com/user-attachments/assets/d7128c7c-c10d-4d02-8283-059e2f1f5db5">
2024-09-18 15:29:50 +00:00
Andrew Dryga
f4f2b45d2b fix(portal): Reload client on updates (#6614) 2024-09-05 18:45:39 -07:00
Andrew Dryga
e72bb05436 feat(portal): Reinit client when itself or a known group were updated (#6609)
This allows us to push a whole set of resources at once when client was
verified/unverified/updated/blocked.

Closes #6560
2024-09-05 16:51:47 -07:00
Andrew Dryga
1dae0a3ed5 fix(portal): Do not send resources not connected to any sites down to clients (#6512)
This is only possible for internet resources, any other resource will
always have at least one site connected at all times.

Closes #6510
2024-08-30 14:11:48 -06:00
Andrew Dryga
2a808292d0 feat(portal): Add blocked_tx_bytes to flow activity metrics (#6487)
Closes #4787
2024-08-29 14:21:51 -06:00
Andrew
7c6eac6af5 Hotfix: crash while rendering internet resources for gateways 2024-08-28 10:44:13 -06:00
Thomas Eizinger
35017537c7 feat(gateway): allow out-of-order allow_access requests (#6403)
Currently, the gateway requires a strict ordering of first receiving a
`request_connection` message, following by multiple `allow_access`
messages. Additionally, access can be granted as part of the initial
`request_connection` message too.

This isn't an ideal design. Setting up a new connection is infallible,
all we need to do is send our ICE credentials back to the client.
However, untangling that will require a bit more effort.

Starting with #6335, following this strict order on the client is a more
difficult. Whilst we can send them in order, it is harder to maintain
those ordering guarantees across all our systems.

To avoid this, we change the gateway to perform an upsert for its local
ACLs for a client. In case that an `allow_access` call would somehow get
to the gateway earlier, we can simply already create the `Peer` and only
set up the actual connection later.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-08-28 13:10:06 +00:00
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
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
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
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
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
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
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