├── .gitignore ├── Add Username Spelling.sh ├── Cert Cleaner - sanitized.sh ├── Deprecated ├── BraveBrowser - Install Latest version.sh ├── Cisco Webex - install latest version.sh ├── Lastpass - Install Latest version.sh ├── Update_keychain_password.sh └── pass_phrase.py ├── README.md ├── Reset GlobalProtect - Multiple Portals.sh ├── SentinelOne ├── README.md ├── SentinelOne_Version_EA.sh ├── screenshots │ ├── SentinelOne_Policy_Packages.png │ ├── SentinelOne_Policy_Scripts.png │ └── SentinelOne_registration_token.png └── sentineone_postinstall.sh ├── Update_local_password_for_jamf_connect ├── add localadmin to filevault.sh ├── remote_AD_user_creation.sh ├── remove_and_readd_user_to_filevault ├── rescue_account ├── README.md ├── Rescue Password - Local - EA.sh ├── Rescue_Account_Password_Change.sh ├── pass_phrase.sh ├── rescue_account_cleanup.sh └── screenshots │ ├── ChangeRescuePassword_scope.png │ ├── CreateRescueAccount.png │ ├── JamfConnect_prohibitedfromnetworkaccountconnection.png │ ├── JamfConnect_userswithlocalauth.png │ ├── RescueAccount_Cleanup.png │ ├── RescueAccount_EA_ComputerRecord.png │ ├── RescueAccount_InstalledNotEncrypted_group.png │ ├── RescueAccount_Installed_group.png │ ├── RescueAccount_NeedsCleaned_group.png │ ├── RescueAccount_passwordNeedsReset_group.png │ ├── Rescue_Password_EA.png │ ├── Rescue_Password_Local_EA.png │ ├── adjective.txt_example.png │ └── passphrase_folder_setup.png └── update_safari_if_closed /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | .DS_Store 4 | .DS_Store 5 | .DS_Store 6 | .DS_Store 7 | -------------------------------------------------------------------------------- /Add Username Spelling.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## We are going to add a list of words to the users dictionary so that they are not autocorrected in an annoying way. 4 | ## this will hopefully prevent the thing where Okta login windows try to autocorrect usernames 5 | 6 | # started off with script from 7 | # https://macadmins.slack.com/archives/C07MGJ2SD/p1504615636000539 8 | 9 | companyName="YourCompanyNameHere" 10 | 11 | ######################################################################################### 12 | ## Get logged in user from Console. 13 | loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' ) 14 | 15 | ## make sure there is a value and that it's not any of the accounts that can occasionally be a result of the console method and have an error. 16 | if [[ -z "$loggedInUser" ]] || [[ "$loggedInUser" == 'root' ]] || [[ "$loggedInUser" == "loginwindow" ]] || [[ "$loggedInUser" == "_mbsetupuser" ]] ; then 17 | ## if it's not a valid user let's' take the result from jamf 18 | loggedInUser="$3" 19 | fi 20 | ## convert logged in user to lowercase 21 | ## sometimes we get an mixed case user and it can create inconsistent results 22 | if [ -n "$BASH_VERSION" ]; then 23 | # assume Bash 24 | loggedInUser=$( echo "$loggedInUser" | tr [:upper:] [:lower:] ) 25 | else 26 | # assume something else 27 | echo "script not written in bash, leaving as mixedcase." 28 | fi 29 | ## Make sure again that the user is valid. It's possible that $3 from Jamf is also an invalid user. 30 | if [[ -z "$loggedInUser" ]] || [[ "$loggedInUser" == 'root' ]] || [[ "$loggedInUser" == "loginwindow" ]] || [[ "$loggedInUser" == "_mbsetupuser" ]] ; then 31 | echo "Failed to gather loggedInUser correctly" 32 | exit 1 33 | else 34 | echo "loggedInUser is $loggedInUser" 35 | fi 36 | 37 | fullName=$( id -P $(stat -f%Su /dev/console) | awk -F '[:]' '{print $8}' ) 38 | 39 | LocalDictionary="/Users/${loggedInUser}/Library/Spelling/LocalDictionary" 40 | words=("${companyName}" "$loggedInUser" "$fullName") 41 | 42 | # Backup LocalDictionary 43 | cp $LocalDictionary ${LocalDictionary}.backup 44 | 45 | # Append each word from the list 46 | for word in "${words[@]}" 47 | do 48 | echo "$word" >> $LocalDictionary 49 | done 50 | 51 | # Sort case-insensitive out to the same file 52 | sort -f $LocalDictionary -o $LocalDictionary 53 | 54 | chown -R "$loggedInUser" "$LocalDictionary" 55 | chmod -R 644 "$LocalDictionary" 56 | 57 | exit 0 -------------------------------------------------------------------------------- /Cert Cleaner - sanitized.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | ## Based on script found at https://macadmins.slack.com/archives/CAL8UHH1N/p1576618800010400?thread_ts=1576576382.005200&cid=CAL8UHH1N 3 | 4 | ## Update the Cert Subject on line 28 and the email address format on line 51 5 | 6 | loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' ) 7 | 8 | if [[ -z "$loggedInUser" ]] || [[ "$loggedInUser" == 'root' ]] || [[ "$loggedInUser" == "loginwindow" ]] || [[ "$loggedInUser" == "_mbsetupuser" ]] ; then 9 | loggedInUser="$3" 10 | fi 11 | 12 | loggedInUser=$( echo "$loggedInUser" | tr [:upper:] [:lower:] ) 13 | 14 | if [[ -z "$loggedInUser" ]] || [[ "$loggedInUser" == 'root' ]] || [[ "$loggedInUser" == "loginwindow" ]] ; then 15 | echo "Failed to gather loggedInUser correctly" 16 | exit 1 17 | else 18 | echo "loggedInUser is $loggedInUser" 19 | fi 20 | # 21 | loggedInUID=$(id -u "$loggedInUser") 22 | 23 | userKeychain="/Users/$loggedInUser/Library/Keychains/login.keychain-db" 24 | 25 | # This script will remove all instances of a system keychain cert where: 26 | # 1) The certificate subject matches the cert subject below. 27 | # 2) It does not have the latest expiration date. 28 | certSubject="YOURDOMAINHERE" 29 | #certList=$( /bin/launchctl asuser "$loggedInUID" sudo -iu "$loggedInUser" security find-certificate -c "${certSubject}" -p -a "${userKeychain}") 30 | 31 | ## find all certs 32 | certList=$( /bin/launchctl asuser "$loggedInUID" sudo -iu "$loggedInUser" security find-certificate -p -a "${userKeychain}") 33 | 34 | #echo "$certList" 35 | 36 | # Get each cert into an array element 37 | # Remove spaces 38 | certList=$( echo "$certList" | sed 's/ //g' ) 39 | # Put a space after the end of each cert 40 | certList=$( echo "$certList" | sed 's/-----ENDCERTIFICATE-----/-----ENDCERTIFICATE----- /g' ) 41 | # echo "$certList" 42 | OIFS="$IFS" 43 | IFS=' ' 44 | # read -a certArray <<< "${certList}" 45 | declare -a certArray=($certList) 46 | IFS="$OIFS" 47 | i=-1 48 | dateHashList='' 49 | 50 | ## get a list of all keychain identities 51 | identityList=`/bin/launchctl asuser "$loggedInUID" sudo -iu "$loggedInUser" security find-identity -p smime -s @YOURDOMAINHHERE.com $userKeychain` 52 | ## remove all newlines 53 | identityList=${identityList//[$'\t\r\n']} 54 | 55 | 56 | declare -a deleteArray=() 57 | 58 | ## Go through the certs and add all the certs in the certArray to a deleteArray if the are in the identityList string 59 | 60 | for rawCert in "${certArray[@]}"; do 61 | let "i++" 62 | echo '--------' 63 | 64 | # Fix the begin/end certificate 65 | cert=$( echo "$rawCert" | sed 's/-----BEGINCERTIFICATE-----/-----BEGIN CERTIFICATE-----/g' ) 66 | cert=$( echo "$cert" | sed 's/-----ENDCERTIFICATE-----/-----END CERTIFICATE-----/g' ) 67 | certMD5=$( echo "$cert" | openssl x509 -noout -fingerprint -sha1 -inform pem | cut -d "=" -f 2 | sed 's/://g' ) 68 | 69 | echo "" 70 | echo "searching identity list" 71 | echo "${identityList}" 72 | echo "" 73 | 74 | if [[ "${identityList}" == *"${certMD5}"* ]] ; then 75 | echo "Item found in identity list" 76 | echo " " 77 | else 78 | deleteArray+=( "$rawCert" ) 79 | echo "adding '${certMD5}' to deleteArray" 80 | fi 81 | done 82 | 83 | echo "There are ${#certArray[@]} items in certArray" 84 | echo "There are ${#deleteArray[@]} items in deleteArray" 85 | 86 | for target in "${deleteArray[@]}"; do 87 | echo "" 88 | echo "parsing Delete Array Item" 89 | #echo "$target" 90 | for item in "${!certArray[@]}"; do 91 | if [[ ${certArray[item]} == $target ]]; then 92 | echo "item being unset from certArray" 93 | unset 'certArray[item]' 94 | fi 95 | done 96 | done 97 | 98 | echo "There are now ${#certArray[@]} items in certArray" 99 | 100 | 101 | ######################################################################################### 102 | ## go through the remaining certs and 103 | i=-1 104 | # Print what we got... 105 | for cert in "${certArray[@]}"; do 106 | let "i++" 107 | echo '---------' 108 | # echo "$cert" 109 | # echo '--' 110 | # Fix the begin/end certificate 111 | cert=$( echo "$cert" | sed 's/-----BEGINCERTIFICATE-----/-----BEGIN CERTIFICATE-----/g' ) 112 | cert=$( echo "$cert" | sed 's/-----ENDCERTIFICATE-----/-----END CERTIFICATE-----/g' ) 113 | # echo "$cert" 114 | # echo "$cert" | openssl x509 -text 115 | certMD5=$( echo "$cert" | openssl x509 -noout -fingerprint -sha1 -inform pem | cut -d "=" -f 2 | sed 's/://g' ) 116 | certDate=$( echo "$cert" | openssl x509 -text | grep 'Not After' | sed -E 's|.*Not After : ||' ) 117 | certDateFormatted=`date -jf "%b %d %T %Y %Z" "${certDate}" +%Y%m%d%H%M%S` 118 | echo "Cert ${i} : ${certDate} => $certDateFormatted" 119 | echo "Cert ${i} : ${certMD5}" 120 | NL=$'\n' 121 | dateHashList="${dateHashList}${NL}${certDateFormatted} ${certMD5}" 122 | done 123 | echo 124 | dateHashList=$( echo "$dateHashList" | sort | uniq ) 125 | lines=$( echo "$dateHashList" | wc -l | tr -d ' ' ) 126 | let "lines--" 127 | echo "[info] There are $lines lines in the certificate date-hash list." 128 | echo 129 | i=0 130 | OIFS="$IFS" 131 | IFS=$'\n' # make newlines the only separator 132 | for dateHash in $dateHashList; do 133 | let "i++" 134 | dateNum="${dateHash%% *}" 135 | hash="${dateHash##* }" 136 | echo "${i}| Hash : \"$hash\" | dateNum : \"$dateNum\"" 137 | if [[ i -ne $lines ]]; then 138 | echo "=> This cert will be removed" 139 | /bin/launchctl asuser "$loggedInUID" sudo -iu "$loggedInUser" security delete-identity -Z $hash "${userKeychain}" 140 | echo 141 | else 142 | echo "=> This cert will not be touched because it has the latest expiration date." 143 | fi 144 | done 145 | IFS="$OIFS" 146 | exit 0 147 | -------------------------------------------------------------------------------- /Deprecated/BraveBrowser - Install Latest version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## I stopped using this. Installomator does it way better 4 | 5 | # https://github.com/Installomator/Installomator 6 | 7 | #based on a script that installs the latest version of Chrome 8 | 9 | dmgfile="Brave-Broswer.dmg" 10 | volname="Brave Browser" 11 | logfile="/Library/Logs/BraveInstallScript.log" 12 | 13 | url='https://brave-browser-downloads.s3.brave.com/latest/Brave-Browser.dmg' 14 | 15 | 16 | /bin/echo "--" >> ${logfile} 17 | /bin/echo "`date`: Downloading latest version." >> ${logfile} 18 | /usr/bin/curl -s -o /tmp/${dmgfile} ${url} 19 | /bin/echo "`date`: Mounting installer disk image." >> ${logfile} 20 | /usr/bin/hdiutil attach /tmp/${dmgfile} -nobrowse -quiet 21 | /bin/echo "`date`: Installing..." >> ${logfile} 22 | ditto -rsrc "/Volumes/${volname}/Brave Browser.app" "/Applications/Brave Browser.app" 23 | /bin/sleep 10 24 | /bin/echo "`date`: Unmounting installer disk image." >> ${logfile} 25 | /usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep "${volname}" | awk '{print $1}') -quiet 26 | /bin/sleep 10 27 | /bin/echo "`date`: Deleting disk image." >> ${logfile} 28 | /bin/rm /tmp/"${dmgfile}" 29 | 30 | exit 0 -------------------------------------------------------------------------------- /Deprecated/Cisco Webex - install latest version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## I stopped using this. Installomator does it way better 4 | 5 | # https://github.com/Installomator/Installomator 6 | 7 | # Based on a script that installs the latest version of chrome. 8 | 9 | loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' ) 10 | 11 | if [[ -z "$loggedInUser" ]] || [[ "$loggedInUser" == 'root' ]] || [[ "$loggedInUser" == "loginwindow" ]] ; then 12 | echo "Failed to gather loggedInUser correctly" 13 | exit 1 14 | else 15 | echo "loggedInUser is $loggedInUser" 16 | fi 17 | loggedInUID=$(id -u "$loggedInUser") 18 | 19 | 20 | dmgfile="webexapp.dmg" 21 | volname="Cisco Webex Meetings" 22 | logfile="/Library/Logs/WebexInstallScript.log" 23 | installerName="Cisco Webex Meetings.pkg" 24 | 25 | url='https://akamaicdn.webex.com/client/webexapp.dmg' 26 | 27 | 28 | /bin/echo "--" >> ${logfile} 29 | /bin/echo "`date`: Downloading latest version." >> ${logfile} 30 | /usr/bin/curl -s -o /tmp/${dmgfile} ${url} 31 | /bin/echo "`date`: Mounting installer disk image." >> ${logfile} 32 | /usr/bin/hdiutil attach /tmp/${dmgfile} -nobrowse -quiet 33 | /bin/echo "`date`: Installing..." >> ${logfile} 34 | 35 | ### run the installer as the user 36 | /bin/launchctl asuser "$loggedInUID" /usr/sbin/installer -pkg "/Volumes/${volname}/${installerName}" -target / 37 | /bin/sleep 10 38 | /bin/echo "`date`: Unmounting installer disk image." >> ${logfile} 39 | /usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep "${volname}" | awk '{print $1}') -quiet 40 | /bin/sleep 10 41 | /bin/echo "`date`: Deleting disk image." >> ${logfile} 42 | /bin/rm /tmp/"${dmgfile}" 43 | 44 | exit 0 45 | -------------------------------------------------------------------------------- /Deprecated/Lastpass - Install Latest version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ## I stopped using this. Installomator does it way better 4 | 5 | # https://github.com/Installomator/Installomator 6 | 7 | #based on a script that installs the latest version of Chrome 8 | 9 | 10 | dmgfile="LastPass.dmg" 11 | volname="LastPass Installer" 12 | logfile="/Library/Logs/LastPassInstallScript.log" 13 | 14 | url='https://lastpass.com/safariAppExtension.php?source=download' 15 | 16 | 17 | /bin/echo "--" >> ${logfile} 18 | /bin/echo "`date`: Downloading latest version." >> ${logfile} 19 | /usr/bin/curl -s -o /tmp/${dmgfile} ${url} 20 | /bin/echo "`date`: Mounting installer disk image." >> ${logfile} 21 | /usr/bin/hdiutil attach /tmp/${dmgfile} -nobrowse -quiet 22 | /bin/echo "`date`: Installing..." >> ${logfile} 23 | ditto -rsrc "/Volumes/${volname}/LastPass.app" "/Applications/LastPass.app" 24 | /bin/sleep 10 25 | /bin/echo "`date`: Unmounting installer disk image." >> ${logfile} 26 | /usr/bin/hdiutil detach $(/bin/df | /usr/bin/grep "${volname}" | awk '{print $1}') -quiet 27 | /bin/sleep 10 28 | /bin/echo "`date`: Deleting disk image." >> ${logfile} 29 | /bin/rm /tmp/"${dmgfile}" 30 | 31 | exit 0 -------------------------------------------------------------------------------- /Deprecated/Update_keychain_password.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ## This script isn't really useful anymore. 4 | ## Once computers stopped being bound to AD this stopped being a problem. There are a bunch of things I could do better now if I was to still use a process like this. 5 | ## I also found that even though it made perfect sense to me, helpdesk team members never got very comfortable with this process 6 | 7 | ##UPDATE KEYCHAIN PASSWORD 8 | ## Written by adamcraig https://github.com/theadamcraig/jamf-scripts 9 | ## Last updated 4/02/2020 10 | ## Fixed Filevault Bug 11 | ## added user authentication check 12 | ## Added ability to remove and re-add user from filevault as well. 13 | 14 | loggedInUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ && ! /loginwindow/ { print $3 }' ) 15 | 16 | if [[ -z "$loggedInUser" ]] || [[ "$loggedInUser" == 'root' ]] || [[ "$loggedInUser" == "loginwindow" ]] ; then 17 | echo "Failed to gather loggedInUser correctly" 18 | exit 1 19 | else 20 | echo "loggedInUser is $loggedInUser" 21 | fi 22 | 23 | loggedInUID=$(id -u "$loggedInUser") 24 | 25 | adminName=$4 26 | adminPass=$5 27 | 28 | ## Find the renamed keychains 29 | renamed="" 30 | 31 | for n in {1..9} ; do 32 | long="Users/$loggedInUser/Library/Keychains/login_renamed_$n.keychain-db" 33 | short="login_renamed_$n.keychain-db" 34 | echo "$long" 35 | if [[ ! -f $long ]] ; then 36 | echo "Above Keychain not Found" 37 | else 38 | renamed="$long" 39 | short_renamed="$short" 40 | echo "renamed set to Above Keychain" 41 | fi 42 | done 43 | 44 | ## If the rename keychain isn't found then exit 45 | 46 | if [[ -z "$renamed" ]] ; then 47 | echo "Renamed keychain not found." 48 | dialog="Old keychain not found." 49 | cmd="Tell app \"System Events\" to display dialog \"$dialog\"" 50 | /usr/bin/osascript -e "$cmd" 51 | exit 1 52 | fi 53 | 54 | #renamed=`echo ${renamed%???}` 55 | 56 | echo "Prompting user for current password" 57 | 58 | ## Prompt use for current password 59 | currentPass=$(/usr/bin/osascript<