Commit Graph

4752 Commits

Author SHA1 Message Date
Thomas Eizinger
42e6e9593a chore: update Nix scripts to at least build GUI client (#5423)
I tried to run the GUI client on my system but I think my glibc version
is too recent (2.38) and thus, it crashes after clicking on "Login".

These changes to the Nix script are necessary to at least build the
client.
2024-06-18 22:02:53 +00:00
Jamil
13b26fecf4 ci: Bump GUI client to 1.0.9 (#5431) 2024-06-18 14:48:17 -07:00
Jamil
de38a3537d ci: Use offline evergreen installer (#5429)
May help to alleviate some flakiness regarding the `setup-tauri` action,
and speed up CI runs since the whole installer will be cached, not just
the bootstrapper stub.


https://github.com/firezone/firezone/actions/runs/9570220149/job/26384496768
2024-06-18 20:59:54 +00:00
Jamil
11d76c4941 docs: Add JumpCloud SSO + sync docs (#5390)
Adds a step-by-step guide for setting up the new JumpCloud connector and
optionally directory sync.

Fixes #4950
2024-06-18 19:38:03 +00:00
Jamil
76699b558a feat(website): Add conditional access details to docs and /pricing (#5386)
Followup from the conditional access policies feature.
2024-06-18 12:56:56 -07:00
Andrew Dryga
37f078c379 fix(portal): Verify email in constant time and sign it's value to prevent text injection (#5418)
You still can generate a link that will inject a text as long as it has
`@` in it - there is no good ways to validate emails other than just
check for that. The only *reliable* ways to fix that is to either remove
that text (making users more confused) or only show it if identity was
found (leaking the fact of it's existence).
2024-06-18 13:42:52 -06:00
Reactor Scram
615f2d5284 fix(gui-client): remove emojis from tray menu (#5427) 2024-06-18 18:04:57 +00:00
Reactor Scram
01cbb82cb6 docs(user-guides): update Android Client guide and fix iOS Client guide (#5408)
Closes #4998 

```[tasklist]
### Before merging
- [x] (failed) Figure out how to reconnect Firezone in Android
- [ ] How should the instructions for ChromeOS go? I assume it's a little different from Android
- [ ] Grep for TODOs in all user guides
```

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-06-18 17:44:27 +00:00
Jamil
b64cfdced3 ci: Address missed PR feedback regarding retrying failing elixir unit tests (#5421)
fixes #5420
2024-06-18 16:35:54 +00:00
Jamil
a45acc04db fix(connlib): set default firezone_tunnel log level from trace to debug for development and some ci (#5411)
"Encapsulated packet" is now spamming dev clients, so this level is
changed to `debug` by default in dev builds.

```
2024-06-17 14:04:15.419  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
2024-06-17 14:04:15.419  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
2024-06-17 14:04:15.420  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
2024-06-17 14:04:15.420  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
2024-06-17 14:04:15.420  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
2024-06-17 14:04:15.420  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
2024-06-17 14:04:15.421  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
2024-06-17 14:04:15.421  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
2024-06-17 14:04:15.422  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
2024-06-17 14:04:15.422  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
2024-06-17 14:04:15.422  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
2024-06-17 14:04:15.423  6911-7520  connlib                 dev.firezone.android                 V  firezone_tunnel::client: s0_name: encapsulates0_target=firezone_tunnel::clients0_file=connlib/tunnel/src/client.rss0_line=441s0_dst=fd00:2021:1111:8000::2Encapsulated packet
```
2024-06-18 04:48:52 +00:00
Jamil
bfbf570191 ci: Increase default assert_receive timeout to 500ms from 100ms (#5417)
We seem to be hitting `assert_receive`-style much more frequently after
"upgrading" to Enterprise Cloud (our credits expired, I was able to
renew them).

This updates the global timeout to 500ms for `assert_receive` to reduce
the likelihood `assert_push` and friends will time out on slow GH
runners.

E.g.


https://github.com/firezone/firezone/actions/runs/9556532328/job/26341986456

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
2024-06-17 18:35:11 -07:00
Jamil
1974ef9332 fix(infra): Copy artifacts from github.sha to edge in prod when deploying (#5416)
This will allow us to run prod smoke tests using the `SHA` from `main`
when deploying, without having to release/publish the Gateway first.


Fixes this issue seen in logs:

```
{
  "insertId": "tz43hng1m3lbbe",
  "jsonPayload": {
    "message": "Jun 17 22:36:57 gateway-cn9m firezone-gateway-init[3413]: curl: (22) The requested URL returned error: 404"
  },
  "resource": {
    "type": "gce_instance",
    "labels": {
      "project_id": "firezone-prod",
      "zone": "us-east1-d",
      "instance_id": "8536982484474988766"
    }
  },
  "timestamp": "2024-06-17T22:36:57.601613147Z",
  "labels": {
    "compute.googleapis.com/resource_name": "gateway-cn9m"
  },
  "logName": "projects/firezone-prod/logs/syslog",
  "receiveTimestamp": "2024-06-17T22:36:57.745513999Z"
},
{
  "insertId": "tz43hng1m3lbbd",
  "jsonPayload": {
    "message": "Jun 17 22:36:57 gateway-cn9m firezone-gateway-init[3411]: Downloading 6c310610f3 version from https://storage.googleapis.com/firezone-prod-artifacts/firezone-gateway..."
  },
  "resource": {
    "type": "gce_instance",
    "labels": {
      "project_id": "firezone-prod",
      "zone": "us-east1-d",
      "instance_id": "8536982484474988766"
    }
  },
  "timestamp": "2024-06-17T22:36:57.501343894Z",
  "labels": {
    "compute.googleapis.com/resource_name": "gateway-cn9m"
  },
  "logName": "projects/firezone-prod/logs/syslog",
  "receiveTimestamp": "2024-06-17T22:36:57.745513999Z"
}
```
2024-06-17 18:29:06 -07:00
Andrew
521670e7b5 Enable Andrew's SMS notifications on production, disable mobile apps 2024-06-17 18:19:34 -06:00
Andrew
67c1425917 Try to fix file permissions issues for Tzdata 2024-06-17 18:10:18 -06:00
Jamil
cde8b11d36 Revert "fix(infra): Don't override gateway install version from TF_VAR_image_tag; default to latest" (#5415)
Reverts firezone/firezone#5414
2024-06-17 16:52:46 -07:00
Jamil
92d95b44fa fix(infra): Don't override gateway install version from TF_VAR_image_tag; default to latest (#5414)
Since we've decoupled the Gateway version and portal version, this fixes
an issue deploying to production where we override the Gateway binary
download version with the `TF_VAR_image_tag`, which no longer points to
a valid released binary.

Now, it will fallback to `latest`, which will download the latest
version of the published Gateway to use with the production deploy,
which is what we will expect our customers to be running as well.
2024-06-17 16:25:42 -07:00
Jamil
6c310610f3 chore(ci): version-check move to ubuntu (#5410) 2024-06-17 13:57:32 -07:00
Jamil
21585cb2b0 ci: bump Gateway / headless to 1.0.8 (#5409) 2024-06-17 13:36:37 -07:00
Reactor Scram
e76301067b chore(headless-client/windows): fix cargo test -p firezone-headless-client on Windows (#5406)
This is a funny one. `cargo test -p firezone-headless-client -p
firezone-gui-client` actually passes, because the GUI client uses the
pipes feature, and Cargo apparently just does one build for both
packages. But if you build the headless Client by itself, it fails to
build.

I think this caused `cargo-mutants` to consider all its headless Client
mutants to be unviable, and so it didn't show coverage for that package.
2024-06-17 19:15:16 +00:00
Jamil
a3970c2f0a chore: Revert hardcoding gateway artifact URL (#5407)
This was needed to work around an issue with installing systemd Gateways
from our Terraform examples. Now that the publish workflow is fixed this
is no longer necessary.
2024-06-17 12:04:11 -07:00
Jamil
c1d68340a7 fix(portal): Fix all website links in product (#5401)
Adds a dedicated `anchor` attr to the `website_link` component because
the order of components in a URL must be `/path?params#anchor`.
2024-06-17 17:59:43 +00:00
Jamil
cd8bf1344b docs: Remove known issue related to Window TUN adapter (#5384)
Issue has been fixed.
2024-06-17 17:58:30 +00:00
Jamil
bcccd1cae6 ci: Auth to GCP before copying artifacts (#5405) 2024-06-17 10:43:04 -07:00
Reactor Scram
a9a0a6c450 refactor(headless-client): rewrite the IPC service main loop so we can time the Client startup (#5376)
Part of a yak shave to profile startup time for reducing it on Windows
#5026

Median of 3 runs:

- Windows 11 aarch64 Parallels VM - 4.8 s
- Windows 11 x86_64 laptop - 3.1 s (I thought it used to be slower)
- Windows Server 2022 VM - 22.2 s

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-06-17 16:57:43 +00:00
Jamil
1930e62404 ci: Fix typo in publish workflow (#5404)
Should be an `_` not `-` 🙃
2024-06-17 09:30:46 -07:00
Jamil
5eb6cbc15f ci: Bump versions and fix publish workflow (again) (#5402)
- Bump gui client version
- Fix issue discovered during publishing gui client
2024-06-17 08:44:13 -07:00
Jamil
ee45b39ec4 ci: Fix dupe id (#5400) 2024-06-17 08:17:26 -07:00
Jamil
7c20243733 fix(ci): Copy artifacts to prod on publish, not deploy (#5388)
Fixes hopefully the last remaining issue from #4397 


Fixes #5370
2024-06-17 07:30:53 -07:00
Jamil
27e6672a5d fix(portal): Make Conditions label color match other labels (#5389)
Very minor thing I noticed today.
2024-06-17 14:05:05 +00:00
Jamil
eda1df56c2 ci: Bump Android/Apple cur versions to 1.0.4/1.0.5 (#5397) 2024-06-17 06:55:33 -07:00
Thomas Eizinger
44bb24178e ci: run compatibility tests between latest client and HEAD gateway (#5369)
Currently, our CI tests that the latest released client and gateway are
compatible with the current portal. To allow for smooth upgrades of
deployed infrastructure, we also need to test that any changes we are
making to the gateway are compatible with the latest release of the
client. This allows customers to upgrade their gateways ahead of time
before we publish updates of the clients.

This PR adds a matrix to the compatibility tests to ensure just that.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-06-16 22:32:20 +00:00
Reactor Scram
1cf10f0c3f chore(rust): bump to Rust 1.79 (#5356)
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-06-16 22:06:18 +00:00
Gabi
b783c1b8cc fix(connlib): sending unallowed packets after reconnection (#5381)
## The problem

To find the correct peer for a given resource we keep a map of
`resource_id -> gateway_id` in the client state called
`resources_gateways`.

For CIDR resource connlib when sees a packet it does the following
steps:
1. Find the packet's corresponding resource
2. Find the resource corresponding gateway
3. Find the peer corresponding to the gateway, if none, request
access/connection

The problem was that when roaming, we didn't cleanup the map between
`resource_id -> gateway_id` so if after disconnecting with a gateway we
created a new connection due to a another resource, in step 3, connlib
would find a connected gateway and not request access.

This would cause the client to send unallowed packets to the gateway.

## Steps to reproduce

1. Open the client
2. Ping a CIDR resource on a gateway
3. roam and wait until disconnection
4. Ping a different resource on the same gateway
5. Ping the same CIDR resource as in step 2

This will result in no reply for step 5

## The fix

Cleanup the `resource -> gateway` map after disconnecting with a
gateway.

Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-06-16 21:55:59 +00:00
Jamil
2cc890f644 fix(ci): apt-get update before install (#5387) 2024-06-16 14:40:59 -07:00
Jamil
d139ced687 fix(website): Use custom middleware for versioned redirects (#5382)
Because of https://github.com/vercel/next.js/issues/66891, we need
custom middleware to populate the version in multiple places of the
`destination` URL for redirect artifact permalinks.
2024-06-14 19:03:32 -07:00
Gabi
847c61bc99 fix(connlib): revert "build(deps): Bump tokio-tungstenite from 0.21.0 to 0.23.0 in /rust" (#5379)
Reverts firezone/firezone#5290

This updates caused panics in macos, and [turns out it might cause
gateways and relays to
panic](https://github.com/firezone/firezone/pull/5290#issuecomment-2168642981)
2024-06-14 19:58:12 -03:00
Reactor Scram
6e5b351277 fix(gui-client): let the GUI set the log filter for the IPC service (#5292)
Closes #5042 

Smoke test plan:
- Install on a before-Firezone VM
- Confirm logs default to `str0m=warn,info`
- Set log filter to `debug` in GUI
- Restart IPC service
- Confirm logs are `debug`
- Clear settings back to default
- Restart IPC service
- Confirm logs are `str0m=warn,info`

Directions to apply new log level:
1. Put the new log filter in
2. Click "Apply"
3. Quit Firezone Client
4. Right-click on the Start Menu and click "Terminal (Admin)" to open a
Powershell prompt
5. Run `Restart-Service -Name FirezoneClientIpcService` (on Linux, `sudo
systemctl restart firezone-client-ipc.service`)
6. Re-open Firezone Client

```[tasklist]
- [x] Log the log filter maybe
- [x] Use `atomicwrites` to write the file
- [x] (cancelled) ~~Make the GUI write the file on boot if it's not there (saves a step when upgrading from older versions)~~
- [x] Windows smoke test
- [x] Fix permissions on `/var/lib/dev.firezone.client/config`
- [x] Fix Linux IPC service not loading the log filter file
- [x] Linux smoke test
- [ ] Make sure it's okay that users in `firezone-client` can change the device ID
- [ ] Update user guides to include restarting the computer or IPC service after updating the log level?
```

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-06-14 21:35:11 +00:00
Gabi
8cc28499e9 chore(connlib): implement IP translation according to RFC6145 (#5364)
As part of #4994, we need to translate IP packets between IPv4 and IPv6.
This PR introduces the `ConvertiblePacket` abstraction that implements
this.
2024-06-14 21:33:07 +00:00
Reactor Scram
23bcf877a8 fix(gui-client): un-initialize wintun correctly (#5357)
Closes #4765 

It turns out that if I don't join the worker thread explicitly it messes
up wintun a lot. I wonder if I should report that as a bug or what. It's
kind of our fault for keeping a handle to the `Session` alive in the
thread.

```[tasklist]
- [x] Move the debug command from `gui-client` to `headless-client`
- [x] Move the initialization out of `firezone-tunnel`, revert the `pub` changes, use `anyhow::Context`
```

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-06-14 20:21:52 +00:00
Thomas Eizinger
e3890bc0c1 chore(connlib): update docs of CompositeStrategy (#5373) 2024-06-14 19:49:33 +00:00
dependabot[bot]
121d457edf build(deps): Bump tokio-tungstenite from 0.21.0 to 0.23.0 in /rust (#5290)
Bumps [tokio-tungstenite](https://github.com/snapview/tokio-tungstenite)
from 0.21.0 to 0.23.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/snapview/tokio-tungstenite/blob/master/CHANGELOG.md">tokio-tungstenite's
changelog</a>.</em></p>
<blockquote>
<h1>0.23.0</h1>
<ul>
<li>Update <code>tungstenite</code> to <code>0.23.0</code>.</li>
<li>Disable default features on TLS crates.</li>
</ul>
<h1>0.22.0</h1>
<ul>
<li>Update TLS dependencies.</li>
<li><del>Update <code>tungstenite</code> to match
<code>0.22.0</code>.</del></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/snapview/tokio-tungstenite/commits">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tokio-tungstenite&package-manager=cargo&previous-version=0.21.0&new-version=0.23.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gabi <gabrielalejandro7@gmail.com>
2024-06-14 19:06:49 +00:00
Reactor Scram
582fed02b6 refactor(gui-client): remove unused debug commands (#5363)
It turns out they were all unused, but I like having a place to keep
them for new features.

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-06-14 18:13:19 +00:00
Gabi
75faf25050 fix(connlib): accept null address_descriptions (#5366)
Co-authored-by: Jamil Bou Kheir <jamilbk@users.noreply.github.com>
2024-06-14 17:21:38 +00:00
Reactor Scram
6c83f76a1f refactor(headless-client): move IPC servers into their own module (#5360)
Makes #5357 easier by freeing up space in the catch-all `platform` mod
2024-06-14 15:40:32 +00:00
Reactor Scram
90ebe193f4 feat(gui-client/linux): debug command for enabling and disabling GUI autostart (#5361)
Refs #5118
2024-06-14 15:10:32 +00:00
Thomas Eizinger
cf9f7504ce chore(relay): be more lenient with debug-assertions (#5367)
Some of the debug-assertions in the relay are a bit too strict.
Specifically, if an allocation times out because it is not refreshed, we
also clean-up all channel bindings associated with that allocation. Yet,
if an existing channel binding has already been removed earlier, it will
no longer be present in the respective map.

This isn't an issue at all. We can simply change the debug-assertion to
only compare what used to be present in the map. What really matters is
that the item we just removed does in fact point to the data that we are
expecting.

Related: #5355.
2024-06-14 06:07:15 +00:00
Thomas Eizinger
d9bc9abd6b test(connlib): add transition for removing CIDR & DNS resources (#5309)
Removing resources in the middle of a session is part of connlib's
functionality and should be tested as part of `tunnel_test`.
2024-06-14 05:23:51 +00:00
Thomas Eizinger
b6f5e03362 test(connlib): make strategy-creation more ergonomic (#5350)
When creating the `Transition` strategy, we are currently repeating the
same pattern again and again: We want to conditionally add a strategy if
one or more parts of our state are not empty.

We reduce this duplication with a custom `CompositeStrategy` that offers
a `with_if_not_empty` chainable method to only construct a strategy if
the given input element is not empty.

To make this usable across several usecases, we define an `IsEmpty`
helper trait that is implemented for `Vec`s, `Option`s and tuples.
2024-06-14 04:48:40 +00:00
Thomas Eizinger
3be7276d89 test(connlib): don't try to create zero-sized collection (#5348)
If we end up sampling filters that don't have any gaps, we cannot create
filters for all the gaps. Thus, we need to shortcut this strategy to
create an empty set of filters in case we don't have any gaps.

Fixes: #5345.
2024-06-14 04:04:42 +00:00
Jamil
cf093f2e9a fix: hotfix install to use GH (#5371)
Refs #5370
2024-06-13 20:51:03 -07:00