Skip to content

Commit

Permalink
bump version to denote change in template json
Browse files Browse the repository at this point in the history
  • Loading branch information
jworkmanjc committed Nov 15, 2023
1 parent dee4196 commit 8cbcbd5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#### Name

Mac - Install JumpCloud Password Manager App | v1.2 JCCG
Mac - Install JumpCloud Password Manager App | v1.3 JCCG

#### commandType

Expand Down
2 changes: 1 addition & 1 deletion PowerShell/JumpCloud Commands Gallery/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"description": "This command will download and install the CrowdStrike Falcon Agent to the device if it isn't already installed. The command will leverage CrowdStrike's API to find and download the latest version of the Falcon Agent onto the local machine.\n\nIn order to use this command, follow the instructions from the [Installing the CrowdStrike Falcon Agent KB](https://support.jumpcloud.com/s/article/Installing-the-Crowdstrike-Falcon-Agent)\n\n[Richard Purves' blog post on Downloading Crowdstrike](https://richard-purves.com/2022/05/03/downloading-crowdstrike-via-api-for-fun-and-profit/) inspired this command template.\n\nSpecifically for this command:\n\n1. Create a CrowdStrike API Client with the \"SENSOR DOWNLOAD\" Read scope and make note of the ClientID and ClientSecret. Refer to CrowdStrike's article [Getting Access to the CrowdStrike API](https://www.crowdstrike.com/blog/tech-center/get-access-falcon-apis/) for further information\n2. Set the 3 variables (CSBaseAddress, CSClientID, CSClientSecret) to their respective values for your CrowdStrike API Client\n 1. If you have Require Token enabled for your CrowdStrike org, set the CSInstallToken variable with your installation token\n3. 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."
},
{
"name": "Mac - Install JumpCloud Password Manager App | v1.2 JCCG",
"name": "Mac - Install JumpCloud Password Manager App | v1.3 JCCG",
"type": "mac",
"command": "#!/bin/bash\n\n# This script will install password manager in Users/$user/Applications for all user accounts\n\nDownloadUrl=\"https://cdn.pwm.jumpcloud.com/DA/release/JumpCloud-Password-Manager-latest.dmg\"\n\nregex='^https.*.dmg$'\nif [[ $DownloadUrl =~ $regex ]]; then\n echo \"URL points to direct DMG download\"\n validLink=\"True\"\nelse\n echo \"Searching headers for download links\"\n urlHead=$(curl -s --head $DownloadUrl)\n\n locationSearch=$(echo \"$urlHead\" | grep https:)\n\n if [ -n \"$locationSearch\" ]; then\n\n locationRaw=$(echo \"$locationSearch\" | cut -d' ' -f2)\n\n locationFormatted=\"$(echo \"${locationRaw}\" | tr -d '[:space:]')\"\n\n regex='^https.*'\n if [[ $locationFormatted =~ $regex ]]; then\n echo \"Download link found\"\n DownloadUrl=$(echo \"$locationFormatted\")\n else\n echo \"No https location download link found in headers\"\n exit 1\n fi\n\n else\n\n echo \"No location download link found in headers\"\n exit 1\n fi\n\nfi\n\n\n\n#Create Temp Folder\nDATE=$(date '+%Y-%m-%d-%H-%M-%S')\n\nTempFolder=\"Download-$DATE\"\n\nmkdir /tmp/$TempFolder\n\n# Navigate to Temp Folder\ncd /tmp/$TempFolder\n\n# Download File into Temp Folder\ncurl -s -O \"$DownloadUrl\"\n\n# Capture name of Download File\nDownloadFile=\"$(ls)\"\n\necho \"Downloaded $DownloadFile to /tmp/$TempFolder\"\n\n# Verifies DMG File\nregex='\\.dmg$'\nif [[ $DownloadFile =~ $regex ]]; then\n DMGFile=\"$(echo \"$DownloadFile\")\"\n echo \"DMG File Found: $DMGFile\"\nelse\n echo \"File: $DownloadFile is not a DMG\"\n rm -r /tmp/$TempFolder\n echo \"Deleted /tmp/$TempFolder\"\n exit 1\nfi\n\n# Mount DMG File -nobrowse prevents the volume from popping up in Finder\n\nhdiutilAttach=$(hdiutil attach /tmp/$TempFolder/$DMGFile -nobrowse)\n\necho \"Used hdiutil to mount $DMGFile \"\n\nerr=$?\nif [ ${err} -ne 0 ]; then\n echo \"Could not mount $DMGFile Error: ${err}\"\n rm -r /tmp/$TempFolder\n echo \"Deleted /tmp/$TempFolder\"\n exit 1\nfi\n\nregex='\\/Volumes\\/.*'\nif [[ $hdiutilAttach =~ $regex ]]; then\n DMGVolume=\"${BASH_REMATCH[@]}\"\n echo \"Located DMG Volume: $DMGVolume\"\nelse\n echo \"DMG Volume not found\"\n rm -r /tmp/$TempFolder\n echo \"Deleted /tmp/$TempFolder\"\n exit 1\nfi\n\n# Identify the mount point for the DMG file\nDMGMountPoint=\"$(hdiutil info | grep \"$DMGVolume\" | awk '{ print $1 }')\"\n\necho \"Located DMG Mount Point: $DMGMountPoint\"\n\n# Capture name of App file\n\ncd \"$DMGVolume\"\n\nAppName=\"$(ls | Grep .app)\"\n\ncd ~\n\necho \"Located App: $AppName\"\n\n\nDMGAppPath=$(find \"$DMGVolume\" -name \"*.app\" -depth 1)\n\nuserInstall=false\n\nfor user in $(dscl . list /Users | grep -vE 'root|daemon|nobody|^_')\ndo\n if [[ -d /Users/$user ]]; then\n # Create ~/Applications folder\n if [[ ! -d /Users/$user/Applications ]]; then\n mkdir /Users/$user/Applications\n fi\n if [[ -d /Users/$user/Applications/JumpCloud\\ Password\\ Manager.app ]]; then\n # remove if exists\n rm -rf /Users/$user/Applications/JumpCloud\\ Password\\ Manager.app\n fi\n\n # Copy the contents of the DMG file to /Users/$user/Applications/\n # Preserves all file attributes and ACLs\n cp -pPR \"$DMGAppPath\" /Users/$user/Applications/\n\n if [[ -d /Users/$user/Desktop/JumpCloud\\ Password\\ Manager.app ]]; then\n # remove alias on desktop if exists\n rm -rf /Users/$user/Desktop/JumpCloud\\ Password\\ Manager.app\n fi\n\n err=$?\n if [ ${err} -ne 0 ]; then\n echo \"Could not copy $DMGAppPath Error: ${err}\"\n hdiutil detach $DMGMountPoint\n echo \"Used hdiutil to detach $DMGFile from $DMGMountPoint\"\n rm -r /tmp/$TempFolder\n echo \"Deleted /tmp/$TempFolder\"\n exit 1\n fi\n\n userInstall=true\n echo \"Copied $DMGAppPath to /Users/$user/Applications\"\n\n # Create an alias on desktop\n ln -s /Users/$user/Applications/JumpCloud\\ Password\\ Manager.app /Users/$user/Desktop/JumpCloud\\ Password\\ Manager.app\n fi\ndone\n\n\n# Check if password manager is installed in /Applications; remove if we installed in user directory\nif [ -d /Applications/JumpCloud\\ Password\\ Manager.app ] && [ $userInstall = true ]; then\n # remove if exists\n rm -rf /Applications/JumpCloud\\ Password\\ Manager.app\nfi\n\n# Unmount the DMG file\nhdiutil detach $DMGMountPoint\n\necho \"Used hdiutil to detach $DMGFile from $DMGMountPoint\"\n\nerr=$?\nif [ ${err} -ne 0 ]; then\n abort \"Could not detach DMG: $DMGMountPoint Error: ${err}\"\nfi\n\n# Remove Temp Folder and download\nrm -r /tmp/$TempFolder\n\necho \"Deleted /tmp/$TempFolder\"\n\nexit",
"link": "https://github.com/TheJumpCloud/support/blob/master/PowerShell/JumpCloud%20Commands%20Gallery/Mac%20Commands/Mac%20-%20Install%20JumpCloud%20Password%20Manager%20App.md",
Expand Down

0 comments on commit 8cbcbd5

Please sign in to comment.