Commit Graph

16 Commits

Author SHA1 Message Date
Mariusz Klochowicz
d07e32d91f chore: Build whole workspace on macos (#10228)
- Add some macos stubs to gui-smoke-test.
- Hide `ebpf-turn-router` binary functionality behind `#[cfg(target_arch
= "bpf")]`

Signed-off-by: Mariusz Klochowicz <mariusz@klochowicz.com>
2025-09-02 06:55:53 +00:00
Thomas Eizinger
69f9a03ee8 refactor(connlib): simplify IpPacket struct (#9795)
With the removal of the NAT64/46 modules, we can now simplify the
internals of our `IpPacket` struct. The requirements for our `IpPacket`
struct are somewhat delicate.

On the one hand, we don't want to be overly restrictive in our parsing /
validation code because there is a lot of broken software out there that
doesn't necessarily follow RFCs. Hence, we want to be as lenient as
possible in what we accept.

On the other hand, we do need to verify certain aspects of the packet,
like the payload lengths. At the moment, we are somewhat too lenient
there which causes errors on the Gateway where we have to NAT or
otherwise manipulate the packets. See #9567 or #9552 for example.

To fix this, we make the parsing in the `IpPacket` constructor more
restrictive. If it is a UDP, TCP or ICMP packet, we attempt to fully
parse its headers and validate the payload lengths.

This parsing allows us to then rely on the integrity of the packet as
part of the implementation. This does create several code paths that can
in theory panic but in practice, should be impossible to hit. To ensure
that this does in fact not happen, we also tackle an issue that is long
overdue: Fuzzing.

Resolves: #6667 
Resolves: #9567
Resolves: #9552
2025-07-29 04:42:57 +00:00
Thomas Eizinger
94660cbb2c chore(gui-smoke-test): wait for tunnel service to boot (#9766)
The tunnel service creates the Firezone ID upon start-up. With recent
changes to the GUI client, we now require reading the ID file when
starting the GUI client.

This exposes a race condition in our smoke-tests where we start them
both at roughly the same time.

To fix this, we sleep for 500ms after starting the tunnel process.
2025-07-02 05:16:15 +00:00
Thomas Eizinger
1bdba3601a feat(gui-client): rename IPC service to Tunnel service (#9154)
The name IPC service is not very descriptive. By nature of being
separate processes, we need to use IPC to communicate between them. The
important thing is that the service process has control over the tunnel.
Therefore, we rename everything to "Tunnel service".

The only part that is not changed are historic changelog entries.

Resolves: #9048
2025-05-19 09:52:06 +00:00
Thomas Eizinger
9e9599952f refactor(gui-client): streamline command handling (#9153)
The way the GUI client currently handles the commands and flags provided
via the CLI is somewhat confusing. There are various helper functions
that get called from the same place. We duplicate setup like the `tokio`
runtime in multiple places and the also loggers get initialised all over
the place.

To streamline this, we move global setup like `tokio` and telemetry to
the top-layer. From there, we delegate to a `try_main` function which
handles the various CLI commands. The default path from here is to run
the gui by delegating to the `gui` module. If not, we bail out early.

This structure is significantly easier to understand and provides error
and telemetry handling in a single place.
2025-05-16 01:20:46 +00:00
Thomas Eizinger
df463296a0 test: add context for failing dump_syms command (#9087) 2025-05-12 11:32:04 +00:00
Thomas Eizinger
84a2c275ca build(rust): upgrade to Rust 1.85 and Edition 2024 (#8240)
Updates our codebase to the 2024 Edition. For highlights on what
changes, see the following blogpost:
https://blog.rust-lang.org/2025/02/20/Rust-1.85.0.html
2025-03-19 02:58:55 +00:00
Thomas Eizinger
dd6b52b236 chore(rust): share edition key via workspace table (#7451) 2024-12-03 00:28:06 +00:00
Thomas Eizinger
2c26fc9c0e ci: lint Rust dependencies using cargo deny (#7390)
One of Rust's promises is "if it compiles, it works". However, there are
certain situations in which this isn't true. In particular, when using
dynamic typing patterns where trait objects are downcast to concrete
types, having two versions of the same dependency can silently break
things.

This happened in #7379 where I forgot to patch a certain Sentry
dependency. A similar problem exists with our `tracing-stackdriver`
dependency (see #7241).

Lastly, duplicate dependencies increase the compile-times of a project,
so we should aim for having as few duplicate versions of a particular
dependency as possible in our dependency graph.

This PR introduces `cargo deny`, a linter for Rust dependencies. In
addition to linting for duplicate dependencies, it also enforces that
all dependencies are compatible with an allow-list of licenses and it
warns when a dependency is referred to from multiple crates without
introducing a workspace dependency. Thanks to existing tooling
(https://github.com/mainmatter/cargo-autoinherit), transitioning all
dependencies to workspace dependencies was quite easy.

Resolves: #7241.
2024-11-22 00:17:28 +00:00
dependabot[bot]
28c8b676fb build(deps): Bump axum from 0.7.6 to 0.7.7 in /rust (#6871)
Bumps [axum](https://github.com/tokio-rs/axum) from 0.7.6 to 0.7.7.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/tokio-rs/axum/releases">axum's
releases</a>.</em></p>
<blockquote>
<h2>axum-extra - v0.7.7</h2>
<ul>
<li><strong>added:</strong> <code>Clone</code> implementation for
<code>ErasedJson</code> (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2142">#2142</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/tokio-rs/axum/issues/2142">#2142</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/2142">tokio-rs/axum#2142</a></p>
<h2>axum v0.7.7</h2>
<ul>
<li><strong>change</strong>: Remove manual tables of content from the
documentation, since
rustdoc now generates tables of content in the sidebar (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2921">#2921</a>)</li>
</ul>
<p><a
href="https://redirect.github.com/tokio-rs/axum/issues/2921">#2921</a>:
<a
href="https://redirect.github.com/tokio-rs/axum/pull/2921">tokio-rs/axum#2921</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="fe56a310ef"><code>fe56a31</code></a>
Bump versions</li>
<li><a
href="ac50d7daaf"><code>ac50d7d</code></a>
docs: Remove manual tables of content (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2921">#2921</a>)</li>
<li><a
href="6f5607785d"><code>6f56077</code></a>
core: Fix compile errors from __log_rejection (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2933">#2933</a>)</li>
<li><a
href="4fc0641874"><code>4fc0641</code></a>
Upgrade private dependencies (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2935">#2935</a>)</li>
<li><a
href="6ec3a51f2d"><code>6ec3a51</code></a>
Clarify some subtleties of routing (<a
href="https://redirect.github.com/tokio-rs/axum/issues/2896">#2896</a>)</li>
<li>See full diff in <a
href="https://github.com/tokio-rs/axum/compare/axum-v0.7.6...axum-v0.7.7">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=axum&package-manager=cargo&previous-version=0.7.6&new-version=0.7.7)](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>
2024-10-15 00:15:51 +00:00
Thomas Eizinger
0825055ff2 fix(rust/gui-client): allow GUI process to read the firezone-id file from disk (#6987)
Closes #6989

- The tunnel daemon (IPC service) now explicitly sets the ID file's
perms to 0o640, even if the file already exists.
- The GUI error is now non-fatal. If the file can't be read, we just
won't get the device ID in Sentry.
- More specific error message when the GUI fails to read the ID file

We attempted to set the tunnel daemon's umask, but this caused the smoke
tests to fail. Fixing the regression is more urgent than getting the
smoke tests to match local debugging.

---------

Co-authored-by: _ <ReactorScram@users.noreply.github.com>
2024-10-09 20:04:24 +00:00
Reactor Scram
05a2b28d9f feat(rust/gui-client): add sentry.io error reporting (#6782)
Refs #6138 

Sentry is always enabled for now. In the near future we'll make it
opt-out per device and opt-in per org (see #6138 for details)

- Replaces the `crash_handling` module
- Catches panics in GUI process, tunnel daemon, and Headless Client
- Added a couple "breadcrumbs" to play with that feature
- User ID is not set yet
- Environment is set to the API URL, e.g. `wss://api.firezone.dev`
- Reports panics from the connlib async task
- Release should be automatically pulled from the Cargo version which we
automatically set in the version Makefile

Example screenshot of sentry.io with a caught panic:

<img width="861" alt="image"
src="https://github.com/user-attachments/assets/c5188d86-10d0-4d94-b503-3fba51a21a90">
2024-09-27 16:34:54 +00:00
Reactor Scram
be058fdd96 test(rust/gui-client/auth): manual test for auto-sign-in with invalid token (#6792)
Synthetic replication for #6791.

The diff for the fix will probably be short, so I wanted this diff for
the test to be reviewed separately.

In your normal terminal: `cargo build -p firezone-gui-client -p
gui-smoke-test`

With sudo / admin powers: `./target/debug/gui-smoke-test.exe
--manual-tests`

Some customers _must_ have hit this, it's so easy to trigger.

I can't add it to the CI smoke test because there's no portal in CI
during the smoke test, unless we use Staging.
2024-09-23 14:06:26 +00:00
Thomas Eizinger
b2e8ccbb49 chore: delete snownet-tests (#6359)
When `snownet` was first being developed, these tests ensured that
hole-punching as well as connectivity via a relayed works correctly. We
have since added extensive tests that ensure connectivity works in many
scenarios via `tunnel_test`. `tunnel_test` does not (yet) have a
simulated NAT so hole-punching itself is not covered by that.

UDP hole-punching is shockingly trivial though because all you need to
do is send UDP packets to the same socket that the other party is
sending from. This isn't done by our own code but rather by str0m's
implement of ICE (as long as we add the correct candidates).

The `snownet-tests` themselves are quite fragile because they need to
set up their own event loop and manually construct an IP packet. They
haven't caught a single bug to my knowledge so I am proposing to delete
them for ease of maintenance.

For example, in
https://github.com/firezone/firezone/actions/runs/10449965474/job/28948590058?pr=6335
the tests fail because we no longer directly force a handshake when the
connection is established. This is unnecessary now because the buffered
intent packet will directly force a handshake from the client to the
gateway. Yet, `snownet-tests` event loop would need adjusting to also do
that.
2024-08-20 03:40:54 +00:00
Thomas Eizinger
a272776171 revert: emit candidates in reverse-priority order (#6246)
This ended up not fixing anything and the order is now guaranteed to be
deterministic due to an upstream change.

Related: https://github.com/algesten/str0m/pull/557.
Reverts: #6200.
2024-08-12 23:55:31 +00:00
Thomas Eizinger
eb91a052c3 chore(rust): group testing crates into a tests/ directory (#6257)
Resolves: #5695.

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
Co-authored-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-08-12 17:17:01 +00:00