From 56c9b050e2678a7dd713b6039c45a0bfa3360eb6 Mon Sep 17 00:00:00 2001 From: Zack T Date: Tue, 29 Aug 2017 11:18:09 -0700 Subject: [PATCH] v2.0 = Accounted for different OS Versions + Updated to match associated Jamf configuration script + Accounted for different OS Versions and how SMB is configured in each. --- .../jamf_ea_SMBProtocol.sh | 84 ++++++++++++------- 1 file changed, 53 insertions(+), 31 deletions(-) diff --git a/Jamf Pro/Extension Attributes/jamf_ea_SMBProtocol.sh b/Jamf Pro/Extension Attributes/jamf_ea_SMBProtocol.sh index aba967e..0138a91 100644 --- a/Jamf Pro/Extension Attributes/jamf_ea_SMBProtocol.sh +++ b/Jamf Pro/Extension Attributes/jamf_ea_SMBProtocol.sh @@ -3,56 +3,78 @@ ################################################################################################### # Script Name: jamf_ea_SMBProtocol.sh # By: Zack Thompson / Created: 7/3/2017 -# Version: 1.0 / Updated: 7/3/2017 / By: ZT +# Version: 2.0 / Updated: 7/19/2017 / By: ZT # # Description: This script gets the configuration of the SMB Protocol on a Mac. # ################################################################################################### -echo "Checking the SMB Protocols allowed on this Mac..." +/bin/echo "Checking the SMB Protocols allowed on this Mac..." + +################################################## +# Define Variables +OSVersion=$(/usr/bin/sw_vers -productVersion | /usr/bin/awk -F . '{print $1"."$2}') + +if [[ $OSVersion == 10.12 ]]; then + smbKey="sprotocol_vers_map" +else + smbKey="smb_neg" +fi +################################################## # Check if file exists. if [[ -e /etc/nsmb.conf ]]; then - # If it exists, check if the SMB Protocol is set. - nsmbSMBProtocol=$(cat /etc/nsmb.conf | /usr/bin/grep "sprotocol_vers_map" | awk -F "=" '{print $2}') + # If it exists, check if the SMB Protocol is set. + nsmbSMBProtocol=$(/bin/cat /etc/nsmb.conf | /usr/bin/grep "$smbKey" | /usr/bin/awk -F "=" '{print $2}') - # Check if Protocol is currently configured. - if [[ -z $nsmbSMBProtocol ]]; then - # Protocol is not configured... + # Check if Protocol is currently configured. + if [[ -z $nsmbSMBProtocol ]]; then + # Protocol is not configured... - # Return 'Not Configured' - echo "Not Configured" + # Return 'Not Configured' + /bin/echo "Not Configured" - elif [[ $nsmbSMBProtocol == "7" ]]; then - # Return SMBv1_v2_v3 - echo "SMBv1_v2_v3" + elif [[ $nsmbSMBProtocol == "7" ]]; then + # Return SMBv1_v2_v3 + /bin/echo "SMBv1_v2_v3" - elif [[ $nsmbSMBProtocol == "6" ]]; then - # Return SMBv2_v3 - echo "SMBv2_v3" + elif [[ $nsmbSMBProtocol == "6" ]]; then + # Return SMBv2_v3 + /bin/echo "SMBv2_v3" - elif [[ $nsmbSMBProtocol == "4" ]]; then - # Return SMBv3 - echo "SMBv3" + elif [[ $nsmbSMBProtocol == "4" ]]; then + # Return SMBv3 + /bin/echo "SMBv3" - elif [[ $nsmbSMBProtocol == "2" ]]; then - # Return SMBv2 - echo "SMBv2" + elif [[ $nsmbSMBProtocol == "2" ]]; then + # Return SMBv2 + /bin/echo "SMBv2" - elif [[ $nsmbSMBProtocol == "1" ]]; then - # Return SMBv1 - echo "SMBv1" + elif [[ $nsmbSMBProtocol == "1" ]]; then + # Return SMBv1 + /bin/echo "SMBv1" + elif [[ $nsmbSMBProtocol == "normal" ]]; then + # Return SMBv1_v2 + /bin/echo "SMBv1_v2" - else - # Return Unknown - echo "Unknown Configuration" - fi + elif [[ $nsmbSMBProtocol == "smb1_only" ]]; then + # Return SMBv1 + /bin/echo "SMBv1" + + elif [[ $nsmbSMBProtocol == "smb2_only" ]]; then + # Return SMBv2 + /bin/echo "SMBv2" + + else + # Return Unknown + /bin/echo "Unknown Configuration" + fi else - # File does not exist... + # File does not exist... - # Return 'Not Configured' - echo "Not Configured" + # Return 'Not Configured' + /bin/echo "Not Configured" fi exit 0 \ No newline at end of file