Commit 595807e
committed
fix: Harden the CheckActiveDirectory checks against review findings
Code review of the new module surfaced a set of misclassification and
timeout bugs; all checks keep their documented contracts but stop lying
about failures:
check_ad_replication
- The benign not-a-DC contract now only applies without server=: an
explicitly named DC that cannot be bound is a dead or unreachable
domain controller and is reported as a plain UNKNOWN failure instead
of the "safe to ignore fleet-wide" message.
- DsBindW has no timeout of its own and blocks ~21s+ against a
black-holed host; remote targets are now pre-flighted with a bounded
TCP connect to the RPC endpoint mapper (port 135, 5s) so an
unreachable DC fails fast instead of blowing the transport timeout.
check_secure_channel
- The domain-join defaulting queried the local machine even when
server=<remote> was given; NetGetJoinInformation now targets the
named computer, and the not-joined/failure messages name it.
- Netlogon call failures (service stopped, access denied, RPC failure)
were folded into the same healthy=0 row as a genuinely broken
channel, paging a trust-relationship-broken alert for a healthy one.
They now return UNKNOWN with the call error, matching the sibling
checks' data-source-failure contract; CRITICAL is reserved for
netlog2_tc_connection_status.
check_kdc
- KDCs were probed sequentially, each with its own timeout, so a site
outage with several dead KDCs exceeded the transport command timeout
and produced no result at all. All probes now share one io_context
and one deadline: worst case is one timeout, not one per KDC.
- Round-trip time was measured from before DNS resolution, billing a
slow resolver to the KDC and tripping the `time > 1000` warning; it
is now measured from connect, and stamped at completion so a slow
KDC cannot inflate a fast one's reading.
- timeout= was in seconds while every sibling network probe (check_tcp,
check_dns, check_http, check_ntp_offset) is in milliseconds, and
timeout*1000 could overflow int. It is now milliseconds (default
5000) with no multiplication.
- The DER writer silently truncated element lengths above 0xFFFF,
corrupting the request for absurdly long realms; it now emits however
many long-form length octets the size needs (unit-tested through the
independent reader).
Assisted-by: Claude Code:claude-fable-5
Signed-off-by: Michael Medin <michael@medin.name>1 parent d11881b commit 595807e
9 files changed
Lines changed: 237 additions & 84 deletions
File tree
- docs/samples
- modules/CheckActiveDirectory
- tests
Lines changed: 10 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
Lines changed: 10 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
28 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
35 | | - | |
36 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
Lines changed: 57 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
6 | 9 | | |
7 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
8 | 13 | | |
| 14 | + | |
| 15 | + | |
9 | 16 | | |
10 | 17 | | |
| 18 | + | |
11 | 19 | | |
12 | 20 | | |
| 21 | + | |
13 | 22 | | |
14 | 23 | | |
15 | 24 | | |
| |||
25 | 34 | | |
26 | 35 | | |
27 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
28 | 71 | | |
29 | 72 | | |
30 | 73 | | |
| |||
47 | 90 | | |
48 | 91 | | |
49 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
50 | 101 | | |
51 | 102 | | |
52 | 103 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
57 | 109 | | |
58 | 110 | | |
59 | 111 | | |
| |||
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
187 | 206 | | |
188 | 207 | | |
189 | 208 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
91 | 92 | | |
92 | 93 | | |
93 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
94 | 123 | | |
95 | | - | |
96 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
97 | 131 | | |
98 | 132 | | |
99 | 133 | | |
100 | | - | |
101 | | - | |
102 | 134 | | |
103 | 135 | | |
104 | 136 | | |
| |||
108 | 140 | | |
109 | 141 | | |
110 | 142 | | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
| 143 | + | |
| 144 | + | |
116 | 145 | | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
125 | 150 | | |
126 | | - | |
127 | | - | |
| 151 | + | |
128 | 152 | | |
129 | 153 | | |
130 | | - | |
| 154 | + | |
| 155 | + | |
131 | 156 | | |
132 | | - | |
133 | | - | |
| 157 | + | |
134 | 158 | | |
135 | 159 | | |
136 | | - | |
| 160 | + | |
137 | 161 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 162 | + | |
147 | 163 | | |
148 | 164 | | |
149 | | - | |
150 | | - | |
| 165 | + | |
151 | 166 | | |
152 | | - | |
153 | | - | |
154 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
155 | 174 | | |
156 | 175 | | |
157 | | - | |
158 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
159 | 186 | | |
160 | 187 | | |
161 | 188 | | |
162 | 189 | | |
163 | | - | |
| 190 | + | |
164 | 191 | | |
165 | 192 | | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
171 | 203 | | |
172 | | - | |
173 | 204 | | |
174 | 205 | | |
175 | 206 | | |
| |||
187 | 218 | | |
188 | 219 | | |
189 | 220 | | |
190 | | - | |
| 221 | + | |
191 | 222 | | |
192 | 223 | | |
193 | 224 | | |
| |||
200 | 231 | | |
201 | 232 | | |
202 | 233 | | |
203 | | - | |
| 234 | + | |
204 | 235 | | |
205 | 236 | | |
206 | 237 | | |
| |||
228 | 259 | | |
229 | 260 | | |
230 | 261 | | |
| 262 | + | |
| 263 | + | |
231 | 264 | | |
232 | | - | |
| 265 | + | |
233 | 266 | | |
234 | | - | |
| 267 | + | |
235 | 268 | | |
236 | 269 | | |
237 | | - | |
| 270 | + | |
238 | 271 | | |
239 | 272 | | |
240 | 273 | | |
| |||
0 commit comments