213 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
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
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
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
24482b7dbe Run go fix, corrects mostly build tags 2026-01-18 14:47:18 +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
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
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
Neil Alexander
42873be09b Reusable peer lookup/dial logic 2024-11-17 21:14:54 +00:00
Neil Alexander
ef110b0181 Update Debian package metadata 2024-10-27 20:38:15 +00:00
Sergey Bobrenok
d6fd305f12 Fix Android build with Go 1.23.0 or later (#1166)
The `github.com/wlynxg/anet` library depends on the `//go:linkname`
linker feature [1]. However, since Go 1.23.0, the usage of
`//go:linkname` has been restricted [2]. And now it's necessary to
explicitly specify `-checklinkname=0` linker flag to use it.

[1]
https://github.com/wlynxg/anet/blob/main/README.md#how-to-build-with-go-1230-or-later
[2] https://tip.golang.org/doc/go1.23#linker

Resolves: #1165
2024-09-29 21:06:36 +01:00
Neil
c4b29b735c Link costing based on average RTT (#1171)
This PR updates Ironwood to include the new RTT-based link costing and
updates `yggdrasilctl` to report the cost in `getPeers`.

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2024-09-21 22:05:23 +00:00
Neil Alexander
c505097be0 Update mobile build for iOS/macOS framework generation 2024-06-26 23:17:11 +01:00
Neil Alexander
2831d73f73 Try to fix WiX for Windows MSI builds 2024-05-27 22:52:48 +01:00
Neil Alexander
5d9c5b3c9b Minimum Go 1.21, update quic-go, update some CI actions 2024-05-27 22:03:41 +01:00
Paul Donald
f56f9c124c Minor Fixes (#1107)
* Minor comment fixes.

* Optimize PeerEntry for memory efficiency

* Improve NodeConfig for memory alignment
2024-05-27 21:57:28 +01:00
trashpile-shenanigans
5da1fbe397 Bump minimum required go version to 1.20 in documentation as required by quic-go dependency (#1138) 2024-05-27 21:53:52 +01:00
Neil Alexander
7f9d4f3f6d Don't import LDFLAGS from the environment 2023-10-28 18:21:26 +01:00
Neil Alexander
a6b316ef08 Release: Yggdrasil 0.5.1 2023-10-28 16:21:50 +01:00
Neil Alexander
d781fef760 Release: Yggdrasil 0.5.0 2023-10-28 15:23:01 +01:00
Neil
0b578a637a Debian package updates (#1073)
* Update Debian package

* Don't put `AdminListen` in config by default, fix path in Debian package

* Fix path in unit file

* Preserve original service files for other packages

---------

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2023-10-28 14:58:52 +01:00
Arceliar
d17ac39789 update ironwood dependency, add a debug API call for lookups 2023-10-28 05:26:43 -05:00
Revertron
6873fd44ff Fixes logger, adds some log messages. 2023-10-25 20:59:19 +02:00
Neil Alexander
094f80f39c Fix RetryPeersNow, move startup logging, don't set TUN address if not available 2023-10-22 15:51:30 +01:00
Alex Akselrod
6a9493757d mobile: add support for Listen in config (#1063)
Co-authored-by: Neil <git@neilalexander.dev>
2023-10-21 17:33:17 +00:00
Neil Alexander
aceb037c57 Fix panic in mobile GetPeersJSON 2023-10-18 22:38:10 +01:00
Neil Alexander
2a21241738 Multicast passwords 2023-10-11 19:28:28 +01:00
Neil Alexander
45b773eade Remove TLS root validation
This is just too complicated compared to the per-peer/per-listener/per-interface password
approach.
2023-10-11 18:25:35 +01:00
Neil Alexander
68d1036de8 Fix mobile unit test 2023-09-03 13:30:48 +01:00
Neil
9defa35c66 Merge branch 'develop' into future 2023-09-03 13:18:47 +01:00
Neil Alexander
c8b9aaeb67 Only set mobile memory limit on supported Go versions 2023-09-03 13:13:53 +01:00
Neil
6ab0639b82 Merge branch 'develop' into future 2023-09-03 12:58:55 +01:00
Neil Alexander
db9b57c052 Update contrib/mobile for the latest iOS build 2023-06-06 22:11:49 +01:00
Neil Alexander
7afa23be4c Link refactoring, admin socket changes 2023-05-19 19:09:05 +01:00
Neil Alexander
c7ea223a9a Update mobile bindings 2023-05-14 10:16:33 +01:00
Arceliar
5e95246c26 update to ironwood v0.0.0-20230513191034-495699d87ae4 with API changes 2023-05-13 14:44:38 -05:00
Neil Alexander
a148f4cfec More updates for Ygg v0.5 2023-03-19 10:33:07 +00:00
Neil Alexander
7efd66932f Redial failed connections if possible (#983) 2022-11-12 11:30:03 +00:00
Neil Alexander
590d83aa9c Fix #975 by not exporting uint8 2022-11-01 17:42:52 +00:00
Revertron
ee33bd248f Added two new methods to mobile package (#974)
* Added two new methods

In order to implement https://github.com/yggdrasil-network/yggdrasil-android/issues/25 we need these new methods.

* Renamed methods, changed comments
2022-11-01 12:10:50 +00:00
Neil Alexander
f08dec822a Priority support (#964)
* Allow setting link priorities

* Fix a bug

* Allow setting priority on listeners and multicast interfaces

* Update `yggdrasilctl`

* Update to Arceliar/ironwood#5
2022-10-26 09:24:24 +01:00
Neil Alexander
5ef61faeff Link refactor (#941)
* Link refactoring

* More refactoring

* More tweaking

* Cleaner shutdowns, UNIX socket support, more tweaks

* Actorise links, remove mutex

* SOCKS support
2022-09-17 20:07:00 +01:00
Alexander Ivanov
414aaf6eb9 Update mobile.go (#942) 2022-09-05 12:55:35 +01:00
Neil Alexander
493208fb37 Refactor multicast setup (isolated config, etc) 2022-09-03 11:42:05 +01:00
Arceliar
a182fad8d6 Merge branch 'develop' into neilalexander/refactor 2022-08-28 13:39:26 -05:00
Alexander Ivanov
f8e626dbe1 Fix Android multicast crash (#930)
* Do not exit on multicast errors (mobile)

* Consistency with cmd/yggdrasil/main.go

Co-authored-by: Neil Alexander <neilalexander@users.noreply.github.com>
2022-08-10 22:54:02 +01:00
Neil Alexander
4c889703b1 Continue refactoring 2022-08-06 15:05:12 +01:00
Neil Alexander
bc78530fcb Build packages in GitHub Actions 2022-04-17 23:38:16 +01:00