diff --git a/PowerShell/JumpCloud Commands Gallery/Mac Commands/Mac - Install Sentinel One Agent.md b/PowerShell/JumpCloud Commands Gallery/Mac Commands/Mac - Install Sentinel One Agent.md index b15a4bbec..3101e4820 100644 --- a/PowerShell/JumpCloud Commands Gallery/Mac Commands/Mac - Install Sentinel One Agent.md +++ b/PowerShell/JumpCloud Commands Gallery/Mac Commands/Mac - Install Sentinel One Agent.md @@ -1,6 +1,6 @@ #### Name -Mac - Install Sentinel One Agent | v1.0 JCCG +Mac - Install Sentinel One Agent | v1.0.1 JCCG #### commandType @@ -15,6 +15,7 @@ sentinelToken="YOURTOKEN" DownloadURL="https://path/to/url.pkg" ############### Do Not Edit Below This Line ############### +set -e filename="sentineloneagent.pkg" @@ -36,8 +37,7 @@ mkdir /tmp/$TempFolder cd /tmp/$TempFolder # Download Sentinel One file -curl -o $filename $DownloadURL - +curl --fail -o "$filename" "$DownloadURL" DownloadFile="$(ls)" echo "Downloaded $DownloadFile to /tmp/$TempFolder" diff --git a/PowerShell/JumpCloud Commands Gallery/commands.json b/PowerShell/JumpCloud Commands Gallery/commands.json index c725fecfb..55747d442 100644 --- a/PowerShell/JumpCloud Commands Gallery/commands.json +++ b/PowerShell/JumpCloud Commands Gallery/commands.json @@ -140,9 +140,9 @@ "description": "This command will download and install the JumpCloud Password Manager to the device if it isn't already installed. On slower networks, timeouts with exit code 127 can occur. Manually setting the default timeout limit to 600 seconds may be advisable." }, { - "name": "Mac - Install Sentinel One Agent | v1.0 JCCG", + "name": "Mac - Install Sentinel One Agent | v1.0.1 JCCG", "type": "mac", - "command": "#!/bin/bash\n\nsentinelToken=\"YOURTOKEN\"\nDownloadURL=\"https://path/to/url.pkg\"\n\n############### Do Not Edit Below This Line ###############\n\nfilename=\"sentineloneagent.pkg\"\n\n# Check if already installed\nif [[ -d /Applications/SentinelOne/ ]]\n then\n echo \"Sentinel One Agent is Already Installed. Exiting...\"\n exit 0\nfi\n\n# Create Temp Folder\n#\nDATE=$(date '+%Y-%m-%d-%H-%M-%S')\nTempFolder=\"Download-$DATE\"\nmkdir /tmp/$TempFolder\n\n# Navigate to Temp Folder\n#\ncd /tmp/$TempFolder\n\n# Download Sentinel One file\ncurl -o $filename $DownloadURL\n\n\nDownloadFile=\"$(ls)\"\necho \"Downloaded $DownloadFile to /tmp/$TempFolder\"\n\n# Verifies PKG File\n#\nregex='\\.pkg$'\nif [[ $DownloadFile =~ $regex ]]; then\n PKGFile=\"$(echo \"$DownloadFile\")\"\n echo \"PKG File Found: $PKGFile\"\nelse\n echo \"File: $DownloadFile is not a PKG\"\n rm -r /tmp/$TempFolder\n echo \"Deleted /tmp/$TempFolder\"\n exit 1\nfi\n\n#Set Token\necho $sentinelToken > /tmp/$TempFolder/com.sentinelone.registration-token\n\n# Check signature and install\ncheck_pkg_sign=$(pkgutil --check-signature $PKGFile)\nif [[ $check_pkg_sign == *\"AYE5J54KN\"* ]] && [[ $check_pkg_sign == *\"Status: signed by a developer certificate issued by Apple\"* ]] && [[ $check_pkg_sign == *\"Notarization: trusted by the Apple notary service\"* ]]\nthen\n echo \"Package is signed. Installing...\"\n\n # Install Agent\n /usr/sbin/installer -pkg /tmp/$TempFolder/$PKGFile -target /Applications\nelse\n echo \"Package is unsigned. Exiting...\"\n exit 1\nfi\n\n# Remove Temp Folder and download\nrm -r /tmp/$TempFolder\necho \"Deleted /tmp/$TempFolder\"", + "command": "#!/bin/bash\n\nsentinelToken=\"YOURTOKEN\"\nDownloadURL=\"https://path/to/url.pkg\"\n\n############### Do Not Edit Below This Line ###############\nset -e\n\nfilename=\"sentineloneagent.pkg\"\n\n# Check if already installed\nif [[ -d /Applications/SentinelOne/ ]]\n then\n echo \"Sentinel One Agent is Already Installed. Exiting...\"\n exit 0\nfi\n\n# Create Temp Folder\n#\nDATE=$(date '+%Y-%m-%d-%H-%M-%S')\nTempFolder=\"Download-$DATE\"\nmkdir /tmp/$TempFolder\n\n# Navigate to Temp Folder\n#\ncd /tmp/$TempFolder\n\n# Download Sentinel One file\ncurl --fail -o \"$filename\" \"$DownloadURL\"\n\nDownloadFile=\"$(ls)\"\necho \"Downloaded $DownloadFile to /tmp/$TempFolder\"\n\n# Verifies PKG File\n#\nregex='\\.pkg$'\nif [[ $DownloadFile =~ $regex ]]; then\n PKGFile=\"$(echo \"$DownloadFile\")\"\n echo \"PKG File Found: $PKGFile\"\nelse\n echo \"File: $DownloadFile is not a PKG\"\n rm -r /tmp/$TempFolder\n echo \"Deleted /tmp/$TempFolder\"\n exit 1\nfi\n\n#Set Token\necho $sentinelToken > /tmp/$TempFolder/com.sentinelone.registration-token\n\n# Check signature and install\ncheck_pkg_sign=$(pkgutil --check-signature $PKGFile)\nif [[ $check_pkg_sign == *\"AYE5J54KN\"* ]] && [[ $check_pkg_sign == *\"Status: signed by a developer certificate issued by Apple\"* ]] && [[ $check_pkg_sign == *\"Notarization: trusted by the Apple notary service\"* ]]\nthen\n echo \"Package is signed. Installing...\"\n\n # Install Agent\n /usr/sbin/installer -pkg /tmp/$TempFolder/$PKGFile -target /Applications\nelse\n echo \"Package is unsigned. Exiting...\"\n exit 1\nfi\n\n# Remove Temp Folder and download\nrm -r /tmp/$TempFolder\necho \"Deleted /tmp/$TempFolder\"", "link": "https://github.com/TheJumpCloud/support/blob/master/PowerShell/JumpCloud%20Commands%20Gallery/Mac%20Commands/Mac%20-%20Install%20Sentinel%20One%20Agent.md", "description": "This command will download and install the Sentinel One Agent to the device if it isn't already installed.\n\nSpecifically for this command:\n\n1. Download the Sentinel One Agent installer and host it at a URL that your devices can access. Set this URL to the \"DownloadURL\" of this script.\n2. Extend the command timeout to a value that makes sense in your environment. The suggested command timeout for an environment with average network speeds on devices with average computing power is 10 minutes. Note that the command may timeout with a 124 error code in the command result window if not extended, but the script will continue to run." },