Cuong Manh Le
c53a0ca1c4
cmd/cli: close log reader after reading
2025-01-14 14:32:54 +07:00
Cuong Manh Le
6fd3d1788a
cmd/cli: fix memory leaked when querying wmi instance
...
By ensuring the instance is closed when query finished.
2025-01-14 14:32:44 +07:00
Cuong Manh Le
087c1975e5
internal/controld: bump send log timeout to 300s
2025-01-14 14:32:35 +07:00
Cuong Manh Le
3713cbecc3
cmd/cli: correct log writer initial size
2025-01-14 14:32:26 +07:00
Cuong Manh Le
6046789fa4
cmd/cli: re-initializing OS resolver before doing check upstream
...
Otherwise, the check will be done for old stale nameservers, causing it
never succeed.
2025-01-14 14:32:15 +07:00
Cuong Manh Le
3ea69b180c
cmd/cli: use config timeout when checking upstream
...
Otherwise, for slow network connection (like plane wifi), the check may
fail even though the internet is available.
2025-01-14 14:32:01 +07:00
Cuong Manh Le
db6e977e3a
Only used saved LAN servers if available
2025-01-14 14:31:48 +07:00
Cuong Manh Le
a5c776c846
all: change send log to use x-www-form-urlencoded
2025-01-14 14:31:37 +07:00
Cuong Manh Le
5a566c028a
cmd/cli: better error message when log file is empty
...
While at it, also record the size of logs being sent in debug/error
message.
2025-01-14 14:31:24 +07:00
Cuong Manh Le
ff43c74d8d
Bump golang.org/x/net to v0.33.0
...
Fix CVE-2024-45338
2025-01-14 14:31:13 +07:00
Yegor S
3c7255569c
Update config.md
2025-01-06 18:40:44 -05:00
Cuong Manh Le
4a92ec4d2d
cmd/cli: fix race in Test_addSplitDnsRule
2024-12-19 22:10:34 +07:00
Cuong Manh Le
9bbccb4082
cmd/cli: get default interface once
2024-12-19 21:50:00 +07:00
Cuong Manh Le
4f62314646
cmd/cli: do API reloading if exlcude list changed
2024-12-19 21:50:00 +07:00
Cuong Manh Le
cb49d0d947
cmd/cli: perform leaking queries in non-cd mode
2024-12-19 21:50:00 +07:00
Cuong Manh Le
89f7874fc6
cmd/cli: normalize log path when sending log
...
So the correct log file that "ctrld run" process is writing logs to will
be sent to server correctly.
2024-12-19 21:50:00 +07:00
Cuong Manh Le
221917e80b
Bump golang.org/x/crypto to v0.31.0
...
To fix CVE-2024-45337 (even though ctrld do not use SSH)
2024-12-19 21:50:00 +07:00
Cuong Manh Le
37d41bd215
Skip public DNS for LAN query
...
So we don't blindly send requests to public DNS even though they can not
handle these queries.
2024-12-19 21:50:00 +07:00
Cuong Manh Le
8a96b8bec4
cmd/cli: adopt FilteredLevelWriter when doing internal logging
...
Without verbose log, we use internal log writer with log level set to
debug. However, this will affect other writers, like console log, since
they are default to notice level.
By adopting FilteredLevelWriter, we can make internal log writer run in
debug level, but all others will run in default level instead.
2024-12-19 21:50:00 +07:00
Cuong Manh Le
02ee113b95
Add missing kea dhcp4 format when validating config
...
Thanks Discord user cosmoxl for reporting this.
2024-12-19 21:50:00 +07:00
Cuong Manh Le
f71dd78915
cmd/cli: move cobra commands to separated file
...
So each command initialization/logic can be read/update more easily.
2024-12-19 21:50:00 +07:00
Cuong Manh Le
cd5619a05b
cmd/cli: add internal logging
...
So in case of no logging enabled, useful data could be sent to ControlD
server for further troubleshooting.
2024-12-19 21:50:00 +07:00
Cuong Manh Le
a63a30c76b
all: add sending logs to ControlD API
2024-12-19 21:50:00 +07:00
Cuong Manh Le
f5ba8be182
Use ControlD Public DNS when non-available
...
This logic was missed when new initializing OS resolver logic was
implemented. While at it, also adding this test case to prevent
regression.
2024-12-19 21:50:00 +07:00
Cuong Manh Le
a9f76322bd
Bump quic-go to v0.48.2
...
For fixing GO-2024-3302 (CVE-2024-53259)
2024-12-19 21:50:00 +07:00
Cuong Manh Le
ed39269c80
Implementing new initializing OS resolver logic
...
Since the nameservers that we got during startup are the good ones that
work, saving it for later usage if we could not find available ones.
2024-12-19 21:50:00 +07:00
Cuong Manh Le
09426dcd36
cmd/cli: new flow for LAN hostname query
...
If there is no explicit rules for LAN hostname queries, using OS
resolver instead of forwarding requests to remote upstreams.
2024-12-19 21:50:00 +07:00
Cuong Manh Le
17941882a9
cmd/cli: split-route SRV record to OS resolver
...
Since SRV record is mostly useful in AD environment. Even in non-AD one,
the OS resolver could still resolve the query for external services.
Users who want special treatment can still specify domain rules to
forward requests to ControlD upstreams explicitly.
2024-12-19 21:50:00 +07:00
Cuong Manh Le
70ab8032a0
cmd/cli: silent WMI query
...
The log is being printed by the wmi library, which may cause confusion.
2024-12-19 21:50:00 +07:00
Cuong Manh Le
8360bdc50a
cmd/cli: add split route AD top level domain on Windows
...
The sub-domains are matched using wildcard domain rule, but this rule
won't match top level domain, causing requests are forwarded to ControlD
upstreams.
To fix this, add the split route for top level domain explicitly.
2024-12-19 21:49:57 +07:00
Cuong Manh Le
6837176ec7
cmd/cli: get static DNS using syscall
2024-12-19 21:34:37 +07:00
Cuong Manh Le
5e9b4244e7
cmd/cli: get physical interfaces using Windows WMI
2024-12-19 21:34:26 +07:00
Cuong Manh Le
9b6a308958
cmd/cli: get AD domain using Windows API
2024-12-19 21:34:26 +07:00
Cuong Manh Le
71e327653a
cmd/cli: check local DNS using Windows API
2024-12-19 21:34:21 +07:00
Cuong Manh Le
a56711796f
cmd/cli: set DNS using Windows API
2024-12-19 21:32:49 +07:00
Cuong Manh Le
09495f2a7c
Merge pull request #194 from Control-D-Inc/release-branch-v1.3.11
...
Release branch v1.3.11
v1.3.11
2024-11-20 12:54:22 +07:00
Cuong Manh Le
484643e114
cmd/cli: lowercase AD domain to be consistent with network rules
...
While at it, also add a note that the domain comparison are done in
case-insensitive manner.
2024-11-13 15:03:38 +07:00
Cuong Manh Le
da91aabc35
cmd/cli: ensure extra split rule is always written
...
Otherwise, the rule may not be added if ctrld does not run in cd mode.
2024-11-13 15:03:27 +07:00
Cuong Manh Le
c654398981
cmd/cli: make widcard rules match case-insensitively
...
Domain name comparisons are done in case-insensitive manner.
See: https://datatracker.ietf.org/doc/html/rfc1034#section-3.1
2024-11-13 15:03:17 +07:00
Cuong Manh Le
47a90ec2a1
cmd/cli: re-fetch pin code during deactivation checking
...
So if the pin code was updated/removed, it will be checked correctly by
ctrld during stop/uninstall commands.
2024-11-13 15:02:52 +07:00
Cuong Manh Le
2875e22d0b
cmd/cli: re-fetch deactivation pin code when reloading API config
2024-11-13 15:01:44 +07:00
Cuong Manh Le
c5d14e0075
cmd/cli: only cleanup log file if set
...
Otherwise, normalizeLogFilePath may return incorrect log file path,
causing invalid log file/backup initialization. Thus "--cleanup" will
complain about invalid files.
2024-11-13 15:01:27 +07:00
Cuong Manh Le
84e06c363c
Avoid tailscale.com/tsd dependency
...
Since it brings gvisor.dev/gvisor to the dependency graph, causing the
binary size bloating on *nix (except darwin).
2024-11-13 15:00:41 +07:00
Cuong Manh Le
5b9ccc5065
Merge pull request #182 from Control-D-Inc/release-branch-v1.3.10
...
[WIP] Release branch v1.3.10
v1.3.10
2024-10-29 14:56:32 +07:00
Cuong Manh Le
6ca1a7ccc7
.github/workflows: use go1.23.x
...
And also upgrade staticcheck version to 2024.1.1
2024-10-24 13:05:48 +07:00
Cuong Manh Le
9d666be5d4
all: add custom hostname support for provisoning
2024-10-24 13:05:48 +07:00
Cuong Manh Le
65de7edcde
Only store last LAN server if available
...
Otherwise, queries may still be forwarded to this un-available LAN
server, causing slow query time.
2024-10-22 22:01:37 +07:00
Cuong Manh Le
0cdff0d368
Prefer LAN server answer over public one
...
While at it, also implementing new OS resolver chosing logic, keeping
only 2 LAN servers at any time, 1 for current one, and 1 for last used
one.
2024-10-22 00:14:32 +07:00
Cuong Manh Le
f87220a908
Avoid data race when initializing OS resolver
...
With new leaking queries features, the initialization of OS resolver can
now lead to data race if queries are resolving while re-initialization
happens.
To fix it, using an atomic pointer to store list of nameservers which
were initialized, making read/write to the list concurrently safe.
2024-10-17 23:41:12 +07:00
Cuong Manh Le
30ea0c6499
Log nameserver in OS resolver response
2024-10-17 23:41:12 +07:00