Skip to content

Fix domain join existing account - #34

Merged
dkmstr merged 5 commits into
masterfrom
fix-domain-join-existing-account
Oct 14, 2026
Merged

dkmstr merged 5 commits into
masterfrom
fix-domain-join-existing-account

Conversation

@dkmstr

@dkmstr dkmstr commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

No description provided.

janpenitent and others added 5 commits July 8, 2026 14:25
…lently

During the OS-config phase (rename / join domain) the managed actor had no
local websocket client yet, so a failed rename or NetJoinDomain was swallowed
by `?` and the service just restart-looped with an empty "Registros" panel and
nothing in the local logs.

Add `report_fatal` to forward these failures to BOTH the local log and the
broker /log endpoint (token/secret are already set after initialize()), and
turn the rename / join-domain branches into explicit matches that abort with an
error instead of rebooting on failure.

Tests: inject rename/join failures via OperationsMock error flags and assert the
failure reaches broker::log and that reboot()/ready() are NOT called.
…n-join-logging

Take Adolfo's domain-trust-repair work as the base (ensure_domain_membership
on Windows/Linux to repair broken AD trust without reboot, re-run broker
initialize on every service restart via runtime is_initialized flag, realm
join failure propagation, password redaction, enhanced local log dir handling)
and keep our unique piece on top: report_fatal() forwards a failed rename /
domain join to the broker /log endpoint so the failure shows up in the admin
"Cache/Registros" panel instead of only the local log file.

Merge resolution:
- managed/mod.rs: auto-merged cleanly (his re-init block + our report_fatal
  Err-branches for rename/join).
- join_domain now routes through ensure_domain_membership, so the failure test
  and mock were updated: OperationsMock::ensure_domain_membership honors the
  fail_join_domain flag, and the test asserts against ensure_domain_membership.

Tests: cargo build --workspace OK; managed suite 14/14 pass.
Plain declaratives instead of caps-for-emphasis and dramatic phrasing;
Invariant: -> Note: on the join-domain failure test. No behavior change.
…ists

A managed actor renames the machine and then joins the domain in the same run,
before the rename reboot. When the machine account already exists in AD,
NetJoinDomain returns 2224 (NERR_UserExists) and the retry dropped
NETSETUP_JOIN_WITH_NEW_NAME, so the join looked up an account for the still-active
OLD name and failed with 1332 (ERROR_NONE_MAPPED). Keep JOIN_WITH_NEW_NAME on the
retry so it reuses the existing account under the new name; only drop ACCT_CREATE
and the OU. Fix the stale comment/log: 2224 is NERR_UserExists, not ERROR_JOINED_TO_OU.

Also normalize an empty "ou" from the broker to None so we pass a NULL OU pointer
instead of an empty-string LDAP path to NetJoinDomain.
@dkmstr
dkmstr merged commit b289394 into master Oct 14, 2026
3 checks passed
@aschumann-virtualcable
aschumann-virtualcable deleted the fix-domain-join-existing-account branch October 14, 2026 23:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants