A script to install Panopto via Jamf Pro
I use this script to install Panopto on Mac from our Jamf Pro MDM, so that the server preferred version of Panopto Recorder is installed, and due to PPPC/TCC you will notice it uses jamf createAccount to create the panopto_upload account before the installer runs so that we do not have to find a way to give installer permissions we probably shouldn't. This was also simpler than the quite large script I found from MacAdmins Slack channel #jamfnation that was attempting to manage the dscl command that the Panopto installer was using to create the account.
#!/usr/bin/php
<?php
#####################################################################################################
#
# ABOUT THIS PROGRAM
#
# NAME
# PanoptoInstall.php -- Installs the latest Panopto version per the server (works for on premise or cloud)
#
# SYNOPSIS
# sudo PanoptoInstall.php
#
####################################################################################################
#
# HISTORY
#
# Version: 5.1
#
# - Richard Smith, 26 January 2021
#
# IMPORTANT:
# It is possible to create a config profile to allow installer to create the user account.
# However, it comes with the possible security risk of allowing non-admin requiring packages
# to add/remove user accounts.
#
####################################################################################################
$PanoptoServer = "your.server.name.or.cloud.name";
$installFile = "PanoptoRecorder.pkg";
$getVersion = explode("'", explode('/', trim(`curl -Ls http://$PanoptoServer/ | grep cacheRoot`))[3]);
$myURL = "http://$PanoptoServer/Panopto/Cache/$getVersion[0]/Software/Panopto%20Recorder.pkg?arch=None&useCustomBinary=True";
# Add panopto_upload via jamf createAccount so installer doesn't ask for permissions to manage accounts
echo `/usr/local/bin/jamf createAccount -username panopto_upload -realname panopto_upload -home /var/panopto -shell /sbin/nologin -hiddenUser`;
echo "URL = $myURL\n";
echo `curl -Ls -o /tmp/$installFile $myURL`;
echo `rm -rf /Applications/Panopto.app`;
echo `sleep 10`;
echo `defaults write /Library/Preferences/com.panopto.mac.plist Server $PanoptoServer`;
echo `installer -pkg /tmp/$installFile -target /`;
echo `rm -rf /tmp/$installFile`;
exit(0);
?>
Comments
@Richard Smith This script is erroring for me lately. Possibly since the last Panopto upgrade in November.
Script result: No log handling enabled - using stderr logging
Created directory: /var/db/net-snmp Created directory: /var/db/net-snmp/mib_indexes Creating user panopto_upload... URL = http://butler.hosted.panopto.com/Panopto/Cache//Software/Panopto%20Recorder.pkg?arch=None&useCustomBinary=True installer: Error - the package path specified was invalid: '/tmp/PanoptoRecorder.pkg'.
It appears $getVersion is not working?
Thanks for the report, it turns out Panopto has secured the website with https, replacing http, so simple fix, however I have two options for fixing it, either change the lines containing http://, replacing the http with https (essentially add an s), or here is a full script replacement for macOS 12 Monterey, as Monterey does not have PHP:
#!/bin/sh
#####################################################################################################
#
# ABOUT THIS PROGRAM
#
# NAME
# PanoptoInstall.php -- Installs the latest Panopto version per the server (works for on premise or cloud)
#
# SYNOPSIS
# sudo PanoptoInstall.sh
#
####################################################################################################
#
# HISTORY
#
# Version: 7.1
#
# - Converted to Shell
# - Added s, to make http:// into https:// for secure http.
#
# - Richard Smith, 27 January 2022
#
# IMPORTANT:
# It is possible to create a config profile to allow installer to create the user account.
# However, it comes with the possible security risk of allowing non-admin requiring packages
# to add/remove user accounts.
#
####################################################################################################
PanoptoServer="your.server.name.or.cloud.name"
installFile="PanoptoRecorder.pkg"
myURL="https://$PanoptoServer$(curl -Ls https://$PanoptoServer/ | grep cacheRoot | cut -d "'" -f 2)/Software/Panopto%20Recorder.pkg?arch=None&useCustomBinary=True"
/usr/local/bin/jamf createAccount -username panopto_upload -realname panopto_upload -home /var/panopto -shell /sbin/nologin -hiddenUser
echo "URL = $myURL"
curl -Ls -o /tmp/$installFile "$myURL"
rm -rf /Applications/Panopto.app
sleep 10
defaults write /Library/Preferences/com.panopto.mac.plist Server $PanoptoServer
installer -pkg /tmp/$installFile -target /
rm -rf /tmp/$installFile
exit 0
I can't get this script to work, still says "Error - the package path specified was invalid: '/tmp/PanoptoRecorder.pkg'."
It looks like curl can't follow the redirects or something. If I add the -v verbose flag to the curl command it says "could not resolve host" although the initial URL generated is valid and copying it straight into a browser will download the client.
Here is my output with the verbose turned on.
URL = https://butler.hosted.panopto.com/Panopto/Cache/12.0.7.00001/Software/Panopto%20Recorder.pkg?arch=None&useCustomBinary=True
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
* Could not resolve host: butler.hosted.panopto.com\x2fPanopto\x2fCache\x2f12.0.7.00001
* Closing connection 0
curl: (6) Could not resolve host: butler.hosted.panopto.com\x2fPanopto\x2fCache\x2f12.0.7.00001
installer: Error - the package path specified was invalid: '/tmp/PanoptoRecorder.pkg'.
Looks like issue is this statement
curl -Ls https://$PanoptoServer/ | grep cacheRoot | cut -d "'" -f 2
returns:
\x2fPanopto\x2fCache\x2f12.0.0.7.00001
I have it working by setting:
#!/bin/zsh
..at the top of the script and making the following changes:
echo "URL = $myURL"
cleanURL=$(print $myURL)
curl -Ls -o /tmp/$installFile "$cleanURL"
Though I'm sure this is a very clunky solution.
@Sean Gaynor I'm having issues with 13.5 and this script working. Line.xx Print command not found, thus doesn't cleanup the URL to download properly. I'm still troubleshooting but wondering if anyone else has seen any issues. @Richard Smith
myURL="http://$PanoptoServer/$(curl -Ls http://$PanoptoServer/ | grep cacheRoot | cut -d "'" -f 2 | awk -F '\\' '{ printf $4 $5 $6 }' | awk -F 'x2f' '{ printf $2 "/" $3 "/" $4 }')/Software/Panopto%20Recorder.pkg?arch=None&useCustomBinary=True"
Updated version of that line. Sorry I'm not on this forum that often. I'm currently trying to get Panopto to update their installer to better handle adding their hidden user account panopto_upload.