DaveHope.co.uk

A question to vendors: Why do you protect your licensing information?

For the past 5 or so years I’ve been updating Product Key Finder in my free time. If you’re not already familiar with this simple utility, it’s a free application to recover license information from computers.

Occasionally I come across a vendor who encrypts license information before storing it on a customers computer. If the application allows you to display your license information that’s great. The problem is with vendors such as Adobe and Symantec who insist on encrypting license information and provide no way for their paying customers to view it.

Adobe is particularly bad, they’ll show you all but the last 5 characters in their about dialog and encrypt the license key so it can’t be easily recovered. In some environments such as schools and corporates that makes sense, but for retail customers it just frustrates them.

Photoshop CS2 About Screen

I don’t mean to pick on just Adobe however, others are doing it too. Microsoft have got it almost right. For retail and OEM channel license keys they’re easily recoverable using known methods. In Windows Vista, license information for enterprises (MAK keys) is removed after activation.  They could have triggered “slmgr -cpky” to remove this information for retail customers too, but they elected not to. Kudos, Microsoft.

I get e-mails on an almost daily basis from your angry customers who have worked hard to pay for your software. So please, justify to them why you are doing this so I know what to tell them.

 

Backup your Linux system to Dropbox


As an adovate of Dropbox I’ve been keen to find a simple way to backup by webserver/VPS to Dropbox. With up to 10gB of storage space for free there’s plenty of capacity for me to backup some MySQL databases and webroot. Unfortunately the Linux command line dropbox client doesn’t provide any way to synchronise a specific directory.

Using Andrew Fabrizi’s Dropbox Uploader script I cobbled together a quick BASH script to backup key directories to my Dropbox account.

#!/bin/bash
DROPBOX_USER="Your Dropbox username"
DROPBOX_PASS="Your Dropbox password"
DROPBOX_DIR="Directory in your dropbox account to store the backups, e.g. /backups"
BACKUP_SRC="/home /var/www /var/git /etc /root"
BACKUP_DST="/tmp"
MYSQL_SERVER="127.0.0.1"
MYSQL_USER="root"
MYSQL_PASS="Your MySQL password"


#
# Stop editing here.
NOW=$(date +"%Y.%m.%d")
DESTFILE="$BACKUP_DST/$NOW.tgz"

#
# Upload a file to Dropbox.
# $1 = Source file
# $2 = Destination file.
function dropboxUpload
{
	#
	# Code based on DropBox Uploader 0.6 from http://www.andreafabrizi.it/?dropbox_uploader
	LOGIN_URL="https://www.dropbox.com/login"
	HOME_URL="https://www.dropbox.com/home"
	UPLOAD_URL="https://dl-web.dropbox.com/upload"
	COOKIE_FILE="/tmp/du_cookie_$RANDOM"
	RESPONSE_FILE="/tmp/du_resp_$RANDOM"
	
    UPLOAD_FILE=$1
    DEST_FOLDER=$2

	# Login
	echo -ne " > Logging in..."
	curl -s -i -c $COOKIE_FILE -o $RESPONSE_FILE --data "login_email=$DROPBOX_USER&login_password=$DROPBOX_PASS&t=$TOKEN" "$LOGIN_URL"
	grep "location: /home" $RESPONSE_FILE > /dev/null

	if [ $? -ne 0 ]; then
		echo -e " Failed!"
		rm -f "$COOKIE_FILE" "$RESPONSE_FILE"
		exit 1
	else
		echo -e " OK"
	fi
	
	# Load home page
	echo -ne " > Loading Home..."
	curl -s -i -b "$COOKIE_FILE" -o "$RESPONSE_FILE" "$HOME_URL"

	if [ $? -ne 0 ]; then
		echo -e " Failed!"
		rm -f "$COOKIE_FILE" "$RESPONSE_FILE"
		exit 1
	else
		echo -e " OK"
	fi
	
	# Get token
	TOKEN=$(cat "$RESPONSE_FILE" | tr -d '\n' | sed 's/.*<form action="https:\/\/dl-web.dropbox.com\/upload"[^>]*>\s*<input type="hidden" name="t" value="\([a-z 0-9]*\)".*/\1/')

	# Upload file
	echo -ne " > Uploading '$UPLOAD_FILE' to 'DROPBOX$DEST_FOLDER/'..."
    curl -s -i -b $COOKIE_FILE -o $RESPONSE_FILE -F "plain=yes" -F "dest=$DEST_FOLDER" -F "t=$TOKEN" -F "file=@$UPLOAD_FILE"  "$UPLOAD_URL"
    grep "HTTP/1.1 302 FOUND" "$RESPONSE_FILE" > /dev/null

    if [ $? -ne 0 ]; then
        echo -e " Failed!"
		rm -f "$COOKIE_FILE" "$RESPONSE_FILE"
        exit 1
    else
        echo -e " OK"
		rm -f "$COOKIE_FILE" "$RESPONSE_FILE"
    fi	
}

# Backup files.
mysqldump -u $MYSQL_USER -h $MYSQL_SERVER -p$MYSQL_PASS --all-databases > "$NOW-Databases.sql"
tar cfz "$DESTFILE" $BACKUP_SRC "$NOW-Databases.sql"

dropboxUpload "$DESTFILE" "$DROPBOX_DIR"

rm -f "$NOW-Databases.sql" "$DESTFILE"

Continue reading…

 

Automating Active Directory account creation with Powershell

Earlier this year I set about simplifying the user account creation process for the company I work for. Previously when someone joined the company the user account creation was a manual process. Some of the tasks we manually undertook were:

  • Create the account and Exchange mailbox;
  • Set relevant attributes (Job Title, Office Address etc);
  • Enable the user for office communicator;
  • Set the calendar permissions so that everyone can view the persons calendar;

I chose Powershell as my tool of choice, it’s extremely flexible for stuff like this and most of the management functionality comes out the box with Exchange 2007 and later. I initially used Glen Scales’ EWS module for setting permissions and other bits but as we moved to Exchange 2010 the need for EWS disappeared (Thanks to functionality like Set-MailboxFolderPermissions).
Continue reading…