Commit Graph

6626 Commits

Author SHA1 Message Date
Thomas Eizinger
deb47d956e chore(gateway): remove log around "No NAT session" (#8227)
This is pretty confusing when reading logs. For inbound packets, we
assume that if we don't have a NAT session, they belong to the Internet
Resource or a CIDR resource, meaning this log shows up for all packets
for those resources and even for packets that don't belong to any
resource at all.
2025-02-21 05:24:59 +00:00
Thomas Eizinger
b10b6e75ea fix(gui-client): hide the .desktop entry for deep-links (#8224)
On Linux desktops, we install a dedicated `.desktop` file that is
responsible for handling our deep-links for sign-in. This desktop entry
is not meant to be launched manually and therefore should be hidden from
the application menus.
2025-02-21 05:19:19 +00:00
Jamil
31e7aef77a revert: loading NSImage asynchronously (#8215)
Loading images async isn't fixing the App Hanging reports we continue to
receive, so it's something else. Rather than trying to load them
asynchronously, we revert that change.

We instead eager-load all images needed by the MenuBar at init instead
of lazy-loading them, which in rare cases could cause apparent UI hangs.
If we can't load them we log an error but continue to try an operate, as
the icons are not strictly needed for Firezone operation.


Reverts firezone/firezone#8090
2025-02-20 23:41:39 +00:00
Jamil
0ae74fe126 refactor(apple): Don't initialize Favorites twice (#8216)
For some reason, this was being initialized twice, when it doesn't need
to be.

The whole reason Favorites is initialized in the FirezoneApp module is
so we can have one instance of it passed down to children.
2025-02-20 21:27:52 +00:00
Jamil
a07f1725c6 chore(portal): Refactor GCP labels logger to relax sentry alerts (#8213) 2025-02-20 11:20:45 +00:00
Thomas Eizinger
6f68b97558 chore(gui-client): release v1.4.6 (#8211) 2025-02-20 04:25:38 +00:00
Thomas Eizinger
d5fdb5fda8 test(connlib): remove assertion around idle packets / sec (#8210)
This has been flaky recently but it isn't a priority right now.
2025-02-20 01:33:18 +00:00
Thomas Eizinger
81da120c17 fix(phoenix-channel): report connection hiccups to upper layer (#8203)
The WebSocket connection to the portal from within the Clients, Gateways
and Relays may be temporarily interrupted by IO errors. In such cases we
simply reconnect to it. This isn't as much of a problem for Clients and
Gateways. For Relays however, a disconnect can be disruptive for
customers because the portal will send `relays_presence` events to all
Clients and Gateways. Any relayed connection will therefore be
interrupted. See #8177.

Relays run on our own infrastructure and we want to be notified if their
connection flaps.

In order to differentiate between these scenarios, we remove the logging
from within `phoenix-channel` and report these connection hiccups one
layer up. This allows Clients and Gateways to log them on DEBUG whereas
the Relay can log them on WARN.

Related: #8177 
Related: #7004
2025-02-20 00:54:43 +00:00
Thomas Eizinger
cad84922db fix(apple): don't panic in FFI functions (#8202)
Now that we have error reporting via Sentry in Swift-land as well, we
can handle errors in the FFI layer more gracefully and return them to
Swift.

---------

Signed-off-by: Jamil <jamilbk@users.noreply.github.com>
Co-authored-by: Jamil <jamilbk@users.noreply.github.com>
2025-02-20 00:51:56 +00:00
Jamil
2dae8bd656 fix(portal): move rename index before create internet site (#8209)
Otherwise prod won't run this migration...
2025-02-19 16:10:24 -08:00
Jamil
407085d7ec fix(portal): Add managed_by to gateway groups index (#8208)
Some customers have already picked the `Internet` name, which is making
our migrations fail.

This scopes the unique name index by `managed_by` so that our attempts
to create them succeed.
2025-02-19 15:55:51 -08:00
Jamil
80210a5093 fix(portal): fix typo on settings -> dns page (#8207) 2025-02-19 15:41:34 -08:00
Jamil
03558a5899 feat(website): Internet resource migration blogpost (#8150)
This is an announcement we will be linking to.
2025-02-19 15:28:52 -08:00
Jamil
9a2f2c0fa6 fix(infra): Add missing naming suffix to lb ingress (#8206)
Adds a naming_suffix I left out on the relays module.
2025-02-19 15:13:04 -08:00
Jamil
96ae1117dc fix(infra): Revert to plural relays module to avoid downtime (#8201)
Turns out that if we change the module structure at all, Terraform will
delete all the old resources contained within it before creating new
ones, because modules don't accept a `lifecycle` block. The old
resources are deemed no longer "needed" and so `create_before_destroy`
doesn't save us.

This updates the ref to environments that contains a reverting back to
the plural `module.relays[0]` structure.

The way to get around this is going to have to be to duplicate the
existing relays module, `terraform apply` to bring those up, and then
remove the old module. That is saved for a later PR.

This has been tested to achieve near-zero downtime on staging.
2025-02-19 21:45:21 +00:00
Jamil
762f16bfea fix(infra): create_before_destroy for all Relay resources (#8198)
When making any modification that taints any Relay infrastructure, some
Relay components are destroyed before they're created, and some are
created before they're destroyed.

This results in failures that can lead to downtime, even if we bump
subnet numbering to trigger a rollover of the `naming_suffix`. See
https://app.terraform.io/app/firezone/workspaces/staging/runs

To fix this, we ensure `create_before_destroy` is applied to all Relay
module resources, and we ensure that the `naming_suffix` is properly
used in all resources that require unique names or IDs within the
project.

Thus, we need to remember to make sure to bump subnet numbering whenever
changing any Relay infrastructure so that: (1) the subnet numbering
doesn't collide, and (2) to trigger the `naming_suffix` change which
prevents other resource names from colliding.

Unfortunately there doesn't seem to be a better alternative here. The
only other alternative I could determine as of now is to derive the
subnet numbering dynamically on each deploy, incrementing them, which
would taint all Relay resources upon each and every deploy, which is
wasteful and prone to random timeouts or failures.
2025-02-19 07:10:12 -08:00
Jamil
0346d13627 docs: Update viewing logs for Linux GUI and Windows headless (#8192) 2025-02-19 10:27:17 +00:00
Jamil
bb999b73f3 chore(infra): bump tf environments to fast-forward (#8197)
This will perform the final staging test that will ensure the pending
prod deploy will work smoothly.
2025-02-19 00:36:12 -08:00
Jamil
0c324139e5 revert: staging env to pre-relay changes (#8196)
This is needed to test a full rollout of the recent infra changes to
ensure zero-downtime will be achieved when going out to prod soon.
2025-02-18 23:36:06 -08:00
Jamil
d1de22e7cc fix(infra): Keep reservation names in sync (#8194) 2025-02-18 22:40:48 -08:00
Jamil
63c3529aa4 fix(infra): Bump tf environments to fix relays ssh (#8193)
See firezone/environments#4
2025-02-18 21:42:32 -08:00
Jamil
39e302f3b7 fix(infra): Add naming suffix to relay compute reservations (#8190)
Unfortunately relay reservations need the naming suffix as well because
they require unique names in the project and `create_before_destroy` is
taking effect.


https://app.terraform.io/app/firezone/workspaces/staging/runs/run-kfD9JtvTZEsXnfzA
2025-02-18 19:48:02 -08:00
Jamil
0f4f20bd9c fix(elixir): Fix conditional in sentry clase in runtime.exs (#8188) 2025-02-18 17:50:18 -08:00
Jamil
6232f1a27e fix(elixir): Don't start sentry in unknown environments (#8185)
This ensures Sentry doesn't start in unknown `prod` environments.
2025-02-18 17:24:26 -08:00
Jamil
1930678c0d chore(infra): Make Relays module singular (#8184)
Related: firezone/environments#1
2025-02-19 00:53:00 +00:00
Jamil
28559a317f chore(portal): Optionally drop NotFoundError to sentry (#8183)
By specifying the `before_send` hook, we can easily drop events based on
their data, such as `original_exception` which contains the original
exception instance raised.

Leveraging this, we can add a `report_to_sentry` parameter to
`Web.LiveErrors.NotFound` to optionally ignore certain not found errors
from going to Sentry.
2025-02-18 21:55:23 +00:00
Jamil
d99508ead5 chore(infra): Move terraform/environments to submodule (#8168)
This moves our current GCP infra to a new firezone/environments repo.
The existing Git history is preserved, and CI config is updated to clone
this submodule before running any terraform jobs.
2025-02-18 14:01:13 +00:00
Thomas Eizinger
3e4976e4ab fix(relay): don't starve items further down in the event-loop (#8177)
At present, the relay uses a priority in the event-loop that favors
routing traffic. Whenever a task further up in the loop is
`Poll::Ready`, we loop back to the top to continue processing. The issue
with that is that in very busy times, this can lead to starvation in
processing timers and messages from the portal. If we then finally get
to process portal messages, we think that the portal hasn't replied in
some time and proactively cut the connection and reconnect.

As a result, the portal will send `relays_presence` messages to the
clients and gateways which in turn will locally remove the relay. This
breaks relayed connections.

To fix this, instead of immediately traversing to the top of the
event-loop with `continue`, we only set a boolean. This gives each
element of the event-loop a chance to execute, even when a certain
component is very busy.

Related: #8165
Related: #8176
2025-02-18 12:00:32 +00:00
Thomas Eizinger
2e43523f75 fix(snownet): servers should not initiate WireGuard sessions (#8169)
Whilst ICE for a connection is in progress, it might happen that packets
for a particular client are arriving at the Gateway's TUN device. I
assume that these might be from a previous session?

We can only negotiate a WireGuard session once we have a nominated
socket. Thus, the very first packet sent on a session will always
trigger a new handshake. We don't want Gateway's to start handshakes
though, those should always be initiated by the Clients.

To avoid this, we add a conditional to `snownet::Node` that drops
packets iff the current node is a `ServerNode` and we haven't nominated
a socket yet.

The following log output from a Gateway motivated this change:

```
2025-02-17T15:36:45.372Z  INFO snownet::node: Connection failed (ICE timeout) cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5

// Here the previous connection failed.

2025-02-17T15:36:45.989Z DEBUG firezone_tunnel::gateway: Unknown client, perhaps already disconnected? dst=100.64.69.110
2025-02-17T15:36:45.989Z DEBUG firezone_tunnel::gateway: Unknown client, perhaps already disconnected? dst=100.64.69.110
2025-02-17T15:36:45.989Z DEBUG firezone_tunnel::gateway: Unknown client, perhaps already disconnected? dst=100.64.69.110
2025-02-17T15:36:46.213Z DEBUG firezone_tunnel::gateway: Unknown client, perhaps already disconnected? dst=100.64.69.110

// Until here, packets for this client got dropped but now a new connection (for the same IP!) is being created.

2025-02-17T15:36:46.474Z DEBUG snownet::node: Sampled relay rid=b7198983-0cf6-48ba-a459-e7d27ef7d6c9 client_id=8b106344-ba59-4050-8f9a-e2f0bab6e9e5 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.474Z  INFO str0m::ice_::agent: Set local credentials: IceCreds { ufrag: "ipcg", pass: "eyy6s27emu2joisw7aqc7q" } client_id=8b106344-ba59-4050-8f9a-e2f0bab6e9e5 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.474Z  INFO str0m::ice_::agent: Set remote credentials: IceCreds { ufrag: "up5k", pass: "4q6uvhawhcbnhbqrddvy5x" } client_id=8b106344-ba59-4050-8f9a-e2f0bab6e9e5 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.474Z  INFO str0m::ice_::agent: Add local candidate: Candidate(host=10.0.0.4:38621/udp prio=2130706175) client_id=8b106344-ba59-4050-8f9a-e2f0bab6e9e5 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.474Z  INFO str0m::ice_::agent: Add local candidate: Candidate(relay=34.16.221.134:62250/udp prio=37748479) client_id=8b106344-ba59-4050-8f9a-e2f0bab6e9e5 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.474Z  INFO str0m::ice_::agent: Add local candidate: Candidate(relay=[2600:1900:4180:ee3:0:78::]:62250/udp prio=37748735) client_id=8b106344-ba59-4050-8f9a-e2f0bab6e9e5 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.474Z  INFO str0m::ice_::agent: State change (new connection): New -> Checking client_id=8b106344-ba59-4050-8f9a-e2f0bab6e9e5 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.474Z  INFO snownet::node: Created new connection client_id=8b106344-ba59-4050-8f9a-e2f0bab6e9e5 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.475Z  INFO firezone_tunnel::peer: Allowing access to resource client=8b106344-ba59-4050-8f9a-e2f0bab6e9e5 resource=dca3fcc6-b5e0-470a-bc7b-6446cdd03bb3 expires=Some("2025-02-24T15:09:11+00:00") client_id=8b106344-ba59-4050-8f9a-e2f0bab6e9e5

// The connection has been created and very likely another packet has arrived at the TUN interface. This time though, we have an entry in our connection map for this IP and try to route it.

2025-02-17T15:36:46.546Z DEBUG boringtun::noise: Sending handshake_initiation cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.546Z DEBUG snownet::node: ICE is still in progress, buffering WG handshake num_buffered=1 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5

// We buffered the handshake packet. This is only meant to be done by clients.

2025-02-17T15:36:46.572Z  INFO str0m::ice_::agent: Created peer reflexive remote candidate from STUN request: Candidate(prflx=107.197.104.68:49376/udp prio=1862270719) cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.572Z DEBUG str0m::ice_::agent: Created new pair for STUN request: CandidatePair(1-0 prio=162128486503284223 state=Waiting attempts=0 unanswered=0 remote=0 last=None nom=None) cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.574Z  INFO str0m::ice_::agent: Created peer reflexive remote candidate from STUN request: Candidate(prflx=[2600:1700:3ecb:2410:7499:175a:5c9:9bc5]:57622/udp prio=1862270975) cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.574Z DEBUG str0m::ice_::agent: Created new pair for STUN request: CandidatePair(2-1 prio=162129586014912511 state=Waiting attempts=0 unanswered=0 remote=0 last=None nom=None) cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.611Z DEBUG str0m::ice_::pair: Nominated pair: CandidatePair(2-1 prio=162129586014912511 state=Succeeded attempts=1 unanswered=0 remote=2 last=Some(Instant { tv_sec: 286264, tv_nsec: 840170135 }) nom=Nominated) cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.612Z  INFO str0m::ice_::agent: State change (got nomination, still trying others): Checking -> Connected cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.612Z DEBUG snownet::node: Flushing packets buffered during ICE num_buffered=1 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.612Z  INFO snownet::node: Updating remote socket old=None new=Relay { relay: b7198983-0cf6-48ba-a459-e7d27ef7d6c9, dest: [2600:1700:3ecb:2410:7499:175a:5c9:9bc5]:57622 } duration_since_intent=137.48517ms cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5

// The connection has been established and we receive the (forced) handshake initiation by the client. However, we also flushed a handshake initiation.

2025-02-17T15:36:46.612Z DEBUG boringtun::noise: Received handshake_initiation remote_idx=731337473 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.613Z DEBUG boringtun::noise: Sending handshake_response local_idx=185230594 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.613Z DEBUG boringtun::noise: Sending handshake_initiation cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.629Z DEBUG snownet::node: Unknown connection or socket has already been nominated ignored_candidate=candidate:fffeff021b36b51d6f7abdc3 1 udp 50331391 34.94.63.38 55487 typ relay cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.629Z DEBUG snownet::node: Unknown connection or socket has already been nominated ignored_candidate=candidate:fffeff64a52b02479dab9c4 1 udp 1694498559 107.197.104.68 49376 typ srflx cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.629Z DEBUG snownet::node: Unknown connection or socket has already been nominated ignored_candidate=candidate:fffeff7ec9b7a7db40ec1c44 1 udp 2130706175 192.168.1.150 49376 typ host cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.630Z DEBUG snownet::node: Unknown connection or socket has already been nominated ignored_candidate=candidate:ffffff026d81f5c8a4d5600e 1 udp 50331647 2600:1900:4120:521c:0:78:: 55487 typ relay cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.630Z DEBUG snownet::node: Unknown connection or socket has already been nominated ignored_candidate=candidate:ffffff64e2c91c4ff6f343f5 1 udp 1694498815 2600:1700:3ecb:2410:7499:175a:5c9:9bc5 57622 typ srflx cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.630Z DEBUG snownet::node: Unknown connection or socket has already been nominated ignored_candidate=candidate:ffffff7ed64262b110d1f279 1 udp 2130706431 2600:1700:3ecb:2410:7499:175a:5c9:9bc5 57622 typ host cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5

// We are receiving a response for our handshake initiation. Let the fight begin!

2025-02-17T15:36:46.651Z DEBUG boringtun::noise: Received handshake_response local_idx=185230593 remote_idx=731337474 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.651Z DEBUG firezone_gateway::eventloop: Tunnel error: Failed to decapsulate: Failed to decapsulate: UnexpectedPacket
2025-02-17T15:36:46.651Z DEBUG boringtun::noise: Received handshake_initiation remote_idx=731337475 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.652Z DEBUG boringtun::noise: Sending handshake_response local_idx=185230596 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.652Z DEBUG boringtun::noise: Sending handshake_initiation cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.652Z DEBUG boringtun::noise: Received handshake_response local_idx=185230595 remote_idx=731337476 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.652Z DEBUG firezone_gateway::eventloop: Tunnel error: Failed to decapsulate: Failed to decapsulate: UnexpectedPacket
2025-02-17T15:36:46.652Z DEBUG boringtun::noise: Received handshake_initiation remote_idx=731337477 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.653Z DEBUG boringtun::noise: Sending handshake_response local_idx=185230598 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.653Z DEBUG boringtun::noise: Sending handshake_initiation cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.691Z DEBUG boringtun::noise: Received handshake_response local_idx=185230597 remote_idx=731337478 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.691Z DEBUG firezone_gateway::eventloop: Tunnel error: Failed to decapsulate: Failed to decapsulate: UnexpectedPacket
2025-02-17T15:36:46.691Z DEBUG boringtun::noise: Received handshake_initiation remote_idx=731337479 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.692Z DEBUG boringtun::noise: Sending handshake_response local_idx=185230600 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
2025-02-17T15:36:46.692Z  INFO snownet::node: Completed wireguard handshake cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5 duration_since_intent=217.247362ms
2025-02-17T15:36:46.692Z DEBUG firezone_gateway::eventloop: Tunnel error: Failed to decapsulate: Failed to decapsulate: NoCurrentSession
2025-02-17T15:36:46.692Z DEBUG firezone_gateway::eventloop: Tunnel error: Failed to decapsulate: Failed to decapsulate: NoCurrentSession
2025-02-17T15:36:46.692Z DEBUG firezone_gateway::eventloop: Tunnel error: Failed to decapsulate: Failed to decapsulate: NoCurrentSession
2025-02-17T15:36:46.692Z DEBUG firezone_gateway::eventloop: Tunnel error: Failed to decapsulate: Failed to decapsulate: NoCurrentSession
2025-02-17T15:36:46.708Z DEBUG firezone_gateway::eventloop: Tunnel error: Failed to decapsulate: Failed to decapsulate: NoCurrentSession
2025-02-17T15:36:46.731Z DEBUG boringtun::noise: New session session=185230600 cid=8b106344-ba59-4050-8f9a-e2f0bab6e9e5
```

As you can see, with both parties initiating handshakes, they end up
fighting over who should initiate the session.
2025-02-18 08:25:45 +00:00
Thomas Eizinger
2d37cfa264 refactor(snownet): make kind of connection more descriptive (#8167)
When `snownet` establishes a connection to another peer, we may end up
in one of four different connection types:

- `PeerToPeer`
- `PeerToRelay`
- `RelayToPeer`
- `RelayToRelay`

From the perspective of the local node, it only matters whether or not
we are sending data from our local socket or a relay's socket because in
the latter case, we have to encapsulate it in a channel data message.
Hence, at present, we often see logs that say "Direct" but really, we
are talking to a port allocated by the remote on a relay.

We know whether or not the remote candidate is a relay by looking at the
candidates they sent us.

To make our logs more descriptive, we now model out all 4 possibilities
here.
2025-02-18 07:35:50 +00:00
Thomas Eizinger
287068396f chore(snownet): advance backoff after accessing interval (#8175)
When we detect timed-out request to a relay, we print the duration we
were waiting for. Currently, this is offset by one "backoff tick"
because we advance the backoff too early.

Here is a log-output of a test prior to the change:

```
snownet::allocation: Sending BINDING requests to pick active socket relay_socket=V4(127.0.0.1:3478)
handle_timeout{active_socket=None}: snownet::allocation: Request timed out after 1.5s, re-sending id=TransactionId(0x0BFA13E983FEF36EE4877719) method=binding dst=127.0.0.1:3478
handle_timeout{active_socket=None}: snownet::allocation: Request timed out after 2.25s, re-sending id=TransactionId(0x0BFA13E983FEF36EE4877719) method=binding dst=127.0.0.1:3478
handle_timeout{active_socket=None}: snownet::allocation: Request timed out after 3.375s, re-sending id=TransactionId(0x0BFA13E983FEF36EE4877719) method=binding dst=127.0.0.1:3478
handle_timeout{active_socket=None}: snownet::allocation: Request timed out after 3.375s, re-sending id=TransactionId(0x0BFA13E983FEF36EE4877719) method=binding dst=127.0.0.1:3478
handle_timeout{active_socket=None}: snownet::allocation: Backoff expired, giving up id=TransactionId(0x0BFA13E983FEF36EE4877719) method=binding dst=127.0.0.1:3478
```

and with this change:

```
snownet::allocation: Sending BINDING requests to pick active socket relay_socket=V4(127.0.0.1:3478)
handle_timeout{active_socket=None}: snownet::allocation: Request timed out after 1s, re-sending id=TransactionId(0x6C79DD3607DF96806C4A7D8C) method=binding dst=127.0.0.1:3478
handle_timeout{active_socket=None}: snownet::allocation: Request timed out after 1.5s, re-sending id=TransactionId(0x6C79DD3607DF96806C4A7D8C) method=binding dst=127.0.0.1:3478
handle_timeout{active_socket=None}: snownet::allocation: Request timed out after 2.25s, re-sending id=TransactionId(0x6C79DD3607DF96806C4A7D8C) method=binding dst=127.0.0.1:3478
handle_timeout{active_socket=None}: snownet::allocation: Request timed out after 3.375s, re-sending id=TransactionId(0x6C79DD3607DF96806C4A7D8C) method=binding dst=127.0.0.1:3478
handle_timeout{active_socket=None}: snownet::allocation: Backoff expired, giving up id=TransactionId(0x6C79DD3607DF96806C4A7D8C) method=binding dst=127.0.0.1:3478
t
```

There is no functional difference, we were just logging the wrong
duration.
2025-02-18 06:12:52 +00:00
Thomas Eizinger
28f00089b9 test(connlib): increase threshold for idle packets (#8174)
Same as the other day. Currently no bandwidth to look into this but need
to ensure stable CI.
2025-02-18 04:49:07 +00:00
Thomas Eizinger
643347ba0e test(windows): reduce expected BPS of WinTUN benchmark (#8171)
This appears to have regressed in #8159. It is low-priority right now
and we need to unblock a flaky CI so lower the expected BPS and
investigate later.
2025-02-18 03:34:14 +00:00
Jamil
be420810e3 chore(elixir): Check on hackney CVE in a month (#8170)
This looks to have been demoted to a low sev. We aren't affected and
hackney still hasn't released a fixed package, so ignoring for another 3
weeks.
2025-02-18 01:33:20 +00:00
Jamil
7eebc04118 fix(infra): Remove unused ingress Relay UDP ports (#8166)
These are redundant since we explicitly allow STUN/TURN traffic a few
lines up.
2025-02-17 22:50:02 +00:00
Thomas Eizinger
33c707dbf6 feat(windows): introduce dedicated "TUN send" thread (#8159)
Same as done for unix-based operation systems in #8117, we introduce a
dedicated "TUN send" thread for Windows in this PR. Not only does this
move the syscalls and copying of sending packets away from `connlib`'s
main thread but it also establishes backpressure between those threads
properly.

WinTUN does not have any ability to signal that it has space in its send
buffer. If it fails to allocate a packet for sending, it will return
`ERROR_BUFFER_OVERFLOW` [0]. We now handle this case gracefully by
suspending the send thread for 10ms and then try again. This isn't a
great way of establishing back-pressure but at least we don't have any
packet loss.

To test this, I temporarily lowered the ring buffer size and ran a speed
test. In that, I could confirm that `ERROR_BUFFER_OVERFLOW` is indeed
emitted and handled as intended.

[0]: https://git.zx2c4.com/wintun/tree/api/session.c#n267
2025-02-17 20:33:45 +00:00
Thomas Eizinger
2d70a8ed31 test(connlib): create dedicated Internet site (#8153)
To ensure that our test suite represents production as much as possible,
we introduce a dedicated "Internet" site into the `StubPortal` that only
hosts the Internet resource. All other creates resources are assigned to
other sites.
2025-02-17 19:46:32 +00:00
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