欢迎各位兄弟 发布技术文章
这里的技术是共享的
Our SecOps team is asking us to create a method of displaying a message to users that the user would have to "ok" on to signal it has been read. Now we all know that doesn't mean it was actually read, BUT hey... that's what they want.
I know there's a fairly basic way of invoking jamf helper, but I can't find it and I'm not remembering. It would be nice if the script can be changed easily in a policy as they are wanting it to be updated weekly. Anyone know?
There's both jamfHelper and the Jamf binary itself that can do this. The latter is more simplistic and you have less control over how the dialog looks, but scripting it is a bit easier than jamfHelper (not that jamfHelper is hard to use mind you)
Here's how to do it with the Jamf binary:
/usr/local/bin/jamf displayMessage -message "Hello"
It looks something like this-
With jamfHelper, you can do something like the following:
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -windowType utility -description "Hello" -button1 OK -defaultButton 1
Which would look like this-
Thing to keep in mind is that the icon for the jamf binary message can't be changed, at least not easily. With jamfHelper you can add an image which could be something like your org logo, to make it look official. To see all the options and how to use them, run:
/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper -help
in Terminal.
The jamf binary message looks so generic, that if your end users are properly trained to avoid spam/malware clicks, they may not even click ok because it might look suspicious to them.
EDIT: I forgot to add that for the second part of your question, most of the items in the jamfHelper message could be replaced by variables that get populated by script parameters, so all you'd need to do is change the script parameters to reflect any differences in the message you might want. For example, the "description" can be assigned to $4 or $5 or whatever in the script and then in your policy, just change the text out. There is one caveat, which is that there is an upper limit to the number of characters a Jamf parameter can have. I forgot now the exact number, but I think it's 256 or something like that.
Another couple of points to keep in mind. I would test out any messages a few times locally before deploying anything. I say this because jamfHelper is notoriously inconsistent in how it resizes the window to accommodate text. It can display in some funny ways at times.
Also there's no guarantee it will even display all the text. I've run into issues where text for the message gets truncated and there doesn't seem to be any real rhyme or reason as to what causes it. For that reason, it's best to keep the message as short and to the point as possible. Short text never really gets chopped, but longer strings of text sometimes do.
Posted on 03-28-2022 12:37 PM
This link is a dud. Check here for an updated app: https://github.com/BIG-RAT/jhc
Another couple of points to keep in mind. I would test out any messages a few times locally before deploying anything. I say this because jamfHelper is notoriously inconsistent in how it resizes the window to accommodate text. It can display in some funny ways at times. Also there's no guarantee it will even display all the text. I've run into issues where text for the message gets truncated and there doesn't seem to be any real rhyme or reason as to what causes it. For that reason, it's best to keep the message as short and to the point as possible. Short text never really gets chopped, but longer strings of text sometimes do.
THIS. I've had many occasions where created/tested locally these dialogs only to have people calling complaining about various glitches with them when delivered from the JSS. Maddening, like many things.
来自 https://community.jamf.com/t5/jamf-pro/popup-message-with-an-quot-ok-quot-button/m-p/233662