Commit Graph

106 Commits

Author SHA1 Message Date
Jamil
d2c5968217 refactor(portal): Remove Dashboard, Landing pages and use sign_in for unauthenticated landing (#2175)
Fixes #2062
Fixes #2064 
Fixes #2063 


<img width="573" alt="Screenshot 2023-09-27 at 1 53 15 PM"
src="https://github.com/firezone/firezone/assets/167144/3e487475-4e63-4aa0-8614-57579bb4aa95">
2023-09-29 02:28:59 +00:00
Gabi
e446138150 add gabi key to assertlinks.json (#2183)
Signed-off-by: Gabi <gabrielalejandro7@gmail.com>
2023-09-28 13:59:19 -07:00
Andrew Dryga
5dddc1205e Change naming convention for spans for better integration with Cloud Trace 2023-09-27 15:46:00 -06:00
Andrew Dryga
1dac7d87a0 Do not show resources to clients that are not authorized to access them 2023-09-27 13:48:14 -06:00
Andrew Dryga
e92752a974 Prefix span names by socket type 2023-09-27 13:31:24 -06:00
Andrew Dryga
4f46cfd25f Remove required attribute on policy description textareas 2023-09-27 13:21:34 -06:00
Andrew Dryga
0b9dd334b4 Network flows (logs, auth) (#2166)
Closes https://github.com/firezone/firezone/issues/2095
Partially implements #949

<img width="1728" alt="Screenshot 2023-09-26 at 19 25 54"
src="https://github.com/firezone/firezone/assets/1877644/dffa8ae5-3095-4188-a1d2-3e8382e61628">
<img width="1728" alt="Screenshot 2023-09-26 at 19 26 03"
src="https://github.com/firezone/firezone/assets/1877644/853e8c90-eaae-4754-aea3-c58aba7cc97c">
<img width="1728" alt="Screenshot 2023-09-26 at 19 26 10"
src="https://github.com/firezone/firezone/assets/1877644/68aa9556-db11-4512-929a-45d1e4c3b258">
<img width="1728" alt="Screenshot 2023-09-26 at 19 26 17"
src="https://github.com/firezone/firezone/assets/1877644/020e0e98-142b-4b3b-aebf-789f2ad4e3c7">
2023-09-27 11:50:39 -06:00
Jamil
3d1921da7a feat(portal): Scrollbar improvements (#2160)
Thanks to @devsnaked for the fix. Opening this to get the changes merged
more quickly.

Supersedes #2072

---------

Signed-off-by: Maximilly Moreira Gonçalves <max.ocw@gmail.com>
Co-authored-by: Maximilly Moreira <max.ocw@gmail.com>
2023-09-27 15:24:26 +00:00
Andrew Dryga
58e9c42bb6 Broadcast new ICE candidates (#2149)
Closes #2118
2023-09-25 16:40:26 -06:00
Jamil
41bbf7e541 fix(portal): sidebar active item state (#2119)
Adds `active_path` to determine whether or not to highlight a sidebar
item.

~~Leaving as draft for now to allow @devsnaked to contribute. Edit: Will
use this PR as the base for @devsnaked's upcoming changes~~

Edit: fixes #2065
2023-09-25 21:29:56 +00:00
Jamil
0d7ff13fe3 fix(docs): Prevent adding typo single-quote to JSON examples (#2131)
Fixes #1968
2023-09-25 20:05:09 +00:00
Jamil
0342d37ef7 fix(portal): Fix sidebar item spacing (#2114)
# Before:
<img width="256" alt="Screenshot 2023-09-21 at 12 21 51 PM"
src="https://github.com/firezone/firezone/assets/167144/b39d4488-5116-46db-9a10-30fdc5ce10ca">

# After:
<img width="258" alt="Screenshot 2023-09-21 at 12 28 50 PM"
src="https://github.com/firezone/firezone/assets/167144/b8e0063e-b355-4e55-b1d3-45c553dd27fd">

Sidebar active state and collapsible will be fixed in another PR.
Fixes #2065
2023-09-22 15:50:47 +00:00
Andrew Dryga
93cb8a0699 Replace trace events with spans (#2112) 2023-09-21 11:48:01 -06:00
Andrew Dryga
e635ee3774 Properly set parent span ids for phoenix channels (#2101) 2023-09-20 22:21:34 -06:00
bmanifold
3e60079bf8 Update Account Settings page (#2092)
Why:

* The current account settings page shows the user profile info and
billing information. The billing system is not currently implemented and
can be hidden for the time being. As for the user profile information,
it was decided that it would probably be better to send the user to the
'Actors' show page for the currently logged in user.

<img width="1148" alt="new-account-settings-page"
src="https://github.com/firezone/firezone/assets/2646332/6aaabad0-038e-4b4c-8cfb-e2d669b54b53">
2023-09-20 10:22:39 -06:00
bmanifold
7608151f75 Enable Resource New/Edit forms (#1989)
Why:

* Previously the New/Edit forms for Resources were not able to actually
create or update Resources. This commit enables those forms to create
and update a Resource.

---------

Co-authored-by: Andrew Dryga <andrew@dryga.com>
2023-09-20 10:19:49 -06:00
Andrew Dryga
9281b7fede Allow client logs and messages instrumentation (#2086)
Closes #2019
2023-09-18 15:03:51 -06:00
Andrew Dryga
db7df665c4 Fix span name for background jobs 2023-09-14 01:00:51 -06:00
Andrew Dryga
86f04bff63 Trace api app and finish file renames (#2069) 2023-09-14 00:24:40 -06:00
Andrew Dryga
85b4aba9bc Rename Devices to Clients in Elixir app (#2008)
Renaming it back to clients to reflect service accounts and headless
clients use cases in the terminology. Such a rename will be very painful
on live data so better if we do it early on.

---------

Co-authored-by: Jamil Bou Kheir <jamilbk@users.noreply.github.com>
2023-09-13 12:37:27 +00:00
Andrew Dryga
7f7b214a8e Include OTEL to Elixir releases 2023-09-12 22:00:12 -06:00
Andrew Dryga
3ed9939ffd Use GRPC to report Elixir metrics 2023-09-12 21:20:07 -06:00
Andrew Dryga
782bbe9417 Add filters list to the resource view of a Gateway (#1987)
Closes https://github.com/firezone/product/issues/654
2023-09-12 18:46:27 -06:00
bmanifold
34fd5693d7 Update new/edit policy pages (#1946)
Why:

* The new and edit policy pages had previously only been pulling live
data from the DB, but had not been able to use the forms to create or
update policies. This commit allows the forms to function as intended.
2023-09-12 23:43:02 +00:00
Andrew Dryga
b911bd16dd Return HTTP 401 status code for invalid tokens (#1988)
Closes https://github.com/firezone/product/issues/651
2023-09-12 16:50:22 -06:00
Andrew Dryga
ec40af6a86 Hotfix issue with relays upsert index 2023-09-12 16:01:00 -06:00
Andrew Dryga
3e77682b94 Implement OIDC IdPs logout redirects (#2001) 2023-09-11 08:14:03 -06:00
Andrew Dryga
8398e3013b Protect the magic links from account spoofing (#1990)
Closes https://github.com/firezone/product/issues/644
2023-09-07 18:23:33 -06:00
Andrew Dryga
ed94e41050 Unlock editing synced users (#1991) 2023-09-07 09:34:56 -06:00
Andrew Dryga
9b81e582d2 Render less ambiguous statuses for Google Workspace sync issues (#1992) 2023-09-07 09:34:39 -06:00
Andrew Dryga
10611ed21d Set default name for Google Workspace IdPs 2023-09-05 19:17:27 -06:00
Andrew Dryga
54426a7281 Additional fixes for user sync (#1985) 2023-09-05 17:49:05 -06:00
Andrew Dryga
a84443562e Fix migration on non-empty data 2023-09-03 16:52:21 -06:00
Andrew Dryga
d3e151ec38 Fix users sync (#1976) 2023-09-03 15:02:29 -06:00
Andrew Dryga
e290f26298 Complete Actors, Devices and Groups UIs (#1885)
This will be done once the remaining UI code is covered with tests.
2023-09-02 05:35:52 +00:00
Jamil
68b1955dd0 fix(portal): revert check_origin: :conn for the WebSocket connection on web (#1952)
Looks like it broke the staging WS connections. Getting a failure of
Liveview socket connection on `app.firez.one`:

```
insertId: 1o7nymzg12jh1k5
jsonPayload:
  cos.googleapis.com/container_id: 89b4633e81432e43dfbaa3957324fd5ead3f2362737bac84648a8f839b6eb16c
  cos.googleapis.com/container_name: klt-web-cpap
  cos.googleapis.com/stream: stdout
  message:
    domain:
    - elixir
    erl_level: error
    logging.googleapis.com/sourceLocation:
      file: lib/phoenix/socket/transport.ex
      function: Elixir.Phoenix.Socket.Transport.check_origin/5
      line: 344
    message: |+
      Could not check origin for Phoenix.Socket transport.

      Origin of the request: https://app.firez.one

      This happens when you are attempting a socket connection to
      a different host than the one configured in your config/
      files. For example, in development the host is configured
      to "localhost" but you may be trying to access it from
      "127.0.0.1". To fix this issue, you may either:

        1. update [url: [host: ...]] to your actual host in the
           config file for your current environment (recommended)

        2. pass the :check_origin option when configuring your
           endpoint or when configuring the transport in your
           UserSocket module, explicitly outlining which origins
           are allowed:

              check_origin: ["https://example.com",
                             "//another.com:888", "//other.com"]

    severity: ERROR
    time: '2023-08-26T21:24:36.002Z'
  time: '2023-08-26T21:24:36.002628434Z'
logName: projects/firezone-staging/logs/cos_containers
receiveTimestamp: '2023-08-26T21:24:36.402398476Z'
resource:
  labels:
    instance_id: '8218473336234347240'
    project_id: firezone-staging
    zone: us-east1-d
  type: gce_instance
timestamp: '2023-08-26T21:24:36.002628434Z'
```
2023-08-28 19:09:37 +00:00
bmanifold
58e0fb2032 Add Sign Up page (#1939)
The Sign Up page will allow users to create new organization accounts.
During sign-up, a randomly generated slug will be created for the
account and "magic link" will be set as the first identity provider to
allow the user to login to the newly created account.

---------

Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2023-08-28 14:43:01 +00:00
Jamil
3316d9098a fix(android): Fix auth flow and callback thread safety, and pass fd through FFI (#1930)
* Refactor sharedPreferences to only save the AccountId
* Update TeamId -> AccountId to match naming elsewhere
* Update JWT -> Token to avoid confusion; this token is **not** a valid
JWT and should be treated as an opaque token
* Update FFI `connect` to accept an optional file descriptor (int32) as
a first argument. This seemed to be the most straightforward way to pass
it to the tunnel stack. Retrieving it via callback is another option,
but retrieving return vars with the `jni` was more complex. We could
have used a similar approach that we did in the Apple client
(enumerating all fd's in the `new()` function until we found ours) but
this approach is [explicitly
documented/recommended](https://developer.android.com/reference/android/net/VpnService.Builder#establish())
by the Android docs so I figured it's not likely to break.

Additionally, there was a thread safety bug in the recent JNI callback
implementation that consistently crashed the VM with `JNI DETECTED ERROR
IN APPLICATION: use of invalid jobject...`. The fix was to use
`GlobalRef` which has the explicit purpose of outliving the `JNIEnv`
lifetime so that no `static` lifetimes need to be used.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Pratik Velani <pratikvelani@gmail.com>
Co-authored-by: Gabi <gabrielalejandro7@gmail.com>
2023-08-23 14:13:55 -07:00
Jamil
54e1a79a50 fix(ios): portal connectivity and tunnel setup (#1927)
This PR fixes issues with the iOS client connecting to the portal and
setting up the tunnel.

- portal IPv6 unique-local prefix typo
- Use `rustls-webpki-roots` instead of `rustls-native-roots` for tokio
tungstenite since the latter [only supports macOS, Linux, and
Windows](https://github.com/rustls/rustls-native-certs) while the former
seems to work on all platforms(?)
- Remove Multipath TCP entitlement for iOS since it's not relevant for
us.

@conectado After this is merged, we _almost_ have a working tunnel on
iOS. I believe the error we're hitting now is the 4-byte address family
header that we need to add and strip from each packet written to / read
from the tunnel. See below log for sample output when attempting to
connect to the `HTTPbin` resource:

```
dev.firezone.firezone.network-extension	packet-tunnel	debug	16:10:13.401705-0700	FirezoneNetworkExtensioniOS	Adapter state changed to: tunnelReady
dev.firezone.firezone.network-extension	packet-tunnel	debug	16:10:13.401731-0700	FirezoneNetworkExtensioniOS	Beginning path monitoring
com.apple.network	path	default	16:10:13.402211-0700	FirezoneNetworkExtensioniOS	nw_path_evaluator_start [1ACDE975-615B-4557-BF7C-678F3594452E <NULL> generic, multipath service: 1, attribution: developer]
	path: satisfied (Path is satisfied), interface: en0[802.11], scoped, ipv4, ipv6, dns
com.apple.network	path	info	16:10:13.402235-0700	FirezoneNetworkExtensioniOS	nw_path_evaluator_call_update_handler [1ACDE975-615B-4557-BF7C-678F3594452E] scheduling update
com.apple.network	path	info	16:10:13.402261-0700	FirezoneNetworkExtensioniOS	nw_path_evaluator_call_update_handler_block_invoke [1ACDE975-615B-4557-BF7C-678F3594452E] delivering update
com.apple.network		debug	16:10:13.402286-0700	FirezoneNetworkExtensioniOS	nw_path_copy_interface_with_generation Cache miss for interface for index 3 (generation 4574)
com.apple.network		debug	16:10:13.402312-0700	FirezoneNetworkExtensioniOS	nw_path_copy_interface_with_generation Cache miss for interface for index 31 (generation 141)
dev.firezone.firezone.network-extension	packet-tunnel	debug	16:10:13.402363-0700	FirezoneNetworkExtensioniOS	Suppressing calls to disableSomeRoamingForBrokenMobileSemantics() and bumpSockets()
dev.firezone.firezone	connlib	debug	16:10:14.368105-0700	FirezoneNetworkExtensioniOS	Reading from iface 76 bytes
dev.firezone.firezone	connlib	debug	16:10:15.369018-0700	FirezoneNetworkExtensioniOS	Reading from iface 76 bytes
dev.firezone.firezone	connlib	debug	16:10:16.095618-0700	FirezoneNetworkExtensioniOS	Reading from iface 76 bytes
dev.firezone.firezone	connlib	debug	16:10:16.370908-0700	FirezoneNetworkExtensioniOS	Reading from iface 76 bytes
dev.firezone.firezone	connlib	debug	16:10:17.372035-0700	FirezoneNetworkExtensioniOS	Reading from iface 76 bytes
dev.firezone.firezone	connlib	debug	16:10:18.373423-0700	FirezoneNetworkExtensioniOS	Reading from iface 76 bytes
dev.firezone.firezone	connlib	debug	16:10:20.402863-0700	FirezoneNetworkExtensioniOS	Reading from iface 76 bytes
dev.firezone.firezone	connlib	debug	16:10:24.381581-0700	FirezoneNetworkExtensioniOS	Reading from iface 76 bytes
dev.firezone.firezone	connlib	debug	16:10:32.374566-0700	FirezoneNetworkExtensioniOS	Reading from iface 76 bytes
dev.firezone.firezone	connlib	debug	16:10:38.137437-0700	FirezoneNetworkExtensioniOS	Text("{\"ref\":null,\"topic\":\"phoenix\",\"event\":\"phx_reply\",\"payload\":{\"status\":\"ok\",\"response\":{}}}")
dev.firezone.firezone	connlib	debug	16:10:38.137757-0700	FirezoneNetworkExtensioniOS	Phoenix status message
dev.firezone.firezone	connlib	debug	16:10:48.376339-0700	FirezoneNetworkExtensioniOS	Reading from iface 76 bytes
dev.firezone.firezone	connlib	debug	16:11:08.148369-0700	FirezoneNetworkExtensioniOS	Text("{\"ref\":null,\"topic\":\"phoenix\",\"event\":\"phx_reply\",\"payload\":{\"status\":\"ok\",\"response\":{}}}")
dev.firezone.firezone	connlib	debug	16:11:08.148654-0700	FirezoneNetworkExtensioniOS	Phoenix status message
```
2023-08-21 20:48:30 -07:00
Jamil
1091c47f22 Read client_platform and client_csrf_token from params (#1919)
Fixes a small bug where `client_platform` wasn't being added to the
redirect_params in the magic link auth flow, so the token form input was
never shown.

Also adds a `hidden` type input that omits the `class=` attribute and
`div` wrapper.

Feel free to build off this or close and open a more thorough fix if
this is not the desired approach.
2023-08-17 17:34:24 +00:00
Andrew Dryga
508b803d98 Change magic link flow to require copy-pasting the magic link code on mobile platforms (#1916)
Signed-off-by: Andrew Dryga <andrew@dryga.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2023-08-16 15:40:22 -06:00
Andrew Dryga
a6c28be0e8 Persist client auth params during magic link redirects 2023-08-11 17:43:01 -05:00
Andrew Dryga
b63440dcbe Fix another relays status issue 2023-08-11 10:04:48 -05:00
Andrew Dryga
2e38db090d Show connection status for global relays 2023-08-11 02:30:21 -05:00
Andrew Dryga
bbff335233 Fix return value for a new socket message 2023-08-11 01:45:42 -05:00
Andrew Dryga
37fc1b549d Do not bind device/client session to the IP address or User Agent
Clients use WebView to authorize so binding to UA doesn't make sense, IP's can change while roaming between cell towers.
2023-08-11 01:38:24 -05:00
Andrew Dryga
a26dab8087 Fix global relays indexes 2023-08-11 01:01:33 -05:00
Andrew Dryga
47c14d2f19 Add statuspage.io to CSP policy 2023-08-10 19:14:52 -05:00
Andrew Dryga
057e5be34c Add name query param during client auth redirect 2023-08-10 16:00:09 -05:00
Andrew Dryga
15887a27ea Fix portal redirect url 2023-08-10 13:11:18 -05:00