Commit 8afd6846 authored by Vitaly Lipatov's avatar Vitaly Lipatov

tune_sssd.sh: fix net ads join/leave options

- Remove --use-kerberos=required from leave (doesn't work with broken machine account) - Replace --use-kerberos=required with -U $ADMIN for join (more reliable) - Add comment explaining why --use-kerberos=required doesn't work Co-Authored-By: 's avatarClaude Opus 4.5 <noreply@anthropic.com>
parent 691c51d9
...@@ -200,14 +200,15 @@ if net ads testjoin 2>/dev/null; then ...@@ -200,14 +200,15 @@ if net ads testjoin 2>/dev/null; then
fi fi
else else
echo "Machine account is broken or not joined, (re)joining..." echo "Machine account is broken or not joined, (re)joining..."
# Leave domain first if there's a stale join # Leave domain first if there's a stale join (use admin ticket from kinit)
net ads leave --use-kerberos=required 2>/dev/null || true net ads leave 2>/dev/null || true
[ -f /etc/krb5.keytab ] && echo "Removing old keytab /etc/krb5.keytab ..." && rm -fv /etc/krb5.keytab [ -f /etc/krb5.keytab ] && echo "Removing old keytab /etc/krb5.keytab ..." && rm -fv /etc/krb5.keytab
echo "Join to domain... " echo "Join to domain... "
# Use dnshostname= to register full FQDN (e.g. host.office.etersoft.ru instead of host.etersoft.ru) # Use dnshostname= to register full FQDN (e.g. host.office.etersoft.ru instead of host.etersoft.ru)
# This requires msDS-AllowedDNSSuffixes to include the DNS subdomain on the DC # This requires msDS-AllowedDNSSuffixes to include the DNS subdomain on the DC
net ads join dnshostname=$(hostname -f) --use-kerberos=required --no-dns-updates || fatal "Failed to join to the domain '$REALM'" # Note: --use-kerberos=required doesn't work here, need explicit -U for credentials
net ads join dnshostname=$(hostname -f) -U $ADMIN --no-dns-updates || fatal "Failed to join to the domain '$REALM'"
fi fi
kdestroy kdestroy
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment