Introduction
Jamf Pro Extension Attributes (EAs) for Computers and Mobile devices allow collection of additional device information that can be used for scoping and reporting.
Scripts that run to find values for EAs on macOS run across ALL devices on the Jamf instance. Care must be taken to not cause slowness or increase the attack surface of the entire fleet with these scripts.
Process Description
For ncsu.jamfcloud.com here a the guidelines:
1) To request a new EA be added to ncsu.jamfcloud.com open a help ticket in the OIT_Jamf Group so the request can go through the OIT Change Management process.
2) Any EA that contains a script must either
a) run using a Site level policy leaving an artifact (like a file or key pair value) that can be read by the EA only if it exists or
b) pass a 100% positive vote from every Site admin on the instance if running directly on every device
3) All EA’s must be installed on nccloudtest.jamfcloud.com and made available for all Sites to test at least 1 week before it can be approved.
4) Any EA (or any other software) found by OIT Security and Compliance to decrease the security of the NCSU fleet will be removed immediately and potentially without notice before the removal.
Best practice for all Computer Extension Attributes that execute scripts on the local machine is to create a Site level policy to run the script, store the output in a local file and limit the EA code to check for the existence of the file and only IF it exists then read the value into the EA. This allows Sites interested in the data produced for reporting or scoping to do so without impacting other sites. The use of filler text like “Not Found”, “Not Set” or “Missing” is not best practice and should be replaced with values like "<result>.</result>" or just returning nothing for missing data "<result></result>" and Booleans like "<result>1</result>"or "<result>0</result>" for True or False states. Always remember that an EA adds data to each and every device record on the ENTIRE instance so care should be taken not to bloat our Jamf Pro database causing slowness… Jamf Hosting will ask us to change practices that use unnecessary resources.
Most scripts for EAs should look like this where myFile is created by a policy or other software:
#!/bin/zsh
myFile=”/path/to/file.txt”
ret=””
if [[ -f $myFile ]]; then
ret=$(/bin/cat $myFile)
## or something like /usr/bin/defaults read $myFile SomeKey
fi
echo “<result>$ret</result>"
exit 0
As always any command line tools (like cat, ls, defaults, etc) should be called in the script from their full path to avoid security issues.
If the EA is tested on nccloudtest.jamfcloud.com for 1 week with no issue and no objections from MacTech, OIT will install the EA into ncsu.jamfcloud.com.
Any updates are the responsibility of the requester NOT OIT.
It is strongly recommended that a repo of the EA and any code used to create the value be published as NCSU Readable and included in the comments of the EA script.
Any EA that are manually filled in or chosen via pop-up will simply be reviewed by the OIT Jamf Team for security and added with notification to MacTech.
Conclusion
These best practices and testing procedures will help us keep a clean and secure Apple management environment.