2540 Commits

Author SHA1 Message Date
Alex Melan
dd056e006c fix: avoid panics on edge-case input across modules (#1343)
## Summary
- ipv6rwc: validate IPv6 packet length before reading the version nibble
in writePC
- config: guard the BOM check against configs shorter than two bytes
- admin: replace unchecked net.Error type assertion with errors.As;
tolerate empty unix socket paths
- multicast: log and continue on ReadFrom errors instead of panicking;
use checked type assertion on UDPAddr
- mobile: reject negative length in SendBuffer; nil-check AddrForKey in
GetPeersJSON and SummaryForConfig
- admin/get{tree,paths,sessions}: skip entries when AddrForKey returns
nil instead of dereferencing
- core/nodeinfo: validate the requested public key length in
nodeInfoAdminHandler, matching the other proto handlers
- add regression tests for the panic paths

## Why
A handful of error paths and platform-API edge cases reach fixed-size
indexing or unchecked type assertions before any length validation.
Most are reachable only locally (an empty config piped to -useconf,
a 0-byte packet from the mobile bindings, an admin DialTimeout error
that doesn't satisfy net.Error on some platforms), but they crash the
daemon hard. Have them return errors or skip the entry instead.

## Testing
- go test ./...
- go vet ./...
2026-05-12 21:42:57 +01:00
Ascii Moth
2cc8e7506e Allow WebSocket listeners to configure browser origins (#1342)
Adds an `origin` query option for `ws://` listener URLs so peer
operators can
explicitly allow browser-hosted WebSocket clients.

- `ws://host:port` keeps the existing same-origin behavior
- `ws://host:port?origin=demo.example.org` allows that origin host
- `ws://host:port?origin=https://demo.example.org` allows that scheme
and host
- repeated `origin=` parameters allow multiple origin patterns
- `origin=*` intentionally disables origin verification for public
WebSocket
  peer endpoints

## Problem
I've implemented a WASM based browser demo yggdrasil node to found that
it
cannot directly dial any existing public `ws://` or `wss://` peers.

Browsers always include an `Origin` header in WebSocket handshakes, and
the
JavaScript `WebSocket()` constructor does not allow applications to
override or
remove arbitrary handshake headers.  
This means a browser demo served from an origin such as
`http://127.0.0.1:8000` cannot connect to a public peer whose WebSocket
server
only accepts same-origin handshakes.
2026-05-12 21:40:59 +01:00
state-plumber
aaf263957b Change ownership of admin socket before dropping permissions (#1336)
This is to allow access to the socket by members of the group that
permissions are dropped to.
2026-05-12 21:39:55 +01:00
state-plumber
be5daeba7a Add -notifyfd flag for s6-style readiness notification (#1337)
Write a newline to the specified file-descriptor to signal that
yggdrasil is fully initialised and ready.

s6 service startup notifications are described
[here](https://skarnet.org/software/s6/notifywhenup.html).

Related: #1148
2026-04-11 18:10:59 +01:00
Alex Melan
bc72b106b7 fix: reject malformed network input in parsers (#1340)
## Summary
- validate handshake metadata field lengths before fixed-size reads
- reject truncated multicast advertisements before slicing the hash
payload
- add regression tests for malformed and truncated input

## Why
Both parsers currently trust length information from the incoming
payload a bit too much. Malformed network input can reach fixed-size
reads/slices and panic the process instead of being rejected cleanly.

## Testing
- go test ./...
2026-04-11 12:04:12 +01:00
SUNsung
2527290bfd fix core.Logger (#1323)
Fixing typo
50def9362f/src/multicast/multicast.go (L64)

I didn't find anywhere else in the project where gologme was mistakenly
used instead of core.Logger
2026-03-12 10:00:20 +00:00
Revertron
50def9362f Update gomobile bind command for Android build (#1318)
Latest gomobile/ndk for some reason default to API 16, and this leads to
build error.
2026-03-09 09:57:00 +00:00
Neil Alexander
dd1eb6ed92 Add vendored sources to CI packaging workflow 2026-03-01 14:29:41 +00:00
Neil Alexander
b88fec63ff Yggdrasil 0.5.13 v0.5.13 2026-02-24 23:20:59 +00:00
Neil Alexander
dc521be6ac Yggdrasil 0.5.13-RC.2 v0.5.13-RC.2 2026-02-23 22:58:51 +00:00
Neil Alexander
82df3ea9a5 Prevent adding empty peers at runtime
Fixes #1182
2026-02-23 22:55:06 +00:00
Neil Alexander
a4b522288d Remove support for Windows 32-bit ARM
This is no longer supported by Go 1.26.
2026-02-23 22:44:01 +00:00
Neil Alexander
8a513680eb Run go mod tidy 2026-02-23 22:35:02 +00:00
Neil Alexander
2e50c21541 Fix lint issues 2026-02-19 18:00:48 +00:00
Neil Alexander
144235d23a Update dependencies, new tables in yggdrasilctl 2026-02-19 17:56:07 +00:00
Neil Alexander
36b6399bb7 Enable Go 1.26 in CI 2026-02-19 16:12:02 +00:00
Neil Alexander
f3c4cdd89e Yggdrasil 0.5.13-RC.1 v0.5.13-RC.1 2026-01-19 16:36:32 +00:00
Andrei Tregubov
9184cd23e5 Fix outbound link-local connections on mobile (#1300) 2026-01-18 19:12:31 +00:00
Alex
20155a2081 Add windows build file (#1240)
bat file to build in windows

Co-authored-by: SadovovAlex <aasdvv@gmail.com>
2026-01-18 15:06:26 +00:00
Neil Alexander
9e781cc912 Fix lint error 2026-01-18 15:04:28 +00:00
Neil Alexander
aad8c9a9cb Update GHA dependencies 2026-01-18 15:02:52 +00:00
mirefly42
df48ac2ada Fix default config permissions (#1253)
Currently, all init scripts, except for systemd, will generate a config
file with default permissions, which is usually `rw-r--r--`.
This is bad, because the config contains a private key.

The systemd service does `chmod 640` after creating the config, which is
much better than just leaving it readable for everyone forever, but
there is still a slight chance that some malicious program might steal
the private key during the time window between key creation and chmod.

For this reason, in this pull request I use `umask 037`, so the config
won't have read permission for others in the first place.

Note that I have only tested openrc and systemd services.

Also, I'm not sure what to do with the contrib/msi/build-msi.sh script,
which creates a bat file that generates a config. I don't know anything
about file permissions on windows, however, it seems that the bat file
generates the config into a user's personal directory, so maybe it's
already somewhat fine.
2026-01-18 14:58:00 +00:00
Neil Alexander
fd46eab3b9 Linter update & fixes 2026-01-18 14:51:52 +00:00
Neil Alexander
24482b7dbe Run go fix, corrects mostly build tags 2026-01-18 14:47:18 +00:00
Neil Alexander
f7c6c9e1c5 Revert tablewriter update as breaking 2026-01-18 12:03:07 +00:00
Sergey Alirzaev
33831f606f core: removed unused addPeerTimer code
Resolves #1279
2026-01-18 11:57:27 +00:00
Revertron
962adc2994 Update yggdrasil.service.debian (#1290)
Can't start service without reading config.
Without explicit allow directive it can't read it.
2026-01-18 11:50:51 +00:00
Neil Alexander
84b1f4a96b Update dependencies 2026-01-18 11:48:43 +00:00
Neil Alexander
75e4c9287e Adjust how cost is used to behave more intuitively
Co-authored-by: Arceliar <Arceliar@users.noreply.github.com>
2026-01-18 11:42:00 +00:00
Neil Alexander
ae405adf7c Update to Arceliar/ironwood@e1358f7905 to reduce heap allocations 2025-11-24 09:29:15 +00:00
Neil Alexander
bde65aa239 Fix backpressure issue when TUN is disabled 2025-11-23 22:06:25 +00:00
Neil Alexander
b43e213c32 Don't re-attempt connections when detecting a connection to self
Closes #1286.
2025-11-11 23:18:56 +00:00
Neil Alexander
b920e17f24 Do not report error in getPeers before it has happened 2025-11-11 23:18:37 +00:00
Neil Alexander
a2272a0216 Tweak lint step to checkout first 2025-11-10 19:53:22 +00:00
Neil Alexander
aafe751545 Use go.mod-specified Go version for lint step 2025-11-10 19:52:00 +00:00
Neil Alexander
56044b822b Fix build issues from QUIC dependency update 2025-11-10 19:48:01 +00:00
Neil Alexander
1e48a4c4c9 Update to Go 1.24 minimum, update dependencies 2025-11-10 19:44:37 +00:00
Neil Alexander
306c4c624b Add sort= option to getPeers (uptime, cost or default if not specified)
Signed-off-by: Neil Alexander <neilalexander@users.noreply.github.com>
2025-11-09 23:39:22 +00:00
Neil Alexander
d0b5352db3 Tweak Docker tags 2025-10-04 10:55:45 +01:00
Dmitriy Pervin
284894fe40 Add multi-arch Docker build & GHCR publishing (#1278)
# Summary
This PR addresses failures to run Yggdrasil on ARM systems. The root
cause was the lack of ARM artifacts/images, which led to exec format
error and similar issues.

## What’s added:
- ```Dockerfile.multiarch``` — multi-stage Go build that correctly
propagates GOOS/GOARCH for linux/amd64, linux/arm64, linux/armhf and
linux/armel platform.
- ```entrypoint.sh``` - Introduced ENV **ALLOW_IPV6_FORWARDING**. When
set to a truthy value (e.g., true), the entrypoint executes: ```sysctl
-w net.ipv6.conf.all.forwarding=1```.
- GitHub Action for multi-arch builds and publishing to GHCR — triggered
via ```workflow_dispatch```, push to ```master``` and release via tags
(with docker semantic tags e.g. v0.5.12 → 0.5.12, 0.5, 0).

Example published images:

[https://github.com/Forne/yggdrasil-go/pkgs/container/yggdrasil-go](https://github.com/Forne/yggdrasil-go/pkgs/container/yggdrasil-go)

## Testing
 Ubuntu (24.04, amd64) — image runs correctly.
 macOS (Apple Silicon, arm64) — image runs correctly.
 MikroTik RouterOS (arm64) — image runs under the RouterOS container
package.
2025-10-04 10:51:43 +01:00
Neil Alexander
89a3718d59 Add Go 1.25 to CI pipeline 2025-08-16 11:49:37 +01:00
Klemens Nanni
6d195c6de3 OpenBSD: Pledge full filesystem read for Go's resolv.conf polling (#1275)
sys/kern/kern_pledge.c r1.329[0] removed the unveil bypass for "dns",
so "rpath" is needed for Go's DNS to stat(2) it.

Since current "/ rwc" and "cpath" with the new "rpath" amount to full
read access, there is no point in unveiling anymore.

0:
8d49ad01ac
2025-08-11 23:39:52 +01:00
Neil Alexander
429403aea5 Update CI workers for packaging pipeline 2025-06-22 23:00:44 +01:00
Neil Alexander
ffc0dc92e0 Reduce minimum maxbackoff to 5 seconds 2025-06-22 16:37:34 +01:00
Neil Alexander
81543e9cc0 Remove Go 1.22 from CI 2025-06-21 20:09:12 +01:00
Neil Alexander
9e5c25d4af Update to Go 1.23, update dependencies 2025-06-21 20:08:08 +01:00
Neil
390dba0471 Update readme 2025-06-02 22:02:02 +01:00
Sergey Alirzaev
47818a1a7c apparmor: add yggdrasilctl policy (#1235) 2025-04-15 17:17:52 +01:00
Sergey Alirzaev
6377d7f071 contrib/openrc: remove SIGHUP logic (#1236)
as it is long gone from the daemon code
and unexpectedly kills the daemon
2025-04-15 17:15:09 +01:00
Neil Alexander
5b8dbc8b1e Add summary helpers to mobile wrapper 2025-03-31 10:18:57 +01:00