maxon script help!

stephaniemm77
Contributor

Good Morning,

Is anyone deploying/using Maxon. They provide a command file and a .plist file to automatically run the command file, but I am having a problem getting the command file to launch properly. 

I was thinking I could generate a login script, but I am not great at scripting, would anyone out there be willing to take a look for me?

The command is:

/Library/Application\ Support/Maxon/Tools/mx1 user login -u software@quinnipiac.edu -p PASSWORD

 

Maxon instructions 

 

1 ACCEPTED SOLUTION

lhays2
New Contributor III

Greetings,

I scripted Maxon for our lab environment earlier this year. I modified their provided script to decrypt the user and password from an included hash so it wasn't stored in plain text. The command is the same otherwise. What is the issue you are running into? Only suggestion I would have is to make sure the script has execute permissions for the user logging into the machine.

Our launch agent 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
            <key>Label</key>
            <string>com.MaxonStartA</string>
            <key>ProgramArguments</key>
            <array>
                <string>/private/etc/IT/Scripts/MaxonStart.sh</string>
            </array>
            <key>RunAtLoad</key>
            <true/>
</dict>
</plist>


Our script, with the decrypt functions for user and password removed.

#!/bin/bash
# MaxonStart.SH
# 2023-06-16

# Login to Maxon service
/Library/Application\ Support/Maxon/Tools/mx1 user login -u $user -p $pass



View solution in original post

14 REPLIES 14

lhays2
New Contributor III

Greetings,

I scripted Maxon for our lab environment earlier this year. I modified their provided script to decrypt the user and password from an included hash so it wasn't stored in plain text. The command is the same otherwise. What is the issue you are running into? Only suggestion I would have is to make sure the script has execute permissions for the user logging into the machine.

Our launch agent 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
            <key>Label</key>
            <string>com.MaxonStartA</string>
            <key>ProgramArguments</key>
            <array>
                <string>/private/etc/IT/Scripts/MaxonStart.sh</string>
            </array>
            <key>RunAtLoad</key>
            <true/>
</dict>
</plist>


Our script, with the decrypt functions for user and password removed.

#!/bin/bash
# MaxonStart.SH
# 2023-06-16

# Login to Maxon service
/Library/Application\ Support/Maxon/Tools/mx1 user login -u $user -p $pass



macguitarman
New Contributor III

Question about Maxon, is it true or not that the only way to download / install Maxon apps or plugins (Red Giant Trapcode) in this case, is to use the Maxon App, and have every user dowload / install the app (themselves) with account creds? If so, Yikes! Has anyone tried doing a Composer snapshot and just grabbing the delta and Create Package in Composer?

lhays2
New Contributor III

Hi macguitarman,

Most if not all of Maxon can be automated with some setup. I do not have the end user (students in our case) install anything. For our lab spaces we have automated the following apps / plugins.

  • Maxon
  • Cinema 4D
  • RedShift
  • VFX Suite
  • ZBrush
  • PluralEyes
  • Universe
  • TrapcodeSuite
  • MagicBullet

 

Redshift is a pkg so that one is simple enough. The rest are app installers that I usually download from the Maxon app once i do a temp install. Fortunately the .app installers all  have a ‘install.sh’ inside that you can run from terminal or script. I package the .app  file with composer and install it on the system. I use “/private/var/tmp/installers” but anywhere works as long as you can path to it. Then I use a script from jamf to run the install.sh inside the .app and once that completes delete it. The following should hopefully show how that works.

Packaging Trapcode.png

#!/bin/bash

/private/var/tmp/installers/Trapcode\ Suite\ Installer.app/Contents/Scripts/install.sh

/bin/rm -rf /private/var/tmp/installers/Trapcode\ Suite\ Installer.app

Zbrush and Cinema 4d both have unattended flags you have to give when calling the script in the .app file but otherwise they are all the same.

/private/var/tmp/installers/Maxon\ Cinema\ 4D\ Installer.app/Contents/MacOS/installbuilder.sh --mode unattended --unattendedmodeui none

I'm not sure if every app / plugin will be the same, but so far so good for my labs.

Hope that helps!

macguitarman
New Contributor III

Thank you so much, and the prompt reply. Yes, the classic copy an installer to tmp directory and invoke a script... This method looks to alleviate any need to have the Maxon.app installed or used, and having to have that app log in and using a hash password, but, thank you for the code on how to encrypt and decrypt a password, very helpful. 

Is there a way to Uninstall all traces of said Maxon install, an un-install script?

Where does this (in this case) Trapcode plugin / app live, it's path?, and I assume Adobe After Effects....

And the big question, how does one apply a license, hopefully some licensing command with a license code / file? Thanks again very much!

lhays2
New Contributor III

I believe the Maxon app is required for any  additional plugins / apps and for licensing. If I try to run the installer without it the program complains.

Maxon Missing.png

As for uninstaller, I don't know. We usually wipe and provision at the start of each semester. we've never had to uninstall maxon or adobe mid semester. You could try looking in the application folder to see if it has an uninstall script inside of the app (they were nice enough to have install scripts), but it's not knowledge I currently have.

macguitarman
New Contributor III

Thanks for this… can you share how one would do the encrypt and decrypt functions… thanks again

lhays2
New Contributor III

Absolutely,

I use the following script to encrypt a password on my machine. In this case "Jumanji".

#!/bin/bash
function GenerateEncryptedString() {
	local STRING="${1}"
	local SALT=$(openssl rand -hex 8)
	local K=$(openssl rand -hex 12)
	local ENCRYPTED=$(echo "${STRING}" | openssl enc -aes256 -md md5 -a -A -S  "${SALT}" -k "${K}")
	echo "Encrypted String: ${ENCRYPTED}"
	echo "Salt: ${SALT} | Passphrase: ${K}"
}

GenerateEncryptedString Jumanji

 It will generate a encrypted string, a Salt and a Passcode/K. It will look like the following

Encrypted String: U2FsdGVkX1/4HNDlhAhTNW0t19/FcPbWgyFsU96TE/c=
Salt: f81cd0e584085335 | Passphrase: 74114fbddff8a21aca29e187

You then add those strings along with the following decrypt function to your code

#!/bin/bash

string1="U2FsdGVkX1/4HNDlhAhTNW0t19/FcPbWgyFsU96TE/c="
salt1="f81cd0e584085335"
K1="74114fbddff8a21aca29e187"


function DecryptString() {
	# Usage: ~$ DecryptString "Encrypted String" "Salt" "Passphrase"
	echo "${1}" | /usr/bin/openssl enc -aes256 -md md5 -d -a -A -S "${2}" -k "${3}"
}

passtemp=$(DecryptString "$string1" "$salt1" "$K1")
echo $passtemp

$passtemp will contain the original string of "Jumanji". 

If you deploy a script from jamf, you can include one of the required strings as a parameter so you don't have everything inside of the script. Not perfect either way, but it does help my piece of mind to at least not have the passwords storred in plain text as Maxon suggests.

I do not take credit for these. I found them a while back either on here or through google and have simply updated them as required.

Cheers!

stephaniemm77
Contributor

Thank you!!

macguitarman
New Contributor III

@lhays2, thank you so much, much appreciated. I am trying to to get a launchagent package (in Composer), and for some reason the the plist will not load, no I idea why, permissions are good, etc. I can load it on the test Mac from the command line, but not with a post install script in Composer...Might you be able to point me in the direction with what you are doing with launchctl in your script. Thank you again, and btw, the decrypt code is working great... PS, I thought the script has to be local on the Mac in order to load in launchctl, so I am not sure how the parameters would work... Thanks again for the time, much obliged.

lhays2
New Contributor III

@macguitarman 
I didn't realize you could @ someone on here. Neat!

I do not load the LanchAgent via a script I reboot the machine and let it handle the process. There's also a post install script located at /Library/Application Support/Red Giant/Services/fuse-mac-createuser-postflight.sh. that I upload to JAMF and deploy on our machines. I run it right after the base Maxon app. It creates a service to help run the applications. Because of that service and the launch Agent I find it better to do all of the app, and script installs, then reboot the machine so everything can come up naturally.

As for why the PKG isn't running the script I would assume the package isn't signed. a unsigned PKG will not run any scripts. you can sign with either an Apple developer ID or using the internal JAMF CA. https://learn.jamf.com/bundle/technical-articles/page/Creating_a_Signing_Certificate_Using_Jamf_Pros...

I don't use parameters on the Maxon script, it's more for high security scripts I deploy directly from JAMF. It might be possible to pass a parameter as part of a launch agent ProgramArgument list, but I haven't tested that.

macguitarman
New Contributor III

@lhays2, thanks again. Yes, of course, a PKG must be signed to run scripts...totally forgot that. I now have the Maxon app installed, and I am using a separate policy (in Self Service) that invokes the login (basically avoids the launchagent)... As you pointed out Maxon is requiring one to install the Maxon app, it must be installed....

Now the License....I am logged into Maxon app account, and after installing Trapcode, "Assign License" is greyed out. I am assuming this means we may be using an account with no available licenses?, or incorrect account?, or can we license using the mx1 command?, or something else I am missing. Thanks again...

lhays2
New Contributor III

@macguitarman Hmm, I'm not sure on that one. I haven't seen an item greyed out after logging in. I would guess either an expired license or it isn't applied to that account. If you login to the Maxon web portal can you see if that account has an active Trapcode license? Not sure otherwise.

jpallagrosi
New Contributor II

Hey guys, I made a script that does the whole install including the auto login. No packaging involved. Just make sure you read lines 15 & 16 This version install all applications so you might need to comment out what you don't need. 

#!/bin/bash

######################
# READ LINES 15 & 16 # 
######################

# Set up logging
log_file="/private/var/tmp/maxonInstall_log.txt"
exec > "$log_file" 2>&1

log() {
    echo "$(date "+%Y-%m-%d %H:%M:%S"): $1"
}

#Add Credentials in parameters 4 & 5
#Collect the versions from the installers here https://www.maxon.net/en/downloads and add them to the variables lines 17-25
maxonAppVER="2024.1.1"
cinemaYEAR="2024"
cinema4dVER="2024.2.0"
zBrushVER="2024.0.1"
redshiftVER="3.5.23_145d0ef3"
magicBulletVER="2024.0.1"
trapcodeVER="2024.0.2"
universeVER="2024.1.0"
VFXVER="2024.0.1"

#For DMG files
download_and_install() {
    local app_name="$1"
    local app_url="$2"
    local app_loc="${maxonsLoc}/${app_name}.dmg"
    
    log "Downloading $app_name"
    curl "$app_url" --output "$app_loc"
    
    log "Mounting $app_name DMG"
    hdiutil attach "$app_loc" -mountpoint "$mount_point"
    sleep 5
    
    log "Installing $app_name"
    "${maxonsLoc}/Mounted_DMG/${app_name}/Contents/MacOS/installbuilder.sh" --mode unattended --unattendedmodeui none #--skipMaxonAppGui 1
    
    hdiutil detach "$mount_point"
}

mkdir -p /private/var/tmp/Maxons/
mount_point="/private/var/tmp/Maxons/Mounted_DMG"
maxonsLoc="/private/var/tmp/Maxons"
url="https://mx-app-blob-prod.maxon.net/mx-package-production"

download_and_install "Maxon App Installer.app" "${url}/website/macos/maxon/maxonapp/releases/${maxonAppVER}/Maxon_App_${maxonAppVER}_Mac.dmg"
download_and_install "Maxon Cinema 4D Installer.app" "${url}/installer/macos/maxon/cinema4d/releases/${cinema4dVER}/Cinema4D_${cinemaYEAR}_${cinema4dVER}_Mac.dmg"
download_and_install "ZBrush_${zBrushVER}_Installer.app" "${url}/installer/macos/maxon/zbrush/releases/${zBrushVER}/ZBrush_${zBrushVER}_Installer.dmg"

#For PKG files
curl "https://installer.maxon.net/installer/rs/redshift_v${redshiftVER}_macos_metal.pkg" --output "${maxonsLoc}/redshift_v${redshiftVER}_macos_metal.pkg"
installer -verboseR -pkg ${maxonsLoc}/redshift_v${redshiftVER}_macos_metal.pkg -target /

##For ZIP files
download_unzip_and_Install() {
    local app_name="$1"
    local zip_url="$2"
    local zip_loc="${maxonsLoc}/${app_name}.zip"

    log "Downloading $app_name"
    curl "$zip_url" --output "$zip_loc"

    log "Unziping $app_name ZIP"
    unzip "$zip_loc" -d "${maxonsLoc}"

    log "Installing $app_name"
    "${maxonsLoc}/${app_name}/Contents/Scripts/install.sh" #--mode unattended --unattendedmodeui none #--skipMaxonAppGui 1
}

download_unzip_and_Install "Magic Bullet Suite Installer.app" "${url}/installer/macos/redgiant/magicbullet/releases/${magicBulletVER}/MagicBulletSuite-${magicBulletVER}_mac.zip"
download_unzip_and_Install "Trapcode Suite Installer.app" "${url}/installer/macos/redgiant/trapcode/releases/${trapcodeVER}/TrapcodeSuite-${trapcodeVER}_Mac.zip"
download_unzip_and_Install "Universe Installer.app" "${url}/installer/macos/redgiant/universe/releases/${universeVER}/Universe-${universeVER}_Mac.zip"
download_unzip_and_Install "VFX Suite Installer.app" "${url}/installer/macos/redgiant/vfx/releases/${VFXVER}/VfxSuite-${VFXVER}_Mac.zip"

sleep 5
rm -R ${maxonsLoc}
#chflags hidden /Applications/Maxon.app

#SET LOGINS
log "Creating the Login file"
loginEmail="$4"
loginPassword="$5"

cd /Library/Application\ Support/Maxon/Tools/
cat <<EOF > MaxonAppLogin.command
/Library/Application\ Support/Maxon/Tools/mx1 user login -u ${loginEmail} -p ${loginPassword} 
EOF

chown root:wheel /Library/Application\ Support/Maxon/Tools/MaxonAppLogin.command
chmod 455 /Library/Application\ Support/Maxon/Tools/MaxonAppLogin.command
#Hide the file
chflags hidden /Library/Application\ Support/Maxon/Tools/MaxonAppLogin.command

echo "Creating the LaunchAgent"
cd /Library/LaunchAgents/
echo '<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>Label</key>
	<string>com.maxon.mxlogin.agent</string>
	<key>ProgramArguments</key>
	<array>
		<string>/Library/Application Support/Maxon/Tools/MaxonAppLogin.command</string>
	</array>
	<key>RunAtLoad</key>
	<true/>
</dict>
</plist>' > com.maxon.mxlogin.agent.plist

chown root:wheel /Library/LaunchAgents/com.maxon.mxlogin.agent.plist
chmod 444 /Library/LaunchAgents/com.maxon.mxlogin.agent.plist

exit 0

###########################
# C4D removal for upgrade #
###########################

# Remove the Cinema 4D and preferences. Specify the year.
#for userName in `ls /Users | grep -v Shared`
#do
#    if [ -d /Applications/Maxon\ Cinema\ 4D\ 2023/  ]
#        then 
#        echo "Removing Ciema 4D 2023"
#        rm -rf "/Applications/Maxon Cinema 4D 2023/"
#        rm -rf "/Users/$userName/Library/Preferences/Maxon/"
#    else
#        echo "Cinema 4D 2023 is not installed"
#    fi
#done

 

jpallagrosi
New Contributor II

*Installs 🙂