Commit Graph

6589 Commits

Author SHA1 Message Date
Jamil
f2c55330c0 fix(infra): Fix SSH firewall rules; enforce Relays IAP (#8158)
This PR resolves more drift between staging and prod in the area of SSH
firewall rules:

- Adds IPv6 SSH IAP access to prod firewall
- Removes SCTP and UDP port 22 access (this is not required by SSH)
- Enforces IAP for SSH access on staging
- Enable firewall logging for SSH on staging
2025-02-17 18:07:38 +00:00
Thomas Eizinger
7ea17c144a refactor(gui-client): de-duplicate logging of IPC message errors (#8157) 2025-02-17 14:21:52 +00:00
dependabot[bot]
8c7c0a9e8e build(deps): bump os_info from 3.9.2 to 3.10.0 in /rust (#8161)
Bumps [os_info](https://github.com/stanislav-tkach/os_info) from 3.9.2
to 3.10.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/stanislav-tkach/os_info/releases">os_info's
releases</a>.</em></p>
<blockquote>
<h2>os_info 3.10.0</h2>
<ul>
<li>Bluefin Linux support has been added. (<a
href="https://redirect.github.com/stanislav-tkach/os_info/issues/394">#394</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/stanislav-tkach/os_info/blob/master/CHANGELOG.md">os_info's
changelog</a>.</em></p>
<blockquote>
<h2>[3.10.0] (2025-02-09)</h2>
<ul>
<li>Bluefin Linux support has been added. (<a
href="https://redirect.github.com/stanislav-tkach/os_info/issues/394">#394</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="0554ec580d"><code>0554ec5</code></a>
Merge pull request <a
href="https://redirect.github.com/stanislav-tkach/os_info/issues/396">#396</a>
from stanislav-tkach/release-3-10-0</li>
<li><a
href="9a0980c375"><code>9a0980c</code></a>
Fix markdown indent</li>
<li><a
href="d189e7de3f"><code>d189e7d</code></a>
Release the 3.10.0 version</li>
<li><a
href="6d7ea4f231"><code>6d7ea4f</code></a>
Merge pull request <a
href="https://redirect.github.com/stanislav-tkach/os_info/issues/395">#395</a>
from stanislav-tkach/fix-spellcheck</li>
<li><a
href="e81339bd5d"><code>e81339b</code></a>
Fix spellcheck</li>
<li><a
href="9c6d24ead9"><code>9c6d24e</code></a>
Merge pull request <a
href="https://redirect.github.com/stanislav-tkach/os_info/issues/394">#394</a>
from sargunv/feature/add-bluefin-support</li>
<li><a
href="a41a664650"><code>a41a664</code></a>
feat: Add support for Bluefin Linux</li>
<li>See full diff in <a
href="https://github.com/stanislav-tkach/os_info/compare/v3.9.2...v3.10.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=os_info&package-manager=cargo&previous-version=3.9.2&new-version=3.10.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>
2025-02-17 11:11:38 +00:00
dependabot[bot]
3b78821944 build(deps): bump tracing-subscriber from 0.3.18 to 0.3.19 in /rust (#8162)
Bumps [tracing-subscriber](https://github.com/tokio-rs/tracing) from
0.3.18 to 0.3.19.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/tokio-rs/tracing/releases">tracing-subscriber's
releases</a>.</em></p>
<blockquote>
<h2>tracing-subscriber 0.3.19</h2>
<p>[ [crates.io][crate-0.3.19] ] | [ [docs.rs][docs-0.3.19] ]</p>
<p>This release updates the <code>tracing</code> dependency to
[v0.1.41][tracing-0.1.41] and
the <code>tracing-serde</code> dependency to
[v0.2.0][tracing-serde-0.2.0].</p>
<h3>Added</h3>
<ul>
<li>Add <code>set_span_events</code> to <code>fmt::Subscriber</code> (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/2962">#2962</a>)</li>
<li><strong>tracing</strong>: Allow <code>&amp;[u8]</code> to be
recorded as event/span field (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/2954">#2954</a>)</li>
</ul>
<h3>Changed</h3>
<ul>
<li>Set <code>log</code> max level when reloading (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/1270">#1270</a>)</li>
<li>Bump MSRV to 1.63 (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/2793">#2793</a>)</li>
<li>Use const <code>thread_local</code>s when possible (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/2838">#2838</a>)</li>
<li>Don't gate <code>with_ansi()</code> on the &quot;ansi&quot; feature
(<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3020">#3020</a>)</li>
<li>Updated tracing-serde to 0.2.0 (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3160">#3160</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/tokio-rs/tracing/issues/1270">#1270</a>:
<a
href="https://redirect.github.com/tokio-rs/tracing/pull/1270">tokio-rs/tracing#1270</a>
<a
href="https://redirect.github.com/tokio-rs/tracing/issues/2793">#2793</a>:
<a
href="https://redirect.github.com/tokio-rs/tracing/pull/2793">tokio-rs/tracing#2793</a>
<a
href="https://redirect.github.com/tokio-rs/tracing/issues/2838">#2838</a>:
<a
href="https://redirect.github.com/tokio-rs/tracing/pull/2838">tokio-rs/tracing#2838</a>
<a
href="https://redirect.github.com/tokio-rs/tracing/issues/2954">#2954</a>:
<a
href="https://redirect.github.com/tokio-rs/tracing/pull/2954">tokio-rs/tracing#2954</a>
<a
href="https://redirect.github.com/tokio-rs/tracing/issues/2962">#2962</a>:
<a
href="https://redirect.github.com/tokio-rs/tracing/pull/2962">tokio-rs/tracing#2962</a>
<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3020">#3020</a>:
<a
href="https://redirect.github.com/tokio-rs/tracing/pull/3020">tokio-rs/tracing#3020</a>
<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3160">#3160</a>:
<a
href="https://redirect.github.com/tokio-rs/tracing/pull/3160">tokio-rs/tracing#3160</a>
[tracing-0.1.41]:
<a
href="https://github.com/tokio-rs/tracing/releases/tag/tracing-0.1.41">https://github.com/tokio-rs/tracing/releases/tag/tracing-0.1.41</a>
[tracing-serde-0.2.0]:
<a
href="https://github.com/tokio-rs/tracing/releases/tag/tracing-serde-0.2.0">https://github.com/tokio-rs/tracing/releases/tag/tracing-serde-0.2.0</a>
[docs-0.3.19]: <a
href="https://docs.rs/tracing-subscriber/0.3.19/tracing_subscriber/">https://docs.rs/tracing-subscriber/0.3.19/tracing_subscriber/</a>
[crate-0.3.19]: <a
href="https://crates.io/crates/tracing-subscriber/0.3.19">https://crates.io/crates/tracing-subscriber/0.3.19</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="311c313216"><code>311c313</code></a>
chore: prepare tracing-subscriber 0.3.19 (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3162">#3162</a>)</li>
<li><a
href="35f360a192"><code>35f360a</code></a>
chore: fix new Clippy lints in Rust 1.83.0 (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3165">#3165</a>)</li>
<li><a
href="c66a692e67"><code>c66a692</code></a>
chore: prepare tracing-serde 0.2.0 (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3160">#3160</a>)</li>
<li><a
href="0ca7887081"><code>0ca7887</code></a>
chore: prepare tracing 0.1.41 (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3159">#3159</a>)</li>
<li><a
href="504a287abb"><code>504a287</code></a>
tracing: update core to v0.1.33 and attributes to v0.1.28 (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3156">#3156</a>)</li>
<li><a
href="baa5489406"><code>baa5489</code></a>
chore: prepare tracing-attributes 0.1.28 (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3155">#3155</a>)</li>
<li><a
href="cb0f0e71dd"><code>cb0f0e7</code></a>
chore: prepare tracing-core 0.1.33 (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3153">#3153</a>)</li>
<li><a
href="11c8273035"><code>11c8273</code></a>
subscriber: don't gate <code>with_ansi()</code> on the &quot;ansi&quot;
feature (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/3020">#3020</a>)</li>
<li><a
href="8a25a16873"><code>8a25a16</code></a>
core: fix missed <code>register_callsite</code> error (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/2938">#2938</a>)</li>
<li><a
href="6f08af07f2"><code>6f08af0</code></a>
subscriber: set <code>log</code> max level when reloading (<a
href="https://redirect.github.com/tokio-rs/tracing/issues/1270">#1270</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/tokio-rs/tracing/compare/tracing-subscriber-0.3.18...tracing-subscriber-0.3.19">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=tracing-subscriber&package-manager=cargo&previous-version=0.3.18&new-version=0.3.19)](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>
2025-02-17 11:11:06 +00:00
Jamil
9b5a7e5fb3 fix(portal): Fix grammar on account lockout message (#8149) 2025-02-17 06:06:28 +00:00
Thomas Eizinger
a3c0321020 fix(android): init Sentry layer as part of logging (#8154)
Resolves: #8050.
2025-02-17 05:38:29 +00:00
Thomas Eizinger
af9fc49b18 fix(windows): don't double shutdown session (#8156)
The `wintun` crate will already shutdown the session for us when the
last instance of `Session` gets dropped. Shutting down the session prior
to that already results in an attempt to close an adapter that is no
longer present, causing WinTUN to log (unactionable) errors.
2025-02-17 05:38:11 +00:00
Thomas Eizinger
9de467483f fix(apple): init Sentry layer as part of logging (#8155) 2025-02-17 04:19:22 +00:00
Thomas Eizinger
72782b8389 fix(gui-client): update telemetry context on new session (#8152)
Every time we start a new session, our telemetry context potentially
changes, i.e. the user may sign into a new account. This should ensure
that both the IPC service and the GUI always use the most up-to-date
`account_slug` as part of Sentry events. In addition, this will also set
the `account_slug` for clients that just signed in. Previously, the
`account_slug` would only get populated on the next start of the client.
2025-02-17 03:29:08 +00:00
Jamil
159e8e3dd5 fix(portal): Connect internet resource to internet site (#8151)
With the internet site changes now in, editing the Internet Resource is
impossible.

As such, the old instructions for using the Internet Resource no longer
apply, and we need to make sure the Internet Site and Internet Resource
are linked.

This migration ensures that's the case. However, if the internet
resource is currently connected to another site already, we don't move
it. This is only for internet resources that aren't connected to any
sites yet.
2025-02-16 17:30:48 -08:00
Jamil
d452e7d1b5 fix(portal): Parse string metric datetimes (#8148)
It turns out we can sometimes receive measurements with `DateTime`
fields, and other times they're strings. 🙃
2025-02-16 14:15:31 -08:00
Jamil
e487272a1b chore(apple): Release Apple clients 1.4.3 (#8144) 2025-02-16 12:59:38 -08:00
Jamil
d38ec466b9 chore(android): Release Android 1.4.2 (#8145) 2025-02-16 12:59:12 -08:00
Jamil
311988c5a2 fix(portal): Only compute diff for metrics with both start and end times (#8147)
A fix for a nil error from #8146
2025-02-16 12:57:03 -08:00
Jamil
36b887e98e fix(portal): Don't flush metrics when intervals < 5s (#8146) 2025-02-16 11:51:10 -08:00
Jamil
d29b210a63 chore(portal): Log metrics that failed to flush (#8142)
When flushing metrics to GCP, we sometimes get the following error:

```
{400, "{\n  \"error\": {\n    \"code\": 400,\n    \"message\": \"One or more TimeSeries could not be written: timeSeries[0-51]: write for resource=gce_instance{zone:us-east1-d,instance_id:6130184649770384727} failed with: One or more points were written more frequently than the maximum sampling period configured for the metric.\",\n    \"status\": \"INVALID_ARGUMENT\",\n    \"details\": [\n      {\n        \"@type\": \"type.googleapis.com/google.monitoring.v3.CreateTimeSeriesSummary\",\n        \"totalPointCount\": 52,\n        \"successPointCount\": 48,\n        \"errors\": [\n          {\n            \"status\": {\n              \"code\": 9\n            },\n            \"pointCount\": 4\n          }\n        ]\n      }\n    ]\n  }\n}\n"}
```

It would be helpful to know exactly which metrics are failing to flush
so we can further troubleshoot any issues.
2025-02-15 08:50:29 -08:00
Jamil
85ee37dfb3 Revert "fix(portal): Add node name key to metrics labels" (#8141)
The node_name label is already in the metrics.

Reverts firezone/firezone#8082
2025-02-15 08:47:45 -08:00
Jamil
4685c8edfd ci: Add write perms to release drafter for kotlin (#8140)
Needed to be able to create release drafts.
2025-02-15 07:46:13 -08:00
Jamil
5a3e940334 fix(portal): Fix typo in sites index (#8139)
Fixes a typo introduced in #6905
2025-02-15 07:25:08 -08:00
Jamil
b64a919ac0 fix(android): make task dependencies explicit (#8138)
Fixes a new issue gradle seems to complain about:

https://github.com/firezone/firezone/actions/runs/13339271704
2025-02-15 02:19:05 +00:00
Andrew Dryga
bacb4596b7 feat(portal): Internet Sites (#6905)
Related #6834

Co-authored-by: Jamil Bou Kheir <jamilbk@users.noreply.github.com>
2025-02-15 00:34:30 +00:00
Jamil
80aa9e76c1 build(phoenix-channel): add cfg to enable system CAs (#8137)
By setting the `system_certs` cfg at compile-time, any TLS connections
from `phoenix-channel` will use the system-provided CA store instead of
the embedded one.

Resolves: #8065

Co-authored-by: oddlama <oddlama@oddlama.org>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2025-02-15 00:23:25 +00:00
Jamil
df8b615d35 fix(apple/macOS): Don't force unwrap for menubar items (#8135)
We can elegantly handle nil items in places where we currently don't.
This PR updates all cases in MenuBar.swift to gracefully handle nil
items like the menubar icons which can, in rare circumstances, be `nil`
if they haven't yet loaded.
2025-02-14 21:50:35 +00:00
Jamil
5efb4b0fe2 fix(portal): Fix typo :dns -> :ip in seeds (#8134)
Fixes #8119
2025-02-14 20:32:28 +00:00
Thomas Eizinger
bc37e0140b fix(gui-client): allow sign-in without saving token to keyring (#8129)
Alternative to #8128. If the user dismissed the unlock prompt or has
their keyring otherwise misconfigured, it is still useful to allow them
to sign-in. They just won't stay signed-in across reboots of the device.
2025-02-14 15:17:26 +00:00
Thomas Eizinger
9cce4fd637 fix(gateway): don't route packets from expired NAT sessions (#8124)
When we receive an inbound packet from the TUN device on the Gateway, we
make a lookup in the NAT table to see if it needs to be translated back
to a DNS proxy IP.

At present, non-existence of such a NAT entry results in the packet
being sent entirely unmodified because that is what needs to happen for
CIDR resources. Whilst that is important, the same code path is
currently being executed for DNS resources whose NAT session expired!
Those packets should be dropped instead which is what we do with this
PR.

To differentiate between not having a NAT session at all or whether a
previous one existed but is expired now, we keep around all previous
"outside" tuples of NAT sessions around. Those are only very small in
their memory-footprint. The entire NAT table is scoped to a connection
to the given peer and will thus eventually freed once the peer
disconnects. This allows us to reliably and cheaply detect, whether a
packet is using an expired NAT session. This check must be cheap because
all traffic of CIDR resources and the Internet resource needs to perform
this check such that we know that they don't have to be translated.

This might be the source of some of the "Source not allowed" errors we
have been seeing in client logs.
2025-02-14 08:21:23 +00:00
Thomas Eizinger
8f0db6ad47 fix(connlib): run all callbacks on a separate thread (#8126)
At present, `connlib` communicates with its host app via callbacks.
These callbacks are executed synchronously as part of `connlib`s
event-loop, meaning `connlib` cannot do anything else whilst the
callback is executing in the host app. Additionally, this callback runs
within the `Future` that represents `connlib` and thus runs on a `tokio`
worker thread.

Attempting to interact with the session from within the callback can
lead to panics, for example when `Session::disconnect` is called which
uses `Runtime::block_on`. This isn't allowed by `tokio`: You cannot
block on the execution of an async task from within one of the worker
threads.

To solve both of these problems, we introduce a thread-pool of size 1
that is responsible for executing `connlib` callbacks. Not only does
this allow `connlib` to perform more work such as routing packets or
process portal messages, it also means that it is not possible for the
host app to cause these panics within the `tokio` runtime because the
callbacks run on a different thread.
2025-02-14 06:54:35 +00:00
Thomas Eizinger
10ba02e341 fix(connlib): split TUN send & recv into separate threads (#8117)
We appear to have caused a pretty big performance regression (~40%) in
037a2e64b6 (identified through
`git-bisect`). Specifically, the regression appears to have been caused
by [`aef411a`
(#7605)](aef411abf5).
Weirdly enough, undoing just that on top of `main` doesn't fix the
regression.

My hypothesis is that using the same file descriptor for read AND write
interests on the same runtime causes issues because those interests are
occasionally cleared (i.e. on false-positive wake-ups).

In this PR, we spawn a dedicated thread each for the sending and
receiving operations of the TUN device. On unix-based systems, a TUN
device is just a file descriptor and can therefore simply be copied and
read & written to from different threads. Most importantly, we only
construct the `AsyncFd` _within_ the newly spawned thread and runtime
because constructing an `AsyncFd` implicitly registers with the runtime
active on the current thread.

As a nice benefit, this allows us to get rid of a `future::select`.
Those are always kind of nasty because they cancel the future that
wasn't ready. My original intuition was that we drop packets due to
cancelled futures there but that could not be confirmed in experiments.
2025-02-14 05:32:51 +00:00
Jamil
e23bd97ea1 fix(apple): Persist last notified version (#8122)
Notifications on Apple platforms are delivered with best-effort
reliability and are not guaranteed.

They can also be queued up by the system so that, for example, it's
possible to issue a notification, quit the app, and then upon the next
launch of the app, receive the notification.

In this second case, if the user dismissed the notification, we will
crash. This is because we only track the `lastNotifiedVersion` in the
`NotificationAdapter` instance object and don't persist it to disk, then
we assert the value not to be nil when saving the user's `dismiss`
action.

To fix this, we persist the `lastNotifiedVersion` to the `UserDefaults`
store and attempt to read this when the user is dismissing the
notification. If we can't read it for some reason, we still dismiss the
notification but won't prevent showing it again on the next update
check.

A minor bug is also fixed where the original author didn't correctly
call the function's `completionHandler`. Also, unused instance vars
`lastDismissedVersion` left over from the original author are removed as
well.
2025-02-13 23:57:58 +00:00
Jamil
39cbf60ec8 ci: Bump Apple clients to 1.4.2 (#8109)
Fixes a slew of memory leaks, crashes, and other papercuts.
2025-02-13 22:08:45 +00:00
Jamil
2b1e9ac17f fix(gateway): Use StateDirectory to create /var/lib/firezone (#8120)
This is needed on fresh installations.
2025-02-13 05:35:44 -08:00
Jamil
62876028c8 chore(apple): Update Xcode project settings (#8114)
Xcode keeps pestering about these on each launch. Seems to be
maintainence-related project configuration updates.
2025-02-13 02:40:23 +00:00
Jamil
9a3cde89b9 refactor(apple): Don't create variables we don't use (#8115)
Both warnings-as-errors and the linter don't error on this particular
warning unfortunately.

👎
2025-02-13 02:40:12 +00:00
Thomas Eizinger
0e5d91e266 build(nix): use more recent pnpm (#8106)
Updates to `pnpm` 9.
2025-02-13 01:01:23 +00:00
Jamil
5afeb30f6f ci: Bump GUI clients to 1.4.5 (#8113) 2025-02-12 20:56:27 +00:00
Jamil
3feffc9f48 fix(android): Call disconnect in onDisconnect (#8110)
We need to call `disconnect()` in `onDisconnect` to free the memory
associated with the connlib session.

Related: https://github.com/firezone/firezone/pull/8104
2025-02-12 20:51:05 +00:00
Jamil
316ba6ddc3 ci: Upload Android symbols to Sentry (#8111)
Related: #8050
2025-02-12 20:49:54 +00:00
Jamil
8952eabe5a chore(infra): Upgrade terraform modules (#8112)
Fixes
https://github.com/firezone/firezone/actions/runs/13293765777/job/37121384825


```
╷
│ Error: Failed to query available provider packages
│ 
│ Could not retrieve the list of available versions for provider
│ hashicorp/aws: locked provider registry.terraform.io/hashicorp/aws 5.64.0
│ does not match configured version constraint >= 3.29.0, >= 5.[79](https://github.com/firezone/firezone/actions/runs/13293765777/job/37121384825#step:8:80).0; must use
│ terraform init -upgrade to allow selection of new versions
│ 
│ To see which modules are currently depending on hashicorp/aws and what
│ versions are specified, run the following command:
│     terraform providers
╵
```
2025-02-12 20:43:00 +00:00
Jamil
1aef65224b docs: Fix windows headless client note (#8108) 2025-02-12 19:43:21 +00:00
Jamil
cf1b74cdc1 fix(apple): Only use connlib sessions that are connected (#8104)
In the window of time between we check `AdapterState == .tunnelStarted`
and we call `setDns` in the Apple `pathUpdateHandler`, it's possible
that connlib disconnected. This window of time could potentially be
non-trivial since we read system resolvers in there, which hits the
disk.

As such, we should always check the `session` pointer is valid just
before use.

The `AdapterState` enum tracks two states: `tunnelStopped` and
`tunnelStarted`. In the `tunnelStarted` state, we populate a
`WrappedSession` object. This is redundant - connlib is either
`connected` and we have a `WrappedSession`, or it is not. Therefore we
can remove the `AdapterState` abstraction completely (which was leftover
from a previous developer) and directly use a `WrappedSession?` object
to issue calls to connlib with.

We set this to a valid `WrappedSession` upon connecting, and back to
`nil` as soon as connlib either `onDisconnect`s us, or the user
disconnects the tunnel.

Lastly, we avoid early-returning from queued workItems because we now
call connlib with `session?` which will no-op if there is no session,
allowing whatever IPC call running at the time (such as fetchResources)
to complete successfully, even though they'll see a "snapshotted" state
of the Adapter/PacketTunnelProvider. In other words, we no longer
enforce the session pointer to be valid for things that don't depend on
its state.

Fixes #7882
2025-02-12 19:31:39 +00:00
Thomas Eizinger
5a12dcb5b3 fix(gui-client): migrate to tailwind v4 (#8105)
With the dependency bump in #7995, we introduced a visual regression
that made all windows lose their styling:


![image](https://github.com/user-attachments/assets/9c9921a7-cab0-4adc-9868-cd7ddec40c64)

The changelog to the v4 bump actually mentions some breaking changes and
an automated upgrade tool but both the reviewer and the author of the PR
missed that.
2025-02-12 19:19:18 +00:00
Jamil
36f06b84ea fix(gateway): Harden systemd gateway unit file (#8102)
Tested this with Vultr. No errors or issues reported for either IP or
CIDR resources.

Fixes:
https://firezonehq.slack.com/archives/C06L41XN05T/p1739275605563679?thread_ts=1739267494.554949&cid=C06L41XN05T
2025-02-12 11:09:27 +00:00
Jamil
93a88563f3 feat(portal): allow socket based postgres connections (#8044) (#8097)
This allows connections to the postgresql database via the standard
socket, which - opposed to TCP sockets - allows `peer` authentication
based on local unix users. This removes the need for a password and is
much simpler to deploy when running components locally.

In the current form, `DATABASE_SOCKET_DIR` takes precedence over
hostname, if the environment variable is present. I found that
`compile_config!` somehow enforces a value to be present which is
explicitly not what I want for some of these values (i think). I'd be
glad if anyone with more elixir experience can guide me as to how I can
make this more idiomatic.

---------

Supersedes: #8044

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: oddlama <oddlama@oddlama.org>
2025-02-11 19:25:00 -08:00
Jamil
638c60649c fix(portal): silence hackney CVE-2025-1211 (#8103)
To my knowledge we don't rely on this particular functionality from
hackney. Unfortunately, we don't control the `hackney` version used by
deps, and there is no non-vulnerable version ready yet, so we ignore the
advisory for now.

A fuse has been set to fire one week from now.
2025-02-11 19:08:47 -08:00
Jamil
7730fdeda9 fix(ci): Fix minor command injection in pr_title check (#8101)
https://app.oneleet.com/tenants/148d888b-6cbe-4198-b4be-359e816927f4/code-security
2025-02-11 16:26:11 -08:00
Jamil
e32d2b845f fix(portal): Add node name key to metrics labels (#8082)
Ok, the reason why we're still getting the error `One or more points
were written more frequently than the maximum sampling period configured
for the metric.` is because the metric points are identified by the
labels in the metric, and so are "aggregated" more frequently than our
API calls.

By adding the node name to the labels, we scope the metric by that node
and prevent inserting the points more often than our API calls.
2025-02-11 17:21:27 +00:00
Jamil
393436a4aa ci: Release Gateway 1.4.4 (#8096) 2025-02-11 07:22:27 -08:00
Jamil
9f88cd16f4 fix(apple): Load NSImage in MenuBar asynchronously (#8090)
After further investigation, it appears that the `NSImage` initializer
loads and decodes images *synchronously* from the disk. In the MenuBar,
we are "lazy-loading" these images, but since the menu is constructed as
part of app initialization, we are effectively loading these when the
app boots, in `FirezoneApp`.

After loading, these are cached, but the initial can hang the UI thread
on app launch for slow systems.

Unfortunately, `NSImage` does not _formally_ conform to `@Sendable`.
However, this may be a nuance that isn't true in most cases, such as
when treating `NSImage` instances as read-only from only a single
thread.

As such, we wrap `NSImage` with our own struct, and mark it `@unchecked
Sendable`. This allows us to load the images on a background thread and
assign them to their UI thread counterparts in an async manner.

See further discussion:

-
https://forums.swift.org/t/why-cant-i-send-an-nsimage-across-actor-boundaries/76199
-
https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html#//apple_ref/doc/uid/10000057i-CH12-126728


Related: #7771
2025-02-11 14:36:40 +00:00
Thomas Eizinger
1847e8407a chore: release Headless Client v1.4.3 (#8093) 2025-02-11 14:10:13 +00:00
Thomas Eizinger
6093199ee3 chore: release GUI Client v1.4.4 (#8092) 2025-02-11 14:09:34 +00:00