Notifier
Notifier is a Python Script to send emails to Mac users with pending updates (according to Jamf patch
management) using the Jamf API and SMTP!
How it works
- Grab API username and password the
JAMFREPORTUSER
andJAMFREPORTPASS
environment variables. - Get a bearer token from the Jamf server. This is used for all further authentication.
- Gets a list of all Patch Management titles on the Jamf server
- For each Patch Management title, get a list of every version
- Record the first version number, skip any computers on this version (they’re up to date!)
- Skip any computers with an Unknown version. Usually this means a version newer than what Jamf has an update for.
- Get a count of computers on each version
- If there’s exactly one computer, record the information in the computer definition
- If there’s more than one computer, record each into the definition sequentially (Jamf provides a different data structure for single computers)
- Add the Full Name and Email Address assigned to each computer in Jamf to the computer definition
- Connect to your SMTP server
- Fill in all the fields in the email
- Add each patch to the body of the email, with an installed and expected version.
- Cap it off with a friendly closer
- Send the emails!
Requirements
The requirements.txt file can be fed to PIP to download all the prerequisites for the project using the command:
python3 -m pip -r requirements.txt
importrequests
This is a standalone tool to get a Jamf bearer token. We made this during the same Hackathon. It was merged into Notifier, but it’s still a handy tool for testing. Just remember not to commit your API key! ?