TL;DR: After the weekly auto-update, my UNAS Pro 4 lost its Active Directory join and tried to re-join under a new computer name. My service account didn't have rights to create computer objects, so the join failed and SMB auth stopped working for every AD user. The fix was to pre-create the computer account and delegate rights on just that object.
It's Sunday morning and I just received the message nobody would like to receive: NAS doesn't work! I'm posting this in case someone wakes up like me.
Looking into the details:
\- No SMB access for anyone: Authentication error, with both NTLM and Kerberos.
\- The AD accounts were fine: LDAP bind worked, nothing locked out, badPwdCount = 0
\- The DCs weren't even seeing the login attempts. The NAS was rejecting them locally.
What actually happened
\- 05:16: the UNAS auto-updated to UniFi OS 6.0.19
\- In the same minute both DCs started logging this, every \~5 minutes:
dsdb_add_user: Failed to create user record CN=unas-xxxxxxxxxx,CN=Computers,...: acl: unable to get access
\- The UNAS had dropped its existing computer account and was trying to join again under a new name derived from its MAC (unas- + MAC). It used the Directory Integration bind account, which can't create computer objects.
\- After about 1.5 hours it stopped retrying.
Fix
- Pre-create the computer account with the exact name from the DC log:
samba-tool computer create unas-xxxxxxxxxx --computerou="OU=YourOU"
2. Give the bind account rights on that one object only (no general rights to create computers):
samba-tool dsacl set --objectdn="CN=unas-xxxxxxxxxx,OU=YourOU,..." \\
\--sddl="(A;;RPWPCRSWLCLORC;;;<SID of bind account>)"
3. In Drive → Settings → Services → SMB, untick "Use Active Directory Credentials…", save, tick it again, save. "Sync Now" in Directory Integration does NOT trigger the join. It only syncs users.
4. The join completed within seconds and SMB worked again.
BTW:
Why is the Directory Integration so damn hard to find. Every time I lose minutes just to find that.
PS: Just found this problem being mentioned on their guide for the new advanced permissions:
https://help.ui.com/hc/en-us/articles/42273419868567-Configuring-Advanced-Permissions-for-Shared-Drives-on-UNAS-and-ENAS
Still, this should not happen. Specially because this is a silent error. I got no errors or notifications about this.