Commit Graph

1668 Commits

Author SHA1 Message Date
Reactor Scram
51250faa0d chore(telemetry): make the firezone device ID a context not a tag (#7179)
Closes #7175 

Also fixes a bug with the initialization order of Tokio and Sentry.

Previously:
1. Start Tokio, executor threads inherit main thread context
2. Load device ID and set it on the main telemetry hub

Now:
1. Load device ID and set it on the main telemetry hub
2. Start Tokio, executor threads inherit main thread context

The context and possibly tags didn't seem to propagate from the main hub
if we set them after the worker threads spawned.

Based on this understanding, the IPC service process is still wrong, but
a fix will have to wait, because telemetry in the IPC service is more
complicated than in the GUI process.

<img width="818" alt="image"
src="https://github.com/user-attachments/assets/9c9efec8-fc55-4863-99eb-5fe9ba5b36fa">
2024-10-30 21:27:17 +00:00
Jamil
e9b2e4735a ci: Publish Gateway 1.4.0 (#7187)
Publish the 1.4.0 release so it's available at `/api/releases` and will
send upgrade Gateway notifications.
2024-10-30 20:44:33 +00:00
Thomas Eizinger
7213eb823d fix(rust): fallback to CARGO_PKG_VERSION if git is unavailable (#7188)
When building inside a docker container, like we do for the
headless-client and gateway, the `.git` directory is not available.
Thus, determining what our current version is fails and gets reported as
"unknown". We are now also using this for Sentry which is not very
helpful if all errors are categorised under the same version.

In case somebody builds a gateway / client from source, we will have the
full version available. Most users will use our docker containers
though, meaning the version will only always be for a full release.

Resolves: #7184.
2024-10-30 17:42:44 +00:00
Thomas Eizinger
b7bef6d062 chore(rust): use new try_send APIs in quinn-udp (#7185)
With the recent lobbying effort in `quinn-udp`, we were able to get
`try_send` APIs for the UDP socket that doesn't silence any errors while
sending datagrams. Originally, the reasoning in `quinn-udp` was that
because UDP is an unreliable protocol anyway, errors don't need to be
surfaced because there must be upper-level mechanisms for retrying
messages. Whilst that is true, getting immediate feedback that something
isn't working can also be very beneficial. For example, if you don't
have proper IPv6 connectivity on a socket, the syscall will immediately
fail with `DestinationUnreachable`.

Within Firezone, we use these UDP sockets to send all kinds of messages,
including DNS queries to upstream servers. In case that doesn't work,
failing instantly allows us to send a SERVFAIL error back to the OS
right away instead of having to wait for a timeout.

Additionally, `quinn-udp` logs these send errors on WARN which cause
unnecessary noise in Sentry.

Resolves: #6353.
2024-10-30 16:17:52 +00:00
Reactor Scram
14c9e2b2d5 chore(ci): use Vite bundler correctly in GUI smoke test (#7181)
Closes #7171 

If the assets aren't bundled, Tauri will warn about it in `tracing`,
that will get sent to Sentry, and then it will be interpreted as an
error.

Timeline to prove that this fixes the false positive error in Sentry,
all times UTC on October 29th:

- 21:01:26 - Most recent events in Sentry as of 21:20:19
- 21:11:09 - Restarted CI while CD is quiet
- 21:14:01 - First smoke test begins
- 21:19:39 - Last smoke test ends
2024-10-30 14:44:19 +00:00
Thomas Eizinger
e0d82eef27 fix(connlib): correctly categorise CI environment in Sentry (#7173) 2024-10-30 14:11:06 +00:00
Thomas Eizinger
de2afb23be chore: exclude noisy crates from Sentry breadcrumbs (#7189) 2024-10-30 14:09:43 +00:00
Gabi
dc97b9040d fix(connlib): large upstream dns message (#7183)
If edns0 doesn't work correctly DNS servers might respond with messages
bigger than our maximum udp size.

In that case we need to truncate those messages when forwarding the
respond back to the interface and expect the OS to retry with TCP.

Otherwise we aren't able to allocate a packet big enough for this.

Fixes #7121

---------

Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-10-30 04:02:14 +00:00
Thomas Eizinger
7037830b19 chore(connlib): submit DEBUG events as breadcrumbs (#7177)
This should give us much more context for a particular error without
having to bother a customer with sending us the logs / digging for them
ourselves in our staging or production environment.

Resolves: #7176.
2024-10-29 23:39:07 +00:00
Thomas Eizinger
a2c9d148ac chore(gateway): bump version to 1.4.0 (#7090)
In order to release #6941, we need to bump the gateway's version to
1.4.0. The portal has a version gate that only allows connection clients
which have version >= 1.4.0. Thus, in order to test #6941 on staging,
the version must not yet be bumped and is thus split out into this PR.
2024-10-29 23:20:46 +00:00
Thomas Eizinger
62c29705cf chore(connlib): sort DSNs alphabetically (#7178) 2024-10-29 20:37:15 +00:00
Thomas Eizinger
1d9802f2e4 fix(connlib): don't add host candidates multiple times (#7172)
We introduced a boolean bug in #7163 that causes us to attempt to add
host candidates much more often than necessary. This spams the logs on
DEBUG level but was otherwise not harmful.
2024-10-29 15:13:40 +00:00
Thomas Eizinger
f7a388345b fix(connlib): reconnect in case we lose all relays (#7164)
During normal operation, we should never lose connectivity to the set of
assigned relays in a client or gateway. In the presence of odd network
conditions and partitions however, it is possible that we disconnect
from a relay that is in fact only temporarily unavailable. Without an
explicit mechanism to retrieve new relays, this means that both clients
and gateways can end up with no relays at all. For clients, this can be
fixed by either roaming or signing out and in again. For gateways, this
can only be fixed by a restart!

Without connected relays, no connections can be established. With #7163,
we will at least be able to still establish direct connections. Yet,
that isn't good enough and we need a mechanism for restoring full
connectivity in such a case.

We creating a new connection, we already sample one of our relays and
assign it to this particular connection. This ensures that we don't
create an excessive amount of candidates for each individual connection.
Currently, this selection is allowed to be silently fallible. With this
PR, we make this a hard-error and bubble up the error that all the way
to the client's and gateway's event-loop. There, we initiate a reconnect
to the portal as a compensating action. Reconnecting to the portal means
we will receive another `init` message that allows us to reconnect the
relays.

Due to the nature of this implementation, this fix may only apply with a
certain delay from when we actually lost connectivity to the last relay.
However, this design has the advantage that we don't have to introduce
an additional state within `snownet`: Connections now simply fail to
establish and the next one soon after _should_ succeed again because we
will have received a new `init` message.

Resolves: #7162.
2024-10-29 01:01:47 +00:00
Thomas Eizinger
046b9e0cd4 refactor(connlib): track srvflx candidates separately (#7163)
As part of maintaining an allocation, we also perform STUN with our
relays to discover our server-reflexive address. At the moment, these
candidates are scoped to an `Allocation`. This is unnecessarily
restrictive. Similar to host candidates, server-reflexive candidate
entirely depend on the socket you send data from and are thus
independent of the allocation's state.

During normal operation, this doesn't really matter because all relay
traffic is sent through the same sockets so all `Allocation`s end up
with the same server-reflexive candidates. Where this does matter is
when we disconnect from relay's for one reason or another (for example:
#7162). The fact that all but host-candidates are scoped to
`Allocation`s means that without `Allocation`s, we cannot make any new
connections, not even direct ones. This is unnecessarily restrictive and
causes bugs within `Allocation` to have a bigger blast radius than
necessary.

With this PR, we keep server-reflexive candidates in the same set as
host candidates. This allows us to at least establish direct connections
in case something is wrong with the relays or our state tracking of
relays on the client side.
2024-10-28 16:57:41 +00:00
Thomas Eizinger
1f7a0430b7 chore(rust): record tracing WARNs as Sentry exceptions (#7166)
It appears that I have misunderstood the documentation of
`sentry-tracing`. When a message gets logged as an event (rather than an
"exception") `std::error::Error`s attached as tracing `Value`s do not
get recorded. It doesn't really matter whether we record our events as
exceptions or messages. We should ideally look at all of them and
particularly noisy ones can be muted forever in Sentry so we don't end
up in a "boy who cried wolf" situation. Therefore, this PR changes our
event filter to also submit WARNs as exceptions to make sure they get
logged accordingly.

Resolves: #7161.
Related: https://github.com/getsentry/sentry-rust/issues/702.
2024-10-28 14:07:42 +00:00
Thomas Eizinger
c48c33d935 chore(gateway): lower "Tunnel error" to debug (#7165)
This is spamming Sentry and we have almost reached our rate limit for
the amounts of events ingested.
2024-10-28 14:04:49 +00:00
Thomas Eizinger
8e107b0d65 chore: don't wake Node on idle connections (#7149)
In order to make Firezone more mobile-friendly, waking up the CPU less
often is key. In #6845, we introduced a low-power mode into `snownet`
that sends STUN messages on a longer interval if the connection is idle.
Whilst poking around `boringtun` as part integrating our fork into the
main codebase, I noticed that we are updating `boringtun`'s timers every
second - even on idle connections.

This PR applies the same idea of #6845 to the timers within `Node`: Idle
connections get "woken" less and if all connections are idle, we avoid
waking the `Node` altogether (unless we need to refresh allocations /
channels).

Calling `handle_timeout` less often revealed an issue in the tests where
we didn't fully process the state changes after invalidating a candidate
from the remote. To fix this, we now call `handle_timeout` directly
after `{add,remove}_remote_candidate`. This isn't super clean because at
first glance, it looks like `handle_timeout` should just be part of the
add/remove candidate function. It is quite common for sans-IO designs to
require calling `handle_timeout` after state has been changed. In
`{Client,Server}Node`, we do it implicitely so that we don't have to do
it in the tests and the event-loop.

It would be great to test this in some automated fashion but I haven't
figured out how yet. I did temporarily add an `info!` log to the
event-loop of the client and with this patch applied, the entire
event-loop goes to sleep on idle connections. It still does get woken
every now and then but no longer every second!
2024-10-25 00:21:06 +00:00
Thomas Eizinger
82fcad0a3b refactor(rust): only send telemetry spans to Sentry (#7153)
With the introduction of the `tracing-sentry` integration in #7105, we
started sending tracing spans to Sentry. By default, all spans with
level INFO and above get sampled at the configured rate and sent to
Sentry.

This results in a lot of useless transaction in Sentry because we use
INFO level spans in multiple places in connlib to attach contextual
information like the current connection ID.

This PR introduces the concept of `telemetry` spans which - similar to
the `telemetry` log target in #7147 - qualifies a span for being sent to
Sentry. By convention, these are also defined as requiring the TRACE
level. This ensures we won't ever see them as part of regular log
output.
2024-10-24 20:25:26 +00:00
Thomas Eizinger
5cf105f073 chore(android): start telemetry together with connlib session (#7151)
As a first step for integration Sentry into the Android app, we launch
the Sentry Rust agent as soon as a `connlib` session starts up. At a
later point, we can also integrate Sentry into the Android app itself
using the Java / Kotlin SDK.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
2024-10-24 20:03:06 +00:00
Thomas Eizinger
c12a02e348 chore(apple): start telemetry together with connlib session (#7152)
This starts up telemetry together with each `connlib` session. At a
later point, we can also integrate the native Swift SDK into the MacOS /
iOS app to catch non-connlib specific problems.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
2024-10-24 19:59:52 +00:00
Reactor Scram
4fe4001760 chore(rust/gui-client): migrate to Tauri v2 (#6996)
Closes #4883 

Refs #7005 

Adds support for Ubuntu 24.04, drops support for Ubuntu 20.04

Known issues:
- On Ubuntu 22.04, sometimes GNOME shows the wrong tray icon
- On Ubuntu 24.04, the first time you open the tray menu, GNOME takes a
long time to open the menu.

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
2024-10-24 16:31:28 +00:00
Thomas Eizinger
5f91259d31 chore(rust): capture backtraces for panics (#7133)
Sentry by default has an integration to capture stacktraces for panics,
we just need to enable it. Here is what this looks like:
https://firezone-inc.sentry.io/issues/6013299023

Resolves: #7132.
2024-10-24 14:18:40 +00:00
Thomas Eizinger
45a36ea190 chore: categorise docker-compose env in Sentry (#7128)
Resolves: #7125.
2024-10-24 14:08:31 +00:00
Thomas Eizinger
12ca4f1cc7 chore(connlib): introduce telemetry log target (#7147)
With #7105, all ERROR events from `tracing` get logged as exceptions in
Sentry and all WARN events get logged as "messages". We don't want to
fill up the user's harddrive with logs which means we have to be
somewhat conservative, what gets logged on INFO and above (with INFO
being the default log level). There are certain events though where it
would be useful to know, how often they happen because too many of them
can indicate a problem.

To solve this problem, we introduce a dedicated `telemetry` log target
that the tracing-sentry integration layer watches for. Events for the
`telemetry` log target that gets logged on TRACE will be sampled at a
rate of 1% and submitted as messages to Sentry.
2024-10-24 01:24:45 +00:00
Thomas Eizinger
58a770a857 chore(connlib): bump severity of several logs (#7140)
Now that we have Sentry integrated with `tracing`, using `warn!` logs a
bit more liberally allows us to detect edge-cases that customers might
run into.

All the logs touched in this PR represent some kind of problem that it
would be good to know about.
2024-10-24 01:01:30 +00:00
Thomas Eizinger
80c5b0df71 refactor(connlib): replace LogUnwrap with macros (#7138)
Using a trait means the call-site of the log message will always be the
`log_unwrap` module, despite the `#[track_caller]` annotation. That one
only works for `std::panic::Location` unfortunately which `tracing`
isn't using.

Macros will be evaluated earlier and thus the messages will show up with
the correct module name.
2024-10-23 23:44:23 +00:00
Thomas Eizinger
8b62f63065 chore(connlib): respond with empty records to HTTPS query (#7141)
Applications may query domains for HTTPS RR using the HTTPS record type.
`connlib` operates on OSI layer 3 and thus can only hand out IPs for the
particular domains. The correct way to signal this to applications is to
answer the HTTPS query with NOERROR and return an empty set of records.


[RFC9460](https://www.rfc-editor.org/rfc/rfc9460.html#name-client-behavior)
says the following:

> 4. If one or more "compatible" ([Section
8](https://www.rfc-editor.org/rfc/rfc9460.html#mandatory)) ServiceMode
records are returned, these represent the alternative endpoints. Sort
the records by ascending SvcPriority.
> 5. Otherwise, SVCB resolution has failed, and the list of available
endpoints is empty.

This implies that returning no records is valid behaviour and forces the
client to consider the HTTPS DNS query as failed and query for A / AAAA
records instead (if it didn't do so via happy-eyeballs already).
2024-10-23 23:28:20 +00:00
Thomas Eizinger
2ca91a3b1a chore(connlib): remove old mock feature (#7142)
This is so stale, it definitely needs to go in the bin.
2024-10-23 16:30:15 +00:00
Thomas Eizinger
6eecfc0cfb fix: replace panics with Result for IP packets (#7135)
My theory for this issue is that we receive a UDP DNS response from an
upstream server that is bigger than our MTU and thus forwarding it
fails.

This PR doesn't fix that issue by itself but only mitigates the actual
panic. To properly fix the underlying issue, we need to parse the DNS
message. Truncate it and set the TC bit.

Related: #7121.
2024-10-23 16:25:12 +00:00
Thomas Eizinger
ee30368970 refactor(connlib): simplify error handling on crash (#7134)
The `fmt::Display` implementation of `tokio::task::JoinError` already
does exactly what we do here: Extracting the panic message if there is
one. Thus, we can simplify this code why just moving the `JoinError`
into the `DisconnectError` as its source.
2024-10-23 16:13:39 +00:00
Thomas Eizinger
582e919929 test(connlib): don't generate IPs in sentinel range (#7139)
Fixes: #7137.
2024-10-23 06:42:40 +00:00
Thomas Eizinger
4020756e7f chore: remove accidentially committed debugging code (#7130) 2024-10-23 03:37:25 +00:00
Gabi
a803a54b02 fix(proptest): don't use port 53 for non-dns packets (#7129)
For simplicity sake I assumed that any packet using port 53 would be a
dns packet, but I forgot to exclude it from the range of possible ports
used.

This can cause spurious CI failures
2024-10-23 00:05:28 +00:00
Thomas Eizinger
8ad290f024 chore(gateway): fix bad docs on --no-telemetry flag (#7127) 2024-10-22 23:30:20 +00:00
Thomas Eizinger
990324b2ec chore(rust): enable sentry-tracing integration (#7105)
Using the `sentry-tracing` integration, we can automatically capture
events based on what we log via `tracing`. The mapping is defined as
follows:

- ERROR: Gets captured as a fatal error
- WARN: Gets captured as a message
- INFO: Gets captured as a breadcrumb
- `_`: Does not get captured at all

If telemetry isn't active / configured, this integration does nothing.
It is therefore safe to just always enable it.
2024-10-22 23:23:49 +00:00
Thomas Eizinger
b7b7626cfa feat(gateway): add error reporting via Sentry (#7103)
Similar to the GUI and headless clients, adding error reporting via
Sentry should give us much better insight into how well gateways are
performing.

Resolves: #7099.

---------

Signed-off-by: Thomas Eizinger <thomas@eizinger.io>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2024-10-22 20:40:28 +00:00
Reactor Scram
2e51274ab0 fix(rust/gui-client): fix the version reported by the IPC service to the portal (#7123)
Closes #7122 

It had been reporting the Headless Client version, since the IPC service
is built as part of the Headless Client crate. Now it's corrected from
1.3.5 to 1.3.10

<img width="417" alt="image"
src="https://github.com/user-attachments/assets/b868de4a-3dce-42e3-ab4f-39a68c2ba48c">
2024-10-22 20:30:00 +00:00
Reactor Scram
4bfdf9b20b chore(rust/gui-client): report account slug to Sentry (#7097)
Closes #7087

<img width="375" alt="image"
src="https://github.com/user-attachments/assets/7fcf0f08-019c-4e48-9c1b-f038638ce930">
2024-10-22 17:17:47 +00:00
Reactor Scram
1f8530ec24 chore(rust/gui-client): fix Tauri build scripts (#7077)
- We don't need to control our deb's deps since we're sticking with
Tauri
- Specifying `pnpm tauri` fixes an odd issue on one dev system
- `tauri-cli` is a dev dep, not a runtime dep
2024-10-22 16:42:20 +00:00
Thomas Eizinger
0b25e34ebe fix(headless-client): stop telemetry while connlib is active (#7109)
Flushing events to Sentry requires us to be able to resolve domain
names. This is only possible while connlib is active or completely
disabled.

Without this, stopping telemetry pretty much always times out for me on
my local machine when using the headless-client.
2024-10-22 16:08:29 +00:00
dependabot[bot]
13b7c11d76 build(deps): Bump nu-ansi-term from 0.46.0 to 0.50.1 in /rust (#7113)
Bumps [nu-ansi-term](https://github.com/nushell/nu-ansi-term) from
0.46.0 to 0.50.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/nushell/nu-ansi-term/releases">nu-ansi-term's
releases</a>.</em></p>
<blockquote>
<h2>v0.50.1</h2>
<h2>What's Changed</h2>
<ul>
<li>Remove unused import by <a
href="https://github.com/nickelc"><code>@​nickelc</code></a> in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/63">nushell/nu-ansi-term#63</a></li>
<li>Update <code>windows-sys</code> to 0.52 by <a
href="https://github.com/nickelc"><code>@​nickelc</code></a> in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/62">nushell/nu-ansi-term#62</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/nushell/nu-ansi-term/compare/v0.50.0...v0.50.1">https://github.com/nushell/nu-ansi-term/compare/v0.50.0...v0.50.1</a></p>
<h2>v0.50.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Rename the LICENCE file to LICENSE by <a
href="https://github.com/newpavlov"><code>@​newpavlov</code></a> in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/51">nushell/nu-ansi-term#51</a></li>
<li>gnu_legacy: with GNU, write foreground first, else background first.
by <a href="https://github.com/sylvestre"><code>@​sylvestre</code></a>
in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/54">nushell/nu-ansi-term#54</a></li>
<li>Bump to 0.50 by <a
href="https://github.com/kubouch"><code>@​kubouch</code></a> in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/56">nushell/nu-ansi-term#56</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/newpavlov"><code>@​newpavlov</code></a>
made their first contribution in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/51">nushell/nu-ansi-term#51</a></li>
<li><a href="https://github.com/sylvestre"><code>@​sylvestre</code></a>
made their first contribution in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/54">nushell/nu-ansi-term#54</a></li>
<li><a href="https://github.com/kubouch"><code>@​kubouch</code></a> made
their first contribution in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/56">nushell/nu-ansi-term#56</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/nushell/nu-ansi-term/compare/v0.49.0...v0.50.0">https://github.com/nushell/nu-ansi-term/compare/v0.49.0...v0.50.0</a></p>
<h2>v0.49.0</h2>
<p>This release attempts to fix API limitations of the previous
<code>0.48.0</code> release.
You can now again construct <code>Style</code> directly through its
fields.</p>
<h2>Breaking changes</h2>
<h3>coming from <code>0.47.0</code></h3>
<ul>
<li>Style has now a <code>prefix_with_reset</code> field to enable
additional reset sequences that are introduced before setting a
style.</li>
</ul>
<h3>coming from <code>0.48.0</code></h3>
<ul>
<li><code>Style.with_reset</code> has been renamed to
<code>Style.prefix_with_reset</code></li>
<li><code>AnsiGenericString::hyperlink()</code> changed in signature
from <code>...(&amp;mut self, ...)</code> to <code>...(self, ...) -&gt;
Self</code></li>
<li><code>AnsiGenericString::icon()</code> and <code>::cwd()</code> have
been removed for now.</li>
</ul>
<h2>What's Changed</h2>
<ul>
<li>Fix Re-enabling manual Style creation by <a
href="https://github.com/mhelsley"><code>@​mhelsley</code></a> in <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/47">nushell/nu-ansi-term#47</a></li>
<li>Use chaining for <code>AnsiGenericString::hyperlink</code> by <a
href="https://github.com/sholderbach"><code>@​sholderbach</code></a> in
<a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/48">nushell/nu-ansi-term#48</a></li>
<li>Make <code>Style.with_reset</code> more explicit as
<code>prefix_with_reset</code> by <a
href="https://github.com/sholderbach"><code>@​sholderbach</code></a> in
<a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/50">nushell/nu-ansi-term#50</a></li>
<li>Bump version for 0.49 release by <a
href="https://github.com/sholderbach"><code>@​sholderbach</code></a> in
<a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/49">nushell/nu-ansi-term#49</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/nushell/nu-ansi-term/compare/v0.48.0...v0.49.0">https://github.com/nushell/nu-ansi-term/compare/v0.48.0...v0.49.0</a></p>
<h2>v0.48.0</h2>
<blockquote>
<p><strong>Warning</strong>
This release introduces an unintended breaking change for users that
want to construct <code>Style</code> directly. (see <a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/46">#46</a>
for tracking)</p>
</blockquote>
<h2>New features</h2>
<p>This release <a
href="https://redirect.github.com/nushell/nu-ansi-term/pull/43">introduces
support</a> to express several OSC control codes by calling methods on
<code>AnsiGenericString</code>. Primarily you can now mark particular
text with a hyperlink by calling <code>.hyperlink()</code> on it.</p>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/nushell/nu-ansi-term/blob/main/CHANGELOG.md">nu-ansi-term's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
<h2>v0.47.0 (2023-03-13)</h2>
<h3>Breaking changes</h3>
<ul>
<li>Bumped minimum supported Rust version (MSRV) to 1.62.1</li>
<li>Change of <code>Color::default()</code> value to the ANSI default
color <code>Color::Default</code> (code <code>39</code> and
<code>49</code> for foreground and background respectively). This
replaces <code>Color::White</code> as the default value.</li>
</ul>
<h3>Other changes</h3>
<ul>
<li><code>const</code>ification of several functions and methods.</li>
<li>Improved CI workflow.</li>
<li>Updated to Rust edition 2021.</li>
<li>Replaced <code>winapi</code> dependency with
<code>windows-sys</code>.</li>
<li>Removed <code>overload</code> dependency.</li>
<li>Added <code>AnsiGenericString::as_str()</code> to allow access to
the underlying string.</li>
<li>Fixed typos in README.</li>
<li>Added <code>CHANGELOG.md</code> for changes since forking
<code>ansi_term</code>.</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="0912f8f6a3"><code>0912f8f</code></a>
bump version number 0.50.1</li>
<li><a
href="b902580d8f"><code>b902580</code></a>
Update <code>windows-sys</code> to 0.52 (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/62">#62</a>)</li>
<li><a
href="cc9b338a00"><code>cc9b338</code></a>
Remove unused import (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/63">#63</a>)</li>
<li><a
href="eaf4f5ff47"><code>eaf4f5f</code></a>
Bump to 0.50 (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/56">#56</a>)</li>
<li><a
href="6c7e2627fe"><code>6c7e262</code></a>
gnu_legacy: with GNU, write fg first, else bg first. (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/54">#54</a>)</li>
<li><a
href="f1c83ff292"><code>f1c83ff</code></a>
Rename the LICENCE file to LICENSE (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/51">#51</a>)</li>
<li><a
href="eaa7d7f7e7"><code>eaa7d7f</code></a>
Bump version for 0.49 release (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/49">#49</a>)</li>
<li><a
href="b972a62dce"><code>b972a62</code></a>
Make <code>Style.with_reset</code> more explicit as
<code>prefix_with_reset</code> (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/50">#50</a>)</li>
<li><a
href="b853460c71"><code>b853460</code></a>
Use chaining for <code>AnsiGenericString::hyperlink</code> (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/48">#48</a>)</li>
<li><a
href="76e507cecd"><code>76e507c</code></a>
Fix Re-enabling manual Style creation (<a
href="https://redirect.github.com/nushell/nu-ansi-term/issues/47">#47</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/nushell/nu-ansi-term/compare/v0.46.0...v0.50.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=nu-ansi-term&package-manager=cargo&previous-version=0.46.0&new-version=0.50.1)](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-22 16:05:56 +00:00
dependabot[bot]
1c7ffb79ce build(deps): Bump serde_json from 1.0.129 to 1.0.132 in /rust (#7114)
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.129 to
1.0.132.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/serde-rs/json/releases">serde_json's
releases</a>.</em></p>
<blockquote>
<h2>1.0.132</h2>
<ul>
<li>Improve binary size and compile time for JSON array and JSON object
deserialization by about 50% (<a
href="https://redirect.github.com/serde-rs/json/issues/1205">#1205</a>)</li>
<li>Improve performance of JSON array and JSON object deserialization by
about 8% (<a
href="https://redirect.github.com/serde-rs/json/issues/1206">#1206</a>)</li>
</ul>
<h2>1.0.131</h2>
<ul>
<li>Implement Deserializer and IntoDeserializer for <code>Map&lt;String,
Value&gt;</code> and <code>&amp;Map&lt;String, Value&gt;</code> (<a
href="https://redirect.github.com/serde-rs/json/issues/1135">#1135</a>,
thanks <a
href="https://github.com/swlynch99"><code>@​swlynch99</code></a>)</li>
</ul>
<h2>1.0.130</h2>
<ul>
<li>Support converting and deserializing <code>Number</code> from i128
and u128 (<a
href="https://redirect.github.com/serde-rs/json/issues/1141">#1141</a>,
thanks <a
href="https://github.com/druide"><code>@​druide</code></a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="86d933cfd7"><code>86d933c</code></a>
Release 1.0.132</li>
<li><a
href="f45b422a3b"><code>f45b422</code></a>
Merge pull request <a
href="https://redirect.github.com/serde-rs/json/issues/1206">#1206</a>
from dtolnay/hasnext</li>
<li><a
href="f2082d2a04"><code>f2082d2</code></a>
Clearer order of comparisons</li>
<li><a
href="0f54a1a0df"><code>0f54a1a</code></a>
Handle early return sooner on eof in seq or map</li>
<li><a
href="2a4cb44f7c"><code>2a4cb44</code></a>
Rearrange 'match peek'</li>
<li><a
href="4cb90ce66d"><code>4cb90ce</code></a>
Merge pull request <a
href="https://redirect.github.com/serde-rs/json/issues/1205">#1205</a>
from dtolnay/hasnext</li>
<li><a
href="b71ccd2d8f"><code>b71ccd2</code></a>
Reduce duplicative instantiation of logic in SeqAccess and
MapAccess</li>
<li><a
href="a810ba9850"><code>a810ba9</code></a>
Release 1.0.131</li>
<li><a
href="0d084c5038"><code>0d084c5</code></a>
Touch up PR 1135</li>
<li><a
href="b4954a9561"><code>b4954a9</code></a>
Merge pull request <a
href="https://redirect.github.com/serde-rs/json/issues/1135">#1135</a>
from swlynch99/map-deserializer</li>
<li>Additional commits viewable in <a
href="https://github.com/serde-rs/json/compare/1.0.129...1.0.132">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=serde_json&package-manager=cargo&previous-version=1.0.129&new-version=1.0.132)](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-22 15:42:09 +00:00
Thomas Eizinger
73eebd2c4d refactor(rust): consistently record errors as tracing::Value (#7104)
Our logging library, `tracing` supports structured logging. This is
useful because it preserves the more than just the string representation
of a value and thus allows the active logging backend(s) to capture more
information for a particular value.

In the case of errors, this is especially useful because it allows us to
capture the sources of a particular error.

Unfortunately, recording an error as a tracing value is a bit cumbersome
because `tracing::Value` is only implemented for `&dyn
std::error::Error`. Casting an error to this is quite verbose. To make
it easier, we introduce two utility functions in `firezone-logging`:

- `std_dyn_err`
- `anyhow_dyn_err`

Tracking errors as correct `tracing::Value`s will be especially helpful
once we enable Sentry's `tracing` integration:
https://docs.rs/sentry-tracing/latest/sentry_tracing/#tracking-errors
2024-10-22 04:46:26 +00:00
Gabi
2976081bc0 chore(connlib): use tcp and udp packets for proptests (#7064)
Currently, tests only send ICMP packets back and forth, to expand our
coverage and later on permit us cover filters and resource picking this
PR implements sending UDP and TCP packets as part of that logic too.

To make this PR simpler in this stage TCP packets don't track an actual
TCP connection, just that they are forwarded back and forth, this will
be fixed in a future PR by emulating TCP sockets.

We also unify how we handle CIDR/DNS/Non Resources to reduce the number
of transitions.

Fixes #7003

---------

Signed-off-by: Gabi <gabrielalejandro7@gmail.com>
Co-authored-by: Thomas Eizinger <thomas@eizinger.io>
2024-10-22 01:21:40 +00:00
Thomas Eizinger
fa13d11013 chore(connlib): downgrade log-level for unchanged TUN config (#7106)
This is otherwise really noise in debug output and doesn't offer much.
2024-10-21 21:51:54 +00:00
Thomas Eizinger
2f712d2651 chore(gateway): bump log severity (#7101)
This log should only ever happen if clients are buggy or someone is
using a custom client. Thus worth a `warn`.

Follow-up from #6941.
2024-10-21 21:39:56 +00:00
Thomas Eizinger
b8f5fb9e25 chore(connlib): fix proptest failure with TCP DNS (#7093)
When we query upstream DNS servers through the tunnel via TCP DNS, we
will always be successful in establishing a tunnel, regardless of how
many concurrent queries we send because the TCP stack will keep
re-trying. Thus, tracking, which resources we are connected to after
sending a bunch of DNS queries needs to be split by UDP and TCP.

For UDP, only the "first" resource will be connected, however, with
concurrent TCP and UDP DNS queries, "first" isn't necessarily the order
in which we send the queries because with TCP DNS, one packet doesn't
equate to one query anymore.

This is quite hacky but it will get completely deleted once we buffer
packets during the connection setup.
2024-10-19 00:02:00 +00:00
Thomas Eizinger
ce1e59c9fe feat(connlib): implement idempotent control protocol for gateway (#6941)
This PR implements the new idempotent control protocol for the gateway.
We retain backwards-compatibility with old clients to allow admins to
perform a disruption-free update to the latest version.

With this new control protocol, we are moving the responsibility of
exchanging the proxy IPs we assigned to DNS resources to a p2p protocol
between client and gateway. As a result, wildcard DNS resources only get
authorized on the first access. Accessing a new domain within the same
resource will thus no longer require a roundtrip to the portal.

Overall, users will see a greatly decreased connection setup latency. On
top of that, the new protocol will allow us to more easily implement
packet buffering which will be another UX boost for Firezone.
2024-10-18 15:59:47 +00:00
Thomas Eizinger
9de1119b69 feat(connlib): support DNS over TCP (#6944)
At present, `connlib` only supports DNS over UDP on port 53. Responses
over UDP are size-constrained on the IP MTU and thus, not all DNS
responses fit into a UDP packet. RFC9210 therefore mandates that all DNS
resolvers must also support DNS over TCP to overcome this limitation
[0].

Handling UDP packets is easy, handling TCP streams is more difficult
because we need to effectively implement a valid TCP state machine.

Building on top of a lot of earlier work (linked in issue), this is
relatively easy because we can now simply import
`dns_over_tcp::{Client,Server}` which do the heavy lifting of sending
and receiving the correct packets for us.

The main aspects of the integration that are worth pointing out are:

- We can handle at most 10 concurrent DNS TCP connections _per defined
resolver_. The assumption here is that most applications will first
query for DNS records over UDP and only fall back to TCP if the response
is truncated. Additionally, we assume that clients will close the TCP
connections once they no longer need it.
- Errors on the TCP stream to an upstream resolver result in `SERVFAIL`
responses to the client.
- All TCP connections to upstream resolvers get reset when we roam, all
currently ongoing queries will be answered with `SERVFAIL`.
- Upon network reset (i.e. roaming), we also re-allocate new local ports
for all TCP sockets, similar to our UDP sockets.

Resolves: #6140.

[0]: https://www.ietf.org/rfc/rfc9210.html#section-3-5
2024-10-18 03:40:50 +00:00
Thomas Eizinger
3365981e1b chore(rust): bump Rust to 1.82 and run cargo update (#7086)
I decided to throw in a `cargo update` as well to bump some of the Git
dependencies.
2024-10-17 22:33:31 +00:00