aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/manager (follow)
Commit message (Collapse)AuthorAgeFilesLines
* driver: introduce new module for talking with kernel driverJason A. Donenfeld2021-08-024-40/+155
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: list unencrypted conf filesJason A. Donenfeld2021-06-251-1/+1
| | | | | | | | By ignoring unencrypted ones, the tunnel tracker would miss running configurations at startup. Reported-by: Станислав Мацак <smatsak@mail.ru> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: do not terminate current process when intended target is childJason A. Donenfeld2021-06-221-1/+5
| | | | | | | If we've already collected this, handle is -1, which is current process. Catch this case. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: manually use CreateProcess for launching UI processJason A. Donenfeld2021-06-182-26/+108
| | | | | | | | | Go's standard library for this is buggy (PID races, handle races) and requires passing NUL, which we don't really care about for Windows. Simplify and speed up process creation by only passing exactly what we need. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: rewrite service arguments when migrating configsJason A. Donenfeld2021-06-183-54/+47
| | | | | | | | | | | If a service is installed already, it's a good idea to migrate its conf argument when migrating the file name, so that these don't get out of sync. We're already doing this when migrating from the legacy config store, so this is also an opportunity to clean up that code a bit and quit using regexes. Reported-by: Станислав Мацак <smatsak@mail.ru> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: use new DialConfig struct for pipeJason A. Donenfeld2021-03-051-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: use non-stuttering function nameJason A. Donenfeld2021-03-051-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: use CloseHandle rather than CloseJason A. Donenfeld2021-02-021-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: use stricter handle inheritabilityJason A. Donenfeld2021-02-022-83/+25
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: move away from ioutilJason A. Donenfeld2021-02-011-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: bump copyright dateJason A. Donenfeld2021-02-019-9/+9
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: pipeline UAPI requestsJason A. Donenfeld2021-02-013-19/+88
| | | | | | This avoids the somewhat expensive pipe setup. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: do not raise error if manager service is already startingJason A. Donenfeld2020-12-171-0/+6
| | | | | | | | | | If the service is in StartPending state, then it means that we were *just* started by something else, so return success here, assuming the other program starting this does the right thing. This can happen when, e.g., the updater relaunches the manager service and then invokes wireguard.exe to raise the UI. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* ringlogger: hook into global panic writerJason A. Donenfeld2020-12-095-23/+0
| | | | | | | | | | | This is a grotesque hack, and hopefully upstream Go will provide a nicer way of doing this, but already it seems quite adept at catching panics. See https://github.com/golang/go/issues/42888 for more info. This requires us to rewrite the ringlogger path to avoid all allocations. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: use service subscriptions on win 8+Jason A. Donenfeld2020-12-091-76/+164
| | | | | | | | Work in progress, but this should be more reliable than the older Win 7 code. It's still unclear what the role of checkForDisabled is to be for the Win 8+ path. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: do not respond to update state requests for non-elevatedJason A. Donenfeld2020-11-281-0/+3
| | | | | Reported-by: Simon Rozman <simon@rozman.si> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: separate out migration and print errorsJason A. Donenfeld2020-11-271-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: move legacy store from confJason A. Donenfeld2020-11-272-0/+131
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: rework migration flows around a single Save()Jason A. Donenfeld2020-11-271-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* conf: do exponential back off for sharing violation in hotfolderJason A. Donenfeld2020-11-271-1/+1
| | | | | | | | | | | | | | | | | Windows gives us notifications about writes to files in a directory, but it does not give us notifications on when file handles are closed and when we can expect to be able to grab a handle to it; this would be racey at best. So, there always exists a race between the writer's last call to WriteFile() and its eventual CloseHandle(). Work around this by implementing a basic exponential back off of retrying the open call. While we're at it, clean up the "file already exists" logic to remove a basic toctou situation, and switch to using random temp file names in order to handle better the case of saving a new file from two different administrators at once. Reported-by: Jim Salter <jim@jrs-s.net> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: styleJason A. Donenfeld2020-11-231-1/+0
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: cleanup pipes on failureJason A. Donenfeld2020-11-231-0/+16
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: update headersJason A. Donenfeld2020-11-228-8/+8
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: allow multiple tunnels if admin knob allows itJason A. Donenfeld2020-11-221-24/+27
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: move IPC notification to go routine per clientJason A. Donenfeld2020-11-221-2/+15
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: allow S-1-5-32-556 users to launch a limited UIJason A. Donenfeld2020-11-222-25/+77
| | | | | | | | | | | | | | | | | I still have serious security reservations about this, both conceptually -- should users be allowed to do this stuff? -- and pratically -- there are issues with this implementation that need some examination. TODO: - Is that registry key a secure path? Should we double check it? - Are we leaking handles to the unpriv'd process from the manager? Audit this too. - IPC notifications are blocking. Should we move this to a go routine to mitigate DoS potential? - Is GOB deserialization secure? Can an NCO user crash or RCE the manager? Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: don't serialize a nil tunnelJason A. Donenfeld2020-11-191-0/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: switch to using %w instead of %v for ErrorfJason A. Donenfeld2020-11-131-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: add TcpIp service dependency for tunnelsJason A. Donenfeld2020-11-131-1/+1
| | | | | | | | Wintun waits for various TcpIp keys to populate, so have the tunnel service depend on the TcpIp service. Reported-by: Ferad Zyulkyarov <feradz@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: adopt new Wintun APISimon Rozman2020-11-131-3/+3
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* 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>
* manager: chdir into unelevated profile before execingJason A. Donenfeld2020-03-151-0/+2
| | | | | | | | Otherwise we wind up in \Windows\System32 in the import dialog's default directory. Reported-by: Kai Haberzettl <khaberz@gmail.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: do not panic if we can't yet get a configJason A. Donenfeld2019-10-011-0/+6
| | | | | Reported-by: Jonathan Tooker <jonathan.tooker@netprotect.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: print panic stack trace in one missing partJason A. Donenfeld2019-10-011-0/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: switch to vanilla gob from rpc to remove reflection bloatJason A. Donenfeld2019-09-234-143/+444
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* global: use SECURITY_DESCRIPTOR apis from x/sys/windowsJason A. Donenfeld2019-09-231-2/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: enforce client pipe ownershipJason A. Donenfeld2019-09-011-1/+6
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: delay stale adapter cleanupJason A. Donenfeld2019-08-303-4/+4
| | | | | | | | By delaying this by 10 seconds, we ensure that we don't cause the locks to be contended immediately on startup. Before, this added around 600ms of latency to tunnel startup. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: adjust for wintun api changesJason A. Donenfeld2019-08-301-9/+4
| | | | | | | Also get rid of the "Local Area Connection" hack and "/wintun /deleteall". Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* elevate: check for desktop admin ownershipJason A. Donenfeld2019-08-301-1/+3
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* elevate: use more strict check for admin groupJason A. Donenfeld2019-08-301-1/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: fix nits in adapter cleanup logic and also handle ‘%s’ uniformlyJason A. Donenfeld2019-08-303-19/+16
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: clean stale adapters on startupSimon Rozman2019-08-302-0/+70
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* tunnel: move Run into own module to reduce file sizeJason A. Donenfeld2019-08-245-49/+12
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: do not recycle tunnel tracker threadJason A. Donenfeld2019-08-191-1/+9
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: print panics on all go routines not just main oneJason A. Donenfeld2019-08-192-10/+15
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: wait for UIs to quit before quittingJason A. Donenfeld2019-08-191-4/+12
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* service: fix typo in error messageSimon Rozman2019-08-051-1/+1
| | | | Signed-off-by: Simon Rozman <simon@rozman.si>
* elevate: move service/token into proper moduleJason A. Donenfeld2019-08-051-1/+2
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
* manager: set sidtype using upstream methodJason A. Donenfeld2019-06-081-9/+1
| | | | Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>