Snyk Security Plugin via Jamf

MatP
New Contributor

Hey guys, I need to deploy VSCode & Jetbrain Snyk extension via Jamf. VScode is in format .vsix and Jetbrain is looking like a simple folder with one Library and .jar files inside this folder.

Have any of you had to deal with such an installation?

Thank you in advance.

Regards

4 REPLIES 4

MatP
New Contributor

I'm not able to edit my post, so .vsix can be skipped.

Regards

sdagley
Esteemed Contributor II

@MatP This is pretty straightforward in Composer:

  1. Create a folder in /private/var/tmp named SynkSecurityPlugin
  2. Copy the Library and .jar file for the Sync extension into that folder
  3. Use that folder to create a new project in Composer (i.e. drag it to the left sidebar in the Composer window)
  4. Create a postinstall shell script that does the following:
    1. Checks to see if the destination Jetbrains folder already exists, and creates if it does not
    2. Copies the Library and .jar files from /private/var/tmp/SynkSecurityPlugin to the destinations Jetbrains folder (be sure to set the appropriate ownership and file permissions for the files after they're copied
    3. Deletes the /private/var/tmp/SynkSecurityPlugin folder

This does presume you've got some experience with Composer, but if not https://learn.jamf.com/en-US/bundle/composer-user-guide-current/page/Composer_Overview.html is a good place to start.

MatP
New Contributor

Hey @sdagley thank you for your help. I created this pkg via Composer with PostInstall script. This pkg work on my computer but when I upload all the setup into Jamf it does not work on other computers even though the status is completed. I.e. the folder does not appear in the indicated location. I discovered that if someone didn't run PyCharm any plugin then they are missing this folder and my script should handle this. Can I ask you to verify what I have prepared?

Here is the sript:
"

#!/bin/bash

# Define the source and target directories
SOURCE_DIR="/private/var/tmp/plugins"
TARGET_DIR="$HOME/Library/Application Support/JetBrains/PyCharm2024.2/plugins"

# Check if the source directory exists
if [ ! -d "$SOURCE_DIR" ]; then
echo "Source directory does not exist: $SOURCE_DIR"
exit 1
fi

# Create the target directory if it doesn't exist
if [ ! -d "$TARGET_DIR" ]; then
mkdir -p "$TARGET_DIR"
echo "Created directory: $TARGET_DIR"
else
echo "Directory already exists: $TARGET_DIR"
fi

# Copy the files from the source directory to the target directory
cp -R "$SOURCE_DIR/." "$TARGET_DIR/"

echo "All files from $SOURCE_DIR have been copied to $TARGET_DIR."   "

 

Regards


@MatP wrote:

Hey guys, I need to deploy VSCode & Jetbrain Snyk extension via Jamf. VScode is in format .vsix and Jetbrain is looking like a simple folder with one Library and .jar files inside this folder.

Have any of you had to deal with such an installation?

Thank you in advance.

Regards




Screenshot 2024-10-23 at 09.24.36.pngScreenshot 2024-10-23 at 09.25.07.pngScreenshot 2024-10-23 at 09.25.52.pngScreenshot 2024-10-23 at 09.26.01.png

sdagley
Esteemed Contributor II

You can't use $HOME in a postinstall script. You need to do something like this:

 

currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' )

TARGET_DIR="/Users/$currentUser/Library/Application Support/JetBrains/PyCharm2024.2/plugins"

 

You'll also want to use chown and chmod to set the owner and permissions for the field after they're copied.