Quick Freeze / Thaw of Reverse Zones

I had to update several reverse zone files today, so wrote a quick for-loop in bash to freeze and thaw all the zones. The script parsed the zone file names and reversed them into a proper d.c.b.a.in-addr.arpa format. Later I tweaked it with sed to make it more flexible (in order to pass it a full or partial IP address), but ended up using tac for the reversing part instead – that’s what it’s made for after all. And if you’re wondering what tac stand for, just read cat backwards. :-)


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 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.


Wget with Firefox Cookies

I recently found myself needing to scrape information from a website that uses login credentials. The authentication and session information was available in several cookies, which Wget could use, if the cookies were stored in a plain text file. I used Firefox to login and set the cookies, but Firefox saves it’s cookies in an sqlite data file, which must be exported before Wget can use it. A quick Google search turned up a few possible methods using sqlite3, which I’ve adapted here to use with Wget.


Beautify Query Strings with Rewrites

I wanted to change the WordPress search query from /?s=value to /s/value, just to make the URL look a little prettier. There are two parts to this problem; The first, executing a search query from an /s/value URL, is easily addressed by a rewrite and proxy command. The second problem — how to rewrite a regular search query, but not a proxied search query — is a little tricker.


Update a Dynamic DNS IP with BIND

I wrote the following nsupdate-ddns.sh script to update the dynamic DNS entry for my laptop when switching network locations. There are several ways to execute a script like this automatically (cronjob, startup script, launcher, etc.) — I chose to use Sidekick for Mac OS X, which allows me to execute it when switching locations (either network or physical). This script can also generate the private authentication key needed by the DDNS server, and will display some sample configuration values. If you’re setting up a new DDNS server, you can use the examples to configure your dynamic zone file.