aboutsummaryrefslogtreecommitdiffstatshomepage
Commit message (Collapse)AuthorAgeFilesLines
* overlay: stub out crypto/rand FIPS140 garbageHEADmasterJason A. Donenfeld3 days15-4/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Go crypto library used to be simple and nice and an example of how to do things well. Unfortunately, the addition of FIPS140 to it has brought disgusting enterprise patterns and gummed up the code. One place this really comes out is in the insane infrastructure behind the RNG. It really only should be calling the system random functions and nothing more. But in contemporary Go, simply calling into the RNG brings along with it in the binary: - A bizarre voodoo magic userspace entropy collector - A specialized SHA384 implementation for said entropy collector - An AES implementation - An AES-NI accelerated AES implementation - A CTR implementation for AES - A GCM implementation for AES - Some CPU detection code - An implementation of some FIPS-specified DRBG algorithm - An HMAC implementation - A SHA256 implementation - An AVX2-accelerated SHA256 implementation - A SHA3 implementation (including cSHAKE) - An AVX2-accelerated SHA3 implementation - A SHA512 implementation - Some generic XOR-bytes routines - The actual syscall wrappers for getting random numbers Obviously this is completely insane. There's a tangled mess of components including eachother, a disorganized patchwork of FIPS code and BoringCrypto code and enterprisey API hooks and self checks and auto-included initializers. It seems like a mess of a library these days. So, here we beat down this madness by using a Go build overlay to replace various parts of the crypto library with stub functions. This is pretty nasty. But at least it compiles out some of this junk. I'm trying to fix this upstream in the meanwhile [1], and so we'll see what comes of that. Link: https://github.com/golang/go/issues/81639 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* updater: compare hashes directly with crypto/subtleJason A. Donenfeld3 days1-2/+2
| | | | | | | | | | hmac.Equal is a wrapper around subtle.ConstantTimeCompare. Use the comparison directly to preserve the same timing behavior without importing crypto/hmac, so that we don't accidently drag in fips140 garbage. Link: https://github.com/golang/go/issues/81639 Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* build: restore separate Go directory on WindowsJason A. Donenfeld3 days2-5/+5
| | | | | | Keep the Go toolchain under .deps\go to match the Linux build layout. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: use crypto/ecdh for X25519Jason A. Donenfeld3 days2-9/+13
| | | | | | | Use crypto/ecdh directly, because the old x/crypto 25519 library was wrapping it. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: rand.Read never errorsJason A. Donenfeld3 days6-33/+11
| | | | | | Part of the API contract, apparently. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* version: bump to 1.1.1Jason A. Donenfeld5 days1-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* build: bump to go 1.27.1Jason A. Donenfeld5 days4-23/+23
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* locales: update translations from crowdinJason A. Donenfeld5 days43-10257/+30304
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* embeddable-dll-service: csharp: fix allowed IP layoutJason A. Donenfeld5 days1-1/+8
| | | | | | | | The CIDR byte follows the 16-byte address and two-byte address family, placing it at offset 18. Add the missing flags field at offset 20 and its Remove flag to match the native structure. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: update the blocking state when Table is offJason A. Donenfeld5 days1-1/+1
| | | | | | | Publish the inevaluable state instead of returning early. Otherwise the kill-switch checkbox keeps its previous state when Table = off is added. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: reject duplicate tunnel names within an importJason A. Donenfeld5 days1-0/+1
| | | | | | | Add each successfully imported name to the existing-name set, so a later configuration in the same batch cannot overwrite it. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* winipcfg: wait for callbacks after releasing the registration mutexJason A. Donenfeld5 days3-6/+3
| | | | | | | | Holding the add/remove mutex while waiting for a callback can deadlock if the callback registers or unregisters another callback. Defer the wait until after the mutex is released in all three handlers. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: clear the pending peer when entering an interface sectionJason A. Donenfeld5 days1-0/+1
| | | | | | | Otherwise it gets appended again at the next peer section or EOF. This also prevents the single-peer kill switch from being enabled. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: fail write if flushing file buffers failsJason A. Donenfeld2026-07-141-1/+5
| | | | | | | If the flush fails, the data is not durably on disk, so the rename must not be published. Delete it in this case. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: preserve comments across serializationJason A. Donenfeld2026-07-144-39/+354
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: deal with ::0 endpoints properlyJason A. Donenfeld2026-07-142-1/+5
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* l18n: promote out.gotext.json to messages.gotext.jsonJason A. Donenfeld2026-07-142-1/+7
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* l18n: configuration separator fallbacksJason A. Donenfeld2026-07-141-2/+10
| | | | | | | For languages that don't translate these, explicitly fall back to ", " and " " rather than emitting the placeholder. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: tear down the event reader on partial decode failureJason A. Donenfeld2026-07-141-12/+12
| | | | | | | | | | | gob is positional; continue on a half-read value leaves the decoder mid-payload, and the next iteration reads what follows as if it were a new NotificationType. Return on any Decode error and let the pipe close take down the reader. The empty-tunnel-name check has to move below all four field decodes for the same reason, or it desyncs the stream just like the failure path used to. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: tidy up leak and dead lock-thread defer in session loopJason A. Donenfeld2026-07-141-2/+6
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: skip the handle list attribute when no handles are suppliedJason A. Donenfeld2026-07-141-4/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: release driver adapter on tunnel stopJason A. Donenfeld2026-06-132-0/+6
| | | | | | | | | | | | | | | releaseDriverAdapter was only called from the RuntimeConfig error path, so a cleanly-running tunnel never had its cached *Adapter dropped from the map. The finalizer attached in OpenAdapter couldn't reach it, and the kernel handle leaked. A restart of the same tunnel then kept hitting stale-handle errors against the surviving cache entry. Fix this by calling releaseDriverAdapter from tunneltracker on every TunnelStopped transition, and closing the adapter inside releaseDriverAdapter under the per-adapter lock. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* version: skip certs whose CertificatePolicies fail to decodeJason A. Donenfeld2026-06-131-2/+2
| | | | | | | | | A per-cert decode failure shouldn't abort the whole enumeration: just continue to the next cert. As a side effect, the next CertEnumCertificatesInStore call frees this cert via its predecessor-free contract, so no explicit free is needed either. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* main: pass fatal arguments to log.Fatal individuallyJason A. Donenfeld2026-06-131-1/+1
| | | | | | | | Without the splat the appended slice is passed as a single argument to log.Fatal, which renders it as "[Error: <err>]" with the brackets and the leading slice formatting visible in the console output. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ringlogger: read shared counters atomicallyJason A. Donenfeld2026-06-131-11/+12
| | | | | | | | | The writer publishes nextIndex and timeNs via atomic ops, but WriteTo and FollowFromCursor used to memcpy the entire mapping and then read those fields plain, which is a race. Drop the megabyte snapshot and use matching atomic loads. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ringlogger: don't pass argv as format stringJason A. Donenfeld2026-06-131-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ui: raise: exit cleanly when the event hook cannot be installedJason A. Donenfeld2026-06-131-3/+6
| | | | | | | | | | | | | | Falling through to the message pump after SetWinEventHook failure wedges the secondary process forever, since the hook is the only thing that would ever post WM_QUIT or signal the existing window. GetMessage's -1 error return was also being treated as a normal message and dispatched on uninitialised MSG state. Bail out with os.Exit on the SetWinEventHook failure path, and on the message loop translate WM_QUIT (m==0) and the GetMessage error (m<0) into real exit codes so ExitProcess does not see them through a signed cast that lands on 0xFFFFFFFF. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: mtumonitor: serialize change callbacksJason A. Donenfeld2026-06-131-0/+5
| | | | | | | | The route-change and interface-change callbacks run on separate threads from the IP Helper notification pool and both touch the same lastLUID/lastIndex/lastMTU state. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* memmod: prune loaded address ranges on freeJason A. Donenfeld2026-06-131-0/+8
| | | | | | | | | | | | The RtlPcToFileHeader hook consults loadedAddressRanges to identify PCs that belong to manually-loaded modules. Entries were appended during LoadLibrary but never removed when the module was freed, so once the underlying allocation was returned to the OS and possibly reused, the hook would still claim those PCs as ours and substitute in a sentinel address, breaking unwind metadata lookup for whatever legitimate module ended up at that range. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* memmod: delete the function table on freeJason A. Donenfeld2026-06-131-1/+9
| | | | | | | | RtlAddFunctionTable keeps a kernel-side pointer into the in-image RUNTIME_FUNCTION array. Without a matching RtlDeleteFunctionTable, freeing codeBase via VirtualFree leaves that pointer dangling. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* memmod: distinguish no-exports from no-named-exportsJason A. Donenfeld2026-06-131-1/+1
| | | | | | | | The two checks collapsed into one || meant the second error message was unreachable. Drop NumberOfNames from the first check so both diagnostics are reachable for their respective cases. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* updater: drain the entire response when fetching version listJason A. Donenfeld2026-06-131-4/+3
| | | | | | | | | WinHTTP can short-read across TLS or HTTP chunk boundaries, so a single Read may truncate the signed file list. Signify verification catches it, but the user sees a spurious update-check failure instead of a successful fetch. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: flush file buffers before atomically renaming into placeJason A. Donenfeld2026-06-131-0/+1
| | | | | | | | | | NTFS journals the rename's metadata change but does not journal user data. Without an explicit flush a power loss between the cache manager publishing the rename and writing back the file's pages can leave the destination at its final name with zero or partial contents, while the prior file is gone. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: keep retrying when the config-directory watcher fails to startJason A. Donenfeld2026-06-131-2/+6
| | | | | | | | | | | | The watcher's setup is guarded by sync.Once, which is consumed the moment the goroutine is spawned. If tunnelConfigurationsDirectory or FindFirstChangeNotification fails on the first attempt the goroutine exits, but every subsequent RegisterStoreChangeCallback sees the Once already done and skips the spawn, so changes are silently never reported again. Retry these initial failures on the existing startover loop instead of bailing out. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: don't strip '#' from PreUp/PreDown/PostUp/PostDown valuesJason A. Donenfeld2026-06-131-12/+16
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: reject reserved names with any extensionJason A. Donenfeld2026-06-131-11/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* version: bump to 1.1v1.1Jason A. Donenfeld2026-05-071-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: create DNS registry key if it doesn't existJason A. Donenfeld2026-05-071-1/+1
| | | | | | | This fixes a bit of a race with interface attachment on old Windows builds. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* build: bump wireguard-nt to 1.1Jason A. Donenfeld2026-05-072-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* updater,fetcher: disable HTTP/3Jason A. Donenfeld2026-05-062-10/+4
| | | | | | | We had reports of it failing. Reported-by: Ben Yoder <byoder@moltzconstructors.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: prevent directory traversal on bare tunnel namesJason A. Donenfeld2026-05-031-0/+3
| | | | | | | Not really reachable, but still this seems wrong not to check. DeleteName checks it. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* installer: reduce windows 7 disappointment emailJason A. Donenfeld2026-04-221-0/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* version: bump to 1.0.1v1.0.1Jason A. Donenfeld2026-04-201-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* build: use crlf line endings on bat filesJason A. Donenfeld2026-04-201-0/+2
| | | | | Reported-by: Frank Rochlitzer <f.rochlitzer@b3-it.de> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* build: bump to go 1.26.2Jason A. Donenfeld2026-04-202-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: regenerate syscall code from latest x/sys/windows wrapperJason A. Donenfeld2026-04-203-57/+57
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* locales: update translations from crowdinJason A. Donenfeld2026-04-209-933/+4623
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* mod: bump for walk fixJason A. Donenfeld2026-04-202-20/+20
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* installer: make sure we can delete files after killing processesJason A. Donenfeld2026-04-191-17/+62
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* installer: don't follow reparse points when computing file IDsJason A. Donenfeld2026-04-191-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>