Commit Graph

51 Commits

Author SHA1 Message Date
Alexandr Stelnykovych ab5ef3dedc feat(spn/navigator): note when debug output does not apply to this node
Add a note to the measurements and optimization tables on clients, and
to the route simulation on hubs.
2026-11-20 16:00:18 +02:00
Alexandr Stelnykovych 809ad61c42 feat(spn/navigator): add port and protocol to route simulation
Without a port or protocol, rules with a port never matched, so hubs
whose exit policy allows only some ports were always disregarded.

- Add "port" and "protocol" query parameters; parse "encrypted"
  (default: derived from the port, as the firewall does).
- Move the encrypted port list to netutils.IsEncryptedPort.
- Show the simulation inputs and what is not simulated.
- Note that routes do not apply with the "home" routing algorithm.
- Fix the disclaimer and the Connection.Encrypted comment.

Example:
  http://127.0.0.1:817/api/v1/spn/map/main/route/to/example.com?profile=global&port=443&protocol=tcp&encrypted=true
2026-11-20 14:23:16 +02:00
Alexandr Stelnykovych 3fa8d3a55d docs(spn): add doc comments to the main SPN flow functions
Comments only, no code changes.
2026-11-17 14:36:13 +02:00
Alexandr Stelnykovych cc164c7df6 spn/ships: bound HTTP ship handshake and abort it on ctx done
After the TCP connect, launchHTTPShip wrote the upgrade request and read
the response without a deadline, ignoring ctx. With keep-alive disabled,
a peer that accepts the connection but never answers blocked the caller
forever. After a sleep/resume cycle this left the SPN client stuck in
establishHomeHub: the 5 minute timeout in connectToHomeHub had no effect,
and the UI kept showing "Connecting to SPN..." until a restart.

Bound the handshake by a deadline of 30s, or the ctx deadline if that is
earlier, and close the connection when ctx is done. Both are lifted once
the handshake succeeds, so the ship's connection is unaffected.

Also close the connection on all handshake error paths, which previously
leaked it.

The new test covers a peer that accepts but never responds, for both a
ctx deadline and a ctx cancel.
2026-10-21 14:34:40 +03:00
Alexandr Stelnykovych 989175aab4 feat(UI): implement "Open Data Directory" in the Tauri app
Related ticket: #1834

The Tauri integration never implemented the action: the install dir
lookup rejected with "not yet supported", the rejection was unhandled,
and the shell plugin would not open local paths from JS anyway. The app
also cannot know the data directory from its arguments, as --data is not
passed on Windows and points to the v1 location on Linux.

Add a read-only core/paths endpoint to the core API (bin, data and log
directories) and an open_dir command in the Tauri app that takes a
directory kind (bin, data, logs), queries the endpoint and opens the
directory natively: ShellExecuteW with the default verb on Windows,
which honors a third-party file manager registered for folders, and
the open crate elsewhere. No path is accepted from the webview, and
further "open directory" actions only need UI changes.
2026-10-01 13:06:55 +03:00
Alexandr Stelnykovych 57a90a5744 test(spn/cabin): fix public hub config registration order
conf.EnablePublicHub(true) was called after module.Start(), so prep()
never registered the public hub config options. This caused TestIdentity
to fail with "config already initialized" and TestVerification/
TestKeyMaintenance to panic on nil function pointers.

Move EnablePublicHub(true) to the top of runTest, matching the pattern
used by all other SPN test packages (crew, docks, terminal), and remove
the now-redundant prepPublicHubConfig() call from TestIdentity.

Broken by 8f9dcd592 which added a strict guard to config.Register().
2026-08-13 18:03:22 +03:00
Alexandr Stelnykovych 2d5628a309 feat(UI): add Split Tunneling feature card
- Replace "Safing Support" feature with Split Tunneling in features.go,
  using a dedicated config key/scope and free package tier
- Fix feature-card component to prioritize ConfigKey over ConfigScope
  when resolving the config lookup key
2026-05-12 18:00:06 +03:00
Alexandr Stelnykovych 2252fd17ed ivpn/linux: route SPN hub traffic around VPN tunnel (split tunnel)
Add a synchronous HookMgr[T] that lets callers register pre-connect
hooks before SPN dials a home hub. The IVPN interop layer subscribes
to this hook and uses Linux ip-rule/ip-route to steer SPN hub IPs
through a dedicated routing table (717) pointing to the non-VPN default
gateway, preventing SPN control traffic from being tunnelled into IVPN.

- service/mgr: add generic HookMgr[T] (synchronous, cancellable)
- spn/captain: expose HookSPNConnecting; invoke it in connectToHomeHub
- service/netenv: add GatewayInfo + GatewaysInfo() with interface/mask
- service/interop/ivpn: add ensureSpnHubBypassVpnRoutes managing policy
  routing; call it from the SPN pre-connect hook and on VPN stop/connect
- nfq/packet: add hex comments next to mark constants

https://github.com/safing/portmaster-shadow/issues/34
2026-03-26 23:20:34 +02:00
Alexandr Stelnykovych d5d47223b4 fix(spn): Ensure intel data is initialized
Prevent intel remaining uninitialized, which caused SPN to fail to bootstrap on connect.
https://github.com/safing/portmaster/issues/2095
2025-12-09 14:28:48 +02:00
Alexandr Stelnykovych 2c6a1a993c fix: Ensure error handling during SPN intel initialization 2025-09-03 12:31:25 +03:00
Alexandr Stelnykovych 7a95b021a5 fix: Prevent unintended use of SPN nodes when intel data is not yet applied
Related Issue Details:
In some situations, SPN intel data was not fully applied.
This lead to Portmaster making connections that don’t align with the intended intel preferences.

https://github.com/safing/portmaster/issues/1999
https://github.com/safing/portmaster-shadow/issues/35
2025-09-02 18:26:34 +03:00
Alexandr Stelnykovych d67c8e9a04 fix: Ensure intel data for the main SPN map is initialized before Portmaster starts an SPN connection
Related Issue Details:
In some situations, SPN intel data was not fully applied.
This lead to Portmaster making connections that don’t align with the intended intel preferences.

https://github.com/safing/portmaster/issues/1999
https://github.com/safing/portmaster-shadow/issues/35
2025-09-02 18:24:50 +03:00
Alexandr Stelnykovych 58f4058633 v2 tests fix (#1956)
* v2 tests fix
* test: added tests for sqlite
2025-08-07 02:04:38 +03:00
Alexandr Stelnykovych 5d37c126bc Fixed SPN re-initialization
https://github.com/safing/portmaster/issues/1872
2025-06-26 17:14:57 +03:00
Natanael Rodriguez Ramos 4c6da554f1 fix(spn-hub): Added logging directory on V2 install script 2025-05-29 12:16:24 +01:00
Natanael Rodriguez Ramos cf75e90ea8 Merge branch 'v2.0' into task/refactor-spn 2025-05-28 11:41:10 +01:00
Natanael Rodriguez Ramos dff43809e2 Updated spn-hub install script to remove portmaster-start dependency. 2025-05-28 11:40:15 +01:00
Alexandr Stelnykovych ec2d4ca9eb Merge branch 'master' into merge/master-into-v2-with-history (v1 into v2)
# Conflicts:
#	Earthfile
#	base/config/main.go
#	base/database/dbmodule/db.go
#	base/database/main.go
#	go.mod
#	go.sum
#	service/core/base/global.go
2025-05-28 11:52:15 +03:00
Natanael Rodriguez Ramos 25c1504771 Updated spn-hub install script to remove portmaster-start dependency. 2025-05-24 17:57:02 +01:00
Natanael Rodriguez Ramos 2444209834 Updated spn-hub to remove teh portmaster-start dependency. 2025-05-24 17:40:15 +01:00
Natanael Rodriguez Ramos 846646c7e9 task(spn): added missing instance method from interface 2025-04-14 09:57:14 +01:00
Natanael Rodriguez Ramos 7d33aaff89 Enable SPN auto download/apply 2025-04-11 12:15:53 +01:00
Natanael Rodriguez Ramos d828aacd0f Fixed SPN HUB using wrong instance 2025-04-10 17:07:48 +01:00
Alexandr Stelnykovych fe8a560f9e [fix] Improve sticky domain handling in getStickiedHub function 2025-02-24 17:50:41 +02:00
Vladimir Stoilov 49e1fc8c31 [service] Ensure pemission for all directories 2025-01-15 11:43:14 +02:00
Vladimir Stoilov 5039e9efca Merge branch 'develop' into feature/new-installer 2025-01-14 16:59:21 +02:00
Daniel 96209c28cf Fix SPN build 2025-01-13 10:09:11 +01:00
Daniel ef7b129ced Use code quotes for cmds in docs 2024-12-20 13:37:01 +01:00
Daniel 1e9e6263d4 Fix SPN testnet portmaster args 2024-12-20 13:36:15 +01:00
Daniel c7f3475382 Add spn testing setup 2024-12-20 13:31:52 +01:00
Daniel 706ce222d0 WIP 2024-11-27 16:16:15 +01:00
Daniel f91003d077 [service] Move logging to the core, remove pkg level logs 2024-11-14 17:33:27 +01:00
Daniel ddf7ba170e Fix tests and issues 2024-11-08 14:39:58 +01:00
Daniel c22814e6e1 Improve start and shutdown controls and flow 2024-11-07 16:20:58 +01:00
Daniel 7bc1c3b764 Replace dataroot module with BinDir and DataDir on instance, adapt modules 2024-11-06 10:48:02 +01:00
Daniel 0f3f3c360f [WIP] Simplify update system 2024-10-31 16:38:12 +01:00
Vladimir Stoilov a874ec9412 [WIP] Fix unit tests 2024-10-08 14:13:08 +03:00
Vladimir Stoilov a8517cd65f [WIP] Fix minor bugs 2024-10-08 09:47:29 +03:00
Vladimir Stoilov 61babe2822 [WIP] Add restart command to instance 2024-09-26 13:51:42 +03:00
Vladimir Stoilov 84a15b5fb3 [WIP] updater rafactoring, minor improvments 2024-09-17 12:36:44 +03:00
Vladimir Stoilov 701505ae75 [WIP] working download and replace. 2024-09-05 10:25:57 +03:00
Vladimir Stoilov 9bae1afd73 [WIP] New updater first working prototype 2024-09-05 10:25:57 +03:00
Daniel 78e4a40750 [service] Fix SPN build 2024-08-28 11:50:45 +02:00
Daniel 7f0b5ca149 [service] Fix starting and stopping of SPN 2024-08-27 16:42:22 +02:00
Daniel Hååvi 80664d1a27 Restructure modules (#1572)
* Move portbase into monorepo

* Add new simple module mgr

* [WIP] Switch to new simple module mgr

* Add StateMgr and more worker variants

* [WIP] Switch more modules

* [WIP] Switch more modules

* [WIP] swtich more modules

* [WIP] switch all SPN modules

* [WIP] switch all service modules

* [WIP] Convert all workers to the new module system

* [WIP] add new task system to module manager

* [WIP] Add second take for scheduling workers

* [WIP] Add FIXME for bugs in new scheduler

* [WIP] Add minor improvements to scheduler

* [WIP] Add new worker scheduler

* [WIP] Fix more bug related to new module system

* [WIP] Fix start handing of the new module system

* [WIP] Improve startup process

* [WIP] Fix minor issues

* [WIP] Fix missing subsystem in settings

* [WIP] Initialize managers in constructor

* [WIP] Move module event initialization to constrictors

* [WIP] Fix setting for enabling and disabling the SPN module

* [WIP] Move API registeration into module construction

* [WIP] Update states mgr for all modules

* [WIP] Add CmdLine operation support

* Add state helper methods to module group and instance

* Add notification and module status handling to status package

* Fix starting issues

* Remove pilot widget and update security lock to new status data

* Remove debug logs

* Improve http server shutdown

* Add workaround for cleanly shutting down firewall+netquery

* Improve logging

* Add syncing states with notifications for new module system

* Improve starting, stopping, shutdown; resolve FIXMEs/TODOs

* [WIP] Fix most unit tests

* Review new module system and fix minor issues

* Push shutdown and restart events again via API

* Set sleep mode via interface

* Update example/template module

* [WIP] Fix spn/cabin unit test

* Remove deprecated UI elements

* Make log output more similar for the logging transition phase

* Switch spn hub and observer cmds to new module system

* Fix log sources

* Make worker mgr less error prone

* Fix tests and minor issues

* Fix observation hub

* Improve shutdown and restart handling

* Split up big connection.go source file

* Move varint and dsd packages to structures repo

* Improve expansion test

* Fix linter warnings

* Fix interception module on windows

* Fix linter errors

---------

Co-authored-by: Vladimir Stoilov <vladimir@safing.io>
2024-08-09 18:15:48 +03:00
Daniel 0d2c556e20 Fix SPN info page data 2024-04-10 15:14:09 +02:00
Daniel 5215e41624 Increase SPN clock skew tolerance to better support devices with skewed clock 2024-04-10 14:09:45 +02:00
Daniel c2cbd27b8a Fix error handling in connect op 2024-03-29 11:20:45 +01:00
Patrick Pacher 61176af14e Fix linting errors 2024-03-27 16:17:58 +01:00
Patrick Pacher b2acbe38d2 spn: fix http info page template 2024-03-27 15:04:47 +01:00