I need to write a very simple shell script that will check if the system is configured to enforce multi-factor authentication.
To verify that the system is configured to enforce multi-factor authentication, run the following commands:
If the results do not show "enforceSmartCard=1", this is a finding.
I created this very simple script, but I am pretty sure there is a more effective, elegant and efficient way to achieve the same result.
Basically if it was you, what kind of modifications would you apply to the script below to achieve the same results?
Thank you so much in advance for your help.
To verify that the system is configured to enforce multi-factor authentication, run the following commands:
/usr/sbin/system_profiler SPConfigurationProfileDataType | /usr/bin/grep enforceSmartCard
If the results do not show "enforceSmartCard=1", this is a finding.
I created this very simple script, but I am pretty sure there is a more effective, elegant and efficient way to achieve the same result.
Basically if it was you, what kind of modifications would you apply to the script below to achieve the same results?
Thank you so much in advance for your help.
#!/bin/zsh
myVAR=`/usr/sbin/system_profiler SPConfigurationProfileDataType | /usr/bin/grep enforceSmartCard`
if [ $myVAR = "enforceSmartCard=1" ]
then
echo "The system is configured to enforce multi-factor authentication"
else
echo "The system is not configured to enforce multi-factor authentication"
fi