Jamf Pro & WHD – Make Clients Admin of Their Asset

If you use Jamf Pro and SolarWinds Web Help Desk (WHD), you may be interested in using this Jamf policy script to make WHD asset clients admin of their own assets on login.

Jamf and WHD Requirements

  • Assets in WHD must have accurate serial numbers entered. The script uses the computer serial number to locate the asset in WHD, so WHD assets must have serial numbers.
  • Assets in WHD must have one or more clients assigned to them. Clients assigned to the asset will be added to the ‘admin’ group for that asset on login.
  • The Perl script uses the JSON module, which Apple included in MacOS v11. If the computer uses an older MacOS version, the script will exit with an error. The script uses a BEGIN{} section to handle importing the JSON decode_json() function and exit gracefully if the JSON module is missing.

Continue reading

Check the SOA Serial Number on NS Servers

If you manage a DNS master, and push zones to several slaves / secondaries, you may have found that over time — as configuration files and firewall rules change — one or more slaves may have lost its ability to update its zone files. Perhaps the slave is no longer being notified, or it may have lost the necessary zone transfer permissions from the master. In a large distributed environment where DNS changes are frequent, checking the SOA serial number for all the NS servers in a zone can be quite helpful — a quick way to eliminate the DNS as a possible source of a problem. Here is a perl script I wrote a few years back to retrieve the SOA serial number for a given domain.

Continue reading

Optimize Images to Save Bandwidth and Speed Page Load

A few weeks ago I mentioned the wesley.pl script from GitHub to optimize images, and how I had modified it to keep (or discard) the EXIF / XMP information. Making sure images are as small as possible is important to save bandwidth and improve page load times (and google rank), so I think it’s worth discussing my image optimization process in more detail.

Continue reading

Wesley.pl optimize script for jpeg, png, and gif

To improve page load times (and Google ranking), you should make sure all jpeg, png, and gif files are properly optimized. Instead of writing my own script for jpegtran, pngcrush, and gifsicle, I used Mike Brittain’s Wesley.pl script on GitHub. It works great, though I did have to modify it to change the “jpegtran -copy” parameter it uses — I need to keep the EXIF on larger files, and strip it from thumbnails. I posted the diff on the GitHub Issues page.

Update 2012-12-31 : In case Mike doesn’t merge my diff, with the addition of the --copy=[all|comments|none] command-line argument (see my comment below for more info), you can download the patched wesley.pl script here instead.

Continue reading

Create and Update OTRS Tickets from the Command-Line

I recently wrote a notification script for Centreon / Nagios to create and update tickets in OTRS. The ticket details and OTRS connection settings are all defined on the command-line. The GenericTicketConnector.yml must first be installed in OTRS, and a user (aka “Agent”) created for the script. I used perl’s taint mode, so had to hard-code the various log file locations ($logfile, $csvfile, and $dbfile). The Log::Handler module allows the script to output and log different amounts of activity detail, and the DBD::SQLite module is used to keep a local database of the Ticket ID (from OTRS) and the Problem ID (from Centreon / Nagios) associations — so the OTRS ticket can be updated with follow-up notifications from Centreon / Nagios for the same issue.

Continue reading

Conceal Email Address with JavaScript

I wrote this perl script years ago when I needed to include my email address on a webpage, but also conceal it from spam bots and spiders.

#!/usr/bin/perl -w

# /usr/local/bin/esc-mailto.pl
# Conceal email address with javaScript.
# by Jean-Sebastien Morisset (https://surniaulula.com/)

use strict;

my ($email, $text) = @ARGV;
$text = $email if (!$text);

if ($email && $text) {
	my $mailto = "<a href=\"mailto:$email\" class=\"esc-mailto\">$text</a>";
	$mailto =~ s/(.)/sprintf("%%%x", ord($1))/ge;
	print "<script language=\"JavaScript\">document.write(unescape(\"$mailto\"))</script>\n";
} else {
	print "syntax: $0 {email_address} [optional_link_text]\n";
	exit 1;

exit 0;

Continue reading