aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/tunnel (follow)
Commit message (Collapse)AuthorAgeFilesLines
* winipcfg, embeddable-dll-service, wintrust: fix Go 1.15 checkptr violationsBrad Fitzpatrick2020-10-212-35/+38
| | | | | | | | | | Avoids "converted pointer straddles allocation" failures at runtime when building binaries in race mode with Go 1.15, which enables checkptr: https://golang.org/doc/go1.15#windows Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> [Jason: Note Go 1.16/1.17 todo item.] Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel/winipcfg: set SysProcAttr.HideWindow when running netsh.shBrad Fitzpatrick2020-10-041-0/+3
| | | | | | | | Prevents cmd.exe window flashes when running binaries in elevated interactive contexts for debugging. Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: use conn.BindSocketToInterface typeDavid Crawshaw2020-07-141-3/+7
| | | | | Signed-off-by: David Crawshaw <crawshaw@tailscale.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* winipcfg: add missing error case to dns domain settingJason A. Donenfeld2020-06-091-1/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: unset dns search if none is specifiedJason A. Donenfeld2020-06-071-7/+9
| | | | | | | This doesn't get automatically cleared in the same way that nameservers do. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: support setting dns domain suffixJason A. Donenfeld2020-06-052-0/+36
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* firewall: remove unused ExemptBuiltinAdministratorsJason A. Donenfeld2020-04-071-17/+0
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* updater: allow updating from the command lineJason A. Donenfeld2020-04-051-1/+1
| | | | | | | | | The administrator user may run `wireguard.exe /update`, which will check for updates and install it if available. A log file may be written using `wireguard.exe /update path\to\log\file.txt`. Requested-by: Elliot Saba <staticfloat@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: calculate the actual route metric by summing interface and route metricPhilipp Czerner2020-03-291-2/+8
| | | | | | | | | | | | | | | | I had some issues setting up WireGuard behind another VPN. Curiously, it bound the physical interface instead of the other VPN, which was the default route. According to MSDN "the actual route metric used to compute the route preference is the summation of interface metric specified in the Metric member of the MIB_IPINTERFACE_ROW structure and the route metric offset specified in this member" (documentation for MIB_IPFORWARD_ROW2), but the code did not seem to consider this. After I changed the calculation, I got the expected behaviour. Signed-off-by: Philipp Czerner <suyjuris.gi@nicze.de> Link: https://docs.microsoft.com/en-us/windows/win32/api/netioapi/ns-netioapi-mib_ipforward_row2 [zx2c4: fixed up commit message, removed semicolon] Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: deduplicate addresses from configJason A. Donenfeld2020-01-241-0/+1
| | | | | | | Windows doesn't like it when passing these off to its config. Reported-by: Jonathan Tooker <jonathan.tooker@netprotect.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: use real on-link routesJason A. Donenfeld2019-12-161-21/+10
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* firewall: add escape hatch for same-process adminsJason A. Donenfeld2019-12-111-0/+17
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* firewall: fix urlsJason A. Donenfeld2019-12-113-9/+9
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: add wintun ordered unit testJason A. Donenfeld2019-12-111-0/+202
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: stop burst timer if we exceed 2 secondsJason A. Donenfeld2019-10-311-0/+1
| | | | | Reported-by: Odd Stranne <odd@mullvad.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: blackhole sockets when there's going to be a sure routing loopJason A. Donenfeld2019-10-212-9/+49
| | | | | | | | This prevents against common mishaps when changing from a wifi network that supports v6 to one that doesn't. Reported-by: Jonathan Tooker <jonathan.tooker@netprotect.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* mod: bumpJason A. Donenfeld2019-10-171-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* Revert "tunnel: check for endpoint interfaces and media connection state"Jason A. Donenfeld2019-10-091-3/+1
| | | | | | | | This reverts commit cf6f599a4a65e89929ffc12982346c8e9012552c. It broke people's setups. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: print wintun version in debug logJason A. Donenfeld2019-10-091-0/+6
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* mod: bump versionsJason A. Donenfeld2019-10-042-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: check for endpoint interfaces and media connection stateJason A. Donenfeld2019-10-011-1/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: smooth bursts from windows network notifiersJason A. Donenfeld2019-10-011-5/+25
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: windows does not always add/remove routes with up/down interfaceJason A. Donenfeld2019-10-013-25/+45
| | | | | | | | | | | | | | | | On Linux, we're used to routes being added after an interface is up, and routes being removed as a consequence of an interface going down. On Windows, this isn't always the case, at least not from the perspective of the route notifiers. In order to work around this and make a multi-interface model coherent, we search for a new default route not only whenever the routing table changes but also whenever any interface link parameters change, such as up/down. The practical consequence is that now WireGuard connects properly when wifi is disconnected and then reconnected. Reported-by: Nenad Kozul <me@nenadkozul.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* winipcfg: make Unregister wait for callbacks to completeJason A. Donenfeld2019-09-274-31/+61
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* winipcfg: port more granular locking from route change to othersJason A. Donenfeld2019-09-272-22/+36
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* winipcfg: ensure we're passing copy to go routinesJason A. Donenfeld2019-09-273-3/+6
| | | | | | | The windows-allocated one gets freed. Reported-by: Odd Stranne <odd@mullvad.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* mod: bump versionsJason A. Donenfeld2019-09-272-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: use SECURITY_DESCRIPTOR apis from x/sys/windowsJason A. Donenfeld2019-09-237-99/+62
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* firewall: remove unused wrappersJason A. Donenfeld2019-09-232-32/+0
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: device->interfaceJason A. Donenfeld2019-09-131-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* winipcfg: launch callbacks in goroutines to prevent deadlockJason A. Donenfeld2019-09-013-3/+3
| | | | | | | | | | | | ret: setupLock interfaceChangeLock trigger: interfaceChangeLock setupLock Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* winipcfg: use upstream helper function for elevation testJason A. Donenfeld2019-08-301-16/+9
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: fix nits in adapter cleanup logic and also handle ā€˜%sā€™ uniformlyJason A. Donenfeld2019-08-301-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: allow disabling deterministic GUIDs for external consumersJason A. Donenfeld2019-08-301-21/+31
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: do not query real interface nameJason A. Donenfeld2019-08-261-7/+0
| | | | | | | | | | | | We want to enforce the relation between the socket name and the service name, especially since the wintun adapter name might get a 1 or 2 appended depending on weird Nci duplication detection. So we just stick with the configuration-given name throughout. Also, the user can change the adapter name at runtime, which is all the more reason why maybe we shouldn't care about it so much. Reported-by: Nenad Kozul <me@nenadkozul.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* firewall: use RtlGetNtVersionNumbers for kernel compat checksJason A. Donenfeld2019-08-261-3/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* version: use upstream RtlGetVersionJason A. Donenfeld2019-08-241-7/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: move Run into own module to reduce file sizeJason A. Donenfeld2019-08-241-2/+14
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* elevate: move service/token into proper moduleJason A. Donenfeld2019-08-051-1/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: styleJason A. Donenfeld2019-08-031-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: extract owner of config file for pipe daclJason A. Donenfeld2019-07-192-0/+60
| | | | | | | | If the config file is unencrypted and its owner is not Local System, then we allow the runtime named pipe to be accessed by that owner, since generally the private key is already stored in the config file. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: wait for IP service to attach to wintunJason A. Donenfeld2019-06-186-125/+268
| | | | | | | | This helps fix startup races without needing to poll, as well as reconfiguring interfaces after wintun destroys and re-adds. It also deals gracefully with IPv6 being disabled. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* firewall: adjust loopback rule for better matchingOdd Stranne2019-06-132-17/+14
| | | | | Signed-off-by: Odd Stranne <odd@mullvad.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: clearer GUID encoding schemeJason A. Donenfeld2019-06-131-24/+38
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* winipcfg: prefer own methods over direct API callsSimon Rozman2019-06-111-2/+2
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* tunnel: generate GUIDs deterministicallyJason A. Donenfeld2019-06-102-1/+74
| | | | | | | | This allows NLA profiles to securely bind public keys to firewall profiles, a considerable improvement on the usual insecure Windows situation. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: SCM lock status is upstream nowJason A. Donenfeld2019-06-091-32/+11
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* tunnel: release SCM locks by faking an early start before wintun initJason A. Donenfeld2019-06-071-0/+35
| | | | | | | Otherwise creating the wintun service deadlocks the entire SCM on Windows 8.1. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* firewall: GUID generation is now upstreamJason A. Donenfeld2019-06-072-16/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: cleanup TODO comment spacingJason A. Donenfeld2019-06-075-6/+6
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>