Monday, April 6, 2009

VMware: Manually start vmware-user in GNOME session

After an upgrade from Fedora 8 to Fedora 10, vmware-user does not start when I start an X11 session. vmware-user is necessary to enable features such as screen auto-fit, drag and drop, and cut-and-paste between the host and guest X11 windowing system.

In Fedora 10, enabling vmware-user on gdm login is simple:

Go to System -> Preferences -> Personal -> Sessions.
Click the "Add" button to add another Startup Program.
   1. For a Name put vmware-user
   2. For a Command put /usr/bin/vmware-user
   3. For a Comment put Start vmware-user

Monday, February 16, 2009

From PGP to Free: Switching from PGP Desktop to The GNU Privacy Guard (GPG)

In this guide we'll examine the Why and How of transitioning from a PGP managed personal encryption solution to a GPG encryption system. This entry will pertain exclusively to a Mac OS X system, but a later blog entry will describe the process in a Windows environment.

1. Why GPG? / Why Not PGP?

PGP Desktop bills itself as a "comprehensive set of encryption applications to protect sensitive data in email and instant messages and on disk or removable media"[1], and it certainly is. However, I chose to switch from PGP to GPG for the following reasons:

  1. It is expensive: PGP Desktop Pro is currently $219.00 for a perpetual license[2].

  2. It is annoying: One does not need to purchase a license to utilize the basic file encryption capabilities of PGP Desktop. The caveat is that a conspicuous reminder is displayed every time the user logs into OS X, and additional reminders rear their ugly head as a user interacts with the software.

  3. It is overkill: A fully-licensed PGP Desktop comes with a lot of tools and utilities that stretch far beyond the scope of file encryption. For those whom this functionality is redundant or unwanted, this is not a feature.

2. Back Up Your Keychain

Make a copies of your secring.pkr and pubring.pkr keyring pair. These files are often found in ~/Documents/PGP.

3. Uninstall PGP Desktop

To uninstall PGP Desktop, drag the PGP Desktop and PGP Shredder applications to the Trash.

4. Install GnuPG for Mac (MacGPG)

The project macpgp.sourceforge.net contains the downloadable installation binaries for
MacGPG 2.0.10 (i386) and MacGPG 2.0.10 (PPC). Download the appropriate installer for your architecture and execute it to install MacGPG.

5. Install GPG Preferences

GPG Preferences allows you to set your GPG preferences, such as application path, keyring store path and backward-compatibility settings. It installs as a configuration panel under System Preferences: GPG Preferences 1.2.2

6. Install GPG Keychain Access

GPG Keychain Access is a gui interface for managing your GPG keyrings. It has a very similar look-and-feel to the keyring manager for PGP Desktop. Download and execute the installer for GPG Keychain Access: GPG Keychain Access 0.7.0.

7. Import Your Keychain

Next, Run GPG Keychain Access under Applications. The program will state that you do not have a private or public key. Click the Import button. Browse to the keyring pair that you backed up previously, and import it.

8. Install GPG File Tool

GPG File Tool is a gui interface for encrypting, decrypting and verifying encrypted files. It allows you to decrypt or verify files by opening them in the Finder. This is true for both files that were encrypted previously with PGP Desktop or from now on with GPG. Download and drag GPG File Tool to your Applications Folder: GPG File Tool 1.0.2.

9. Appendix: Command-line Scripts for Managing Encrypted Files

I have included a few scripts that I find useful for automatically encrypting and decrypting files.

The below script will recursively encrypt every file in a directory, and remove the originals:

#!/bin/sh
# encrypt.sh
# gpg encrypt files and remove originals.
# $1 specifies base directory to encrypt.
set -e

usage() {
echo "ERROR: $*"
echo "usage: "
echo " encrypt.sh DIRECTORY"
}

find_files() {
find . -type f ! -name "*.pgp" ! -name .DS_Store ! -name "*.gpg" ! -name "*.sda.exe"
}

[ $# -ne 1 ] && usage "Missing required directory argument." && exit
[ ! -d "$1" ] && usage "$1 is not a directory." && exit

cd "$1"

find_files | while read file ; do
[ -e "$file.gpg" ] && rm -f "$file.gpg"
echo "Encrypting: $file"
gpg -u user@domain.ext -r user@domain.ext --sign --encrypt "$file"
echo " Created: $file.gpg"
echo " Removing: $file"
rm -f "$file"
done

The below script will decrypt every file in a directory:

#!/bin/sh
# decrypt.sh
# gpg all files in a given directory. Does not recurse directory.
# $1 specifies directory contents to decrypt.
set -e

usage() {
echo "ERROR: $*"
echo "usage: "
echo " decrypt.sh DIRECTORY"
}

find_files() {
find . -maxdepth 1 -and -name "*.pgp" -or -name "*.gpg"
}


[ $# -ne 1 ] && usage "Missing required directory argument." && exit
[ ! -d "$1" ] && usage "$1 is not a directory." && exit

cd "$1"

find_files | while read file ; do
echo "Decrypting: $file"
[[ "$file" =~ ".pgp" ]] && decrypted_file="${file%.pgp}"
[[ "$file" =~ ".gpg" ]] && decrypted_file="${file%.gpg}"
echo "Decrypted file: $decrypted_file"
gpg -o "$decrypted_file" --decrypt "$file"
done

Thursday, May 8, 2008

Installing and Configuring Sun x64 JDK on Fedora

We'll take a look at the install and configure the Sun x64 JDK using on Fedora Core 8. Also, I'll explain how to set up the necessary symbolic links so that Fedora uses Sun Java instead of gcj.

1. Download Sun JDK

First you'll need to download the JDK. This can be found at http://java.com/en/download/manual.jsp. Select Linux RPM (self-extracting file). Download this file. At the time of writing, the current version is jdk 6 update 6, so jdk-6u6-linux-x64-rpm.bin was the file downloaded.

2. Install Sun JDK

Execute the following command to make the installer executable:

$ chmod +x jdk-6u6-linux-x64-rpm.bin

Now execute the file:

$ ./jdk-6u6-linux-x64-rpm.bin

You'll be presented with the Sun License. Accept it. The JDK will then be installed to /usr/java:

$ ls -l /usr/java
total 3
default -> /usr/java/latest
jdk1.6.0_06
latest -> /usr/java/jdk1.6.0_06

3. Configure Fedora

Now the JDK is installed, but we need to tell the system to use this JDK for java programs. To this end, we must configure the system using the alternatives program:

$ /usr/sbin/alternatives --install \
/usr/bin/java java /usr/java/jdk1.6.0_06/bin/java 20

This tells the system that there is an "alternative" installation of java at /usr/java/jdk1.6.0_06, and that this installation has priority 20. The priority you should choose varies, depending on the priority of other java alternatives, like gcj. In the end, you want your Sun JDK to be the highest priority so that it is the default alternative. To see what the various priorities are for all java alternatives, execute the following:

$ /usr/sbin/alternatives --display java

This will show you a list of all the java alternatives, and their respective priorities. Make sure the Sun JDK is the highest priority.
Alternatively, you may explicitly tell the alternatives program to use your Sun JDK for java. This will cause your Sun JDK to be the system choice for java, regardless of priority:

$ /usr/sbin/alternatives --config java

This will present you with a menu of java alternatives. Choose the one corresponding to /usr/java/jdk1.6.0_06.
Repeat the above process for the javac command:

$ /usr/sbin/alternatives --install \
/usr/bin/javac javac /usr/java/jdk1.6.0_06/bin/javac 20

4. Verify Setup

Finally, verify your installation is the one used by the system:

$ java -version
java version "1.6.0_05"
Java(TM) SE Runtime Envioronment (build 1.6.0_05-b13)
Java Hot Spot(TM) 64-Bit Server VM (build 10.0-b19, mixed mode)

$ javac -version
javac 1.6.0_06