@Martin Berthiaume and @croaker_1 : any impact for home users? I would guess the bug affects Business or School environments but just wanna be sure...
Thanks,
Patrice
Thanks. PatriceIt impacts only Businesses or Schools that use windows active directory and/or windows file servers.
Martin
Not under normal circumstances. If you were using Kerberos for Office authentication you would know.Is MS Office (Word, OneDrive) using Kerberos?
Additionally, I found that 10.14 machines that were not bound at the time of the update do not exhibit this behavior (e.g. they are still able to mount SMB shares). I have not tried to subsequently bind them but if I do, I'll post the results.It impacts only Businesses or Schools that use windows active directory and/or windows file servers.
Martin
It seems not only Active Directory.The problem is definitely being caused by the credentials cache, more specifically the Heimdal kcm (credential cache server) and seems limited to machines bound to a directory (possibly only Active Directory) before Security Update 2021-004 got installed.
On the script, I get a return with Directory not found. Any other ideas on where I can find those files?Following up from my previous post. After doing some (a lot of) reading about Heimdal Kerberos, reports on the #MacAdmin Slack and a lot of trial and error here is what I have discovered. The problem is definitely being caused by the credentials cache, more specifically the Heimdal kcm (credential cache server) and seems limited to machines bound to a directory (possibly only Active Directory) before Security Update 2021-004 got installed. It may also affect machines bound after the Security Update but I have not tested that. I have not yet figured out exactly what is happening but the end result is that updated machines are no longer able to access the credential cache; which consequently prevents any ticket action from taking place. I could only find two lines of interest form the logs and you can see that they relate directly to cache config:
View attachment 1782147
The fix (well, really just a stop-gap measure until I can discover the actual cause) is to basically tell the OS to ignore cached Kerberos credentials for authorization (as well as screensaver). A shout out to @jojo on #MacAdmins for confirming my suspicions. To do this you will need to edit two system files (yours should look similar to these):
Code:/etc/pam.d/authorization # authorization: auth account auth optional pam_krb5.so use_first_pass use_kcminit auth optional pam_ntlm.so use_first_pass auth required pam_opendirectory.so use_first_pass nullok account required pam_opendirectory.so /etc/pam.d/screensaver # screensaver: auth account auth optional pam_krb5.so use_first_pass use_kcminit auth required pam_opendirectory.so use_first_pass nullok account required pam_opendirectory.so account sufficient pam_self.so account required pam_group.so no_warn group=admin,wheel fail_safe account required pam_group.so no_warn deny group=admin,wheel ruser fail_safe
Using your favorite text editor (sudo) remove use_kcminit from each file.
For good measure I also killed related processes:
Code:sudo pkill coreauthd sudo pkill kcm sudo pkill kdc
In my testing this does not prevent remote users (those without connectivity to the domain controller) from logging into/unlocking their machines but I urge you to do your own testing before rolling it out.
I've also written a no-frills script to make it easy to deploy to users:
Bash:#!/bin/bash sed -i '' "s/use_kcminit//" "/etc/pam.d/authorization" sed -i '' "s/use_kcminit//" "/etc/pam.d/screensaver" pkill coreauthd pkill kcm pkill kdc
Thanks guys, the update was flawless but I always make a TM and a CCC backup prior to that.Not under normal circumstances. If you were using Kerberos for Office authentication you would know.
Additionally, I found that 10.14 machines that were not bound at the time of the update do not exhibit this behavior (e.g. they are still able to mount SMB shares). I have not tried to subsequently bind them but if I do, I'll post the results.
#!/bin/bash
## Mojave Security Update 2021-004 Kerberos hang fix/workaround
## Stops processes from hanging during Kerberos authentication on Active Directory bound machines
## by preventing macOS from asking for cached Kerberos credentials
## v1.1 - 27 May 2021
echo "Running pam.d fix"
## remove use_kcminit entry from pam.d authorization and screensaver
[[ -f /etc/pam.d/authorization ]] && sed -i '' "s/use_kcminit//" "/etc/pam.d/authorization" || echo "pam.d/authorization not found"; exit 1
[[ -f /etc/pam.d/screensaver ]] && sed -i '' "s/use_kcminit//" "/etc/pam.d/screensaver" || echo "pam.d/screensaver not found"; exit 2
# kill related processes
echo "Killing related processes"
pkill coreauthd kcm kdc
echo "Testing patch using klist"
## check success using klist
## "2>&1" - redirects stderr to stdout so even "Cache not found" gets stored in results
results=$(klist 2>&1 &)
## "&" - send klist to the background so even if it hangs the script will continue
sleep 2
if [[ $results ]]; then
echo "klist success"
else
echo "klist fail"
## kill backgrounded klist because it is likely to be stuck
pkill klist
echo "Patch failed"
exit 3
fi
## kill backgrounded klist in case it is still running
pkill klist
echo "Patch complete"
exit 0
Ah, thanks for the feedback. I'll make a few tweaks that should make it a bit more verbose. You can run a quick cat /etc/pam.d/authorization | grep use_kcminit to make sure it has actually been removed.Thankyou @croaker_1 ! I've spent the last 2 days thinking I was going mad, and finally today I see that while I may well be, this particular problem has external causes.. 😆
There may be an issue in your "improved" script; the only echo I got was "Running pam.d fix"- and nothing else. And the problem persisted. So I manually pkill'd coreauthd, kcm, kdc and then HUZZAH! - fixed. I can't see how your script snuck out without the exit 1 or exit 2 messages.. but it seems it did...
But anyway, thank you, thank you, thank you, for restoring my sanity.. or at least my ability to log in to things..!!
Version 1.2There may be an issue in your "improved" script; the only echo I got was "Running pam.d fix"- and nothing else.
#!/bin/bash
## Mojave Security Update 2021-004 Kerberos hang fix/workaround
## Stops processes from hanging during Kerberos authentication on Active Directory bound machines
## by preventing macOS from asking for cached Kerberos credentials
## v1.1 - 27 May 2021 - initial release
## v1.2 - 27 May 2021 - improved flow of the fix section, added extra status text
echo "Running pam.d fix"
## remove use_kcminit entry from pam.d authorization and screensaver
if [[ -f /etc/pam.d/authorization ]]; then
echo " 1 - Processing /etc/pam.d/authorization"
sed -i '' "s/use_kcminit//" "/etc/pam.d/authorization"
else
echo "/etc/pam.d/authorization not found"
echo "Patch failed"
exit 1
fi
if [[ -f /etc/pam.d/screensaver ]]; then
echo " 2 - Processing /etc/pam.d/screensaver"
sed -i '' "s/use_kcminit//" "/etc/pam.d/screensaver"
else
echo "/etc/pam.d/screensaver not found"
echo "Patch failed"
exit 2
fi
# kill related processes
echo " 3 - Killing related processes"
pkill coreauthd kcm kdc
echo " 4 - Testing fix using klist"
## check success using klist
## "2>&1" - redirects stderr to stdout so even "Cache not found" gets stored in results
results=$(klist 2>&1 &)
## "&" - send klist to the background so even if it hangs the script will continue
echo " 5 - Waiting two seconds"
sleep 2
echo " 6 - Checking test results"
if [[ $results ]]; then
echo "klist success"
else
echo " klist fail"
## kill backgrounded klist because it is likely to be stuck
pkill klist
echo "Patch failed"
exit 3
fi
## kill backgrounded klist in case it is still running
pkill klist
echo "Patch complete"
exit 0
#!/bin/bash
sed -i '' "s/pam_krb5.so.*/&use_kcminit/" "/etc/pam.d/authorization"
sed -i '' "s/pam_krb5.so.*/&use_kcminit/" "/etc/pam.d/screensaver"
precheck=$(klist 2>&1 &)
sleep 2
if [[ $precheck ]]; then
echo "klist success"
echo "All good. Patch not required"
exit 0
else
echo "klist fail"
## kill backgrounded klist because it is likely to be stuck
pkill klist
echo "Patch is required. Keep going..."
fi
precheck=$(klist 2>&1 &)
sleep 2
if [[ $precheck ]]; then
echo "klist success"
echo "All good. Patch not required"
exit 0
else
echo "klist fail"
## kill backgrounded klist because it is likely to be stuck
pkill klist
echo "Patch is required. Keep going..."
fi
Apologies for ignorance, put what is Kerberos?We're having kerberos issues with machines that have updated. Haven't got it figured out yet...
On what hardware?Good question. Ignorance is bliss. I installed the update anyway a few days ago. I've not noticed any problems.
"Google" to the rescue...Apologies for ignorance, put what is Kerberos?
Mac MiniOn what hardware?
This bug only affects machine bound to Active Directory (i.e. within a company, school, organization, etc.)Good question. Ignorance is bliss. I installed the update on my Mini anyway a few days ago. I've not noticed any problems.
Ah...thanks for the feedback. I was not able to find an unpatched machine to test this on. I had assumed (silly me) that the background (&) called the command (klist) but maybe it is the other way around. I'll do some reading and testing: if there is a better way I'll post more info here.NOTE - this appears to hang when on a Mac that is already experiencing the issue. Curious if others have attempted to add this to the script.
Bash:precheck=$(klist 2>&1 &) sleep 2 if [[ $precheck ]]; then echo "klist success" echo "All good. Patch not required" exit 0 else echo "klist fail" ## kill backgrounded klist because it is likely to be stuck pkill klist echo "Patch is required. Keep going..." fi