Using Encrypted Email

Have you read these articles?

Encrypted Email Provider Lavabit Shuts Down, Blames US Gov’t – Slashdot.

 Silent Circle Preemptively Shuts Down Encrypted Email Service To Prevent NSA Spying – TechCrunch.

Encrypting your email isn’t terribly difficult, and ensures that the contents are encrypted end-to-end from sender all the way to recipient. SSL only protects the contents while in transit, from your PC to your mail server. Your email may still be transferred unencrypted (plain text) from mail server to mail server, and will typically be stored in plaintext on the mail servers storage.

Your first step really should be to read a public key (asymmetric) encryption primer, I found several with a Google search. At it’s most basic, you create both a private and public key (referred to as a key pair). Your public key, you can freely give to the world. Your private key, you keep confidential. As added security, you should use a strong passphrase on your private key. The advantage with asymmetric encryption is that any parties wishing to send secure messages don’t need to agree on a secret key (symmetric encryption) beforehand, which can be an issue when you don’t have a secure way to share the secret with each other!

Now if someone needs to send you a secure message, they can use your public key to encrypt the contents, which can only be decrypted by your private key. When you respond, you encrypt the message with the recipients public key, and it can only be decrypted with their private key.

The authenticity of a message can also be verified, encrypted or not by “signing” the message. You do this by placing a digital fingerprint on your message using your private key, that can be only be verified with your public key (which everyone already has). The can verify the sender, and verify that the contents of the message were not modified while in transit.

I’m using GPGTools for OSX, and Windows has Gpg4win. Linux will have command line utilities, although plenty of front-ends are available.

I’ve provided my public key below!

—–BEGIN PGP PUBLIC KEY BLOCK—–
Version: GnuPG/MacGPG2 v2.0.20 (Darwin)
Comment: GPGTools – https://gpgtools.org

mQENBFIGeSABCADa5XQmEGoNBM+hMzxbS7Ove1THnAqQRrDGxqSpxMUADqFjfBuR
HHJyFTIz5B9i1zMN7rGeDwWrG5L/MGtkLi3Q4LbJddILl1FerhTGeerY4wPvQG2D
tpcQdhKxydbmYPl7VOzyvBOeU1Cvbn2L2K4WSYP5WwybY+eoJqJ3XGj9+x+MZqZc
Wl0oegISEiHBHo9zvYGcD/+1mkQCe99ty9DYwWpC+vHySRcMfv5boCI0RG/EmLY0
Uu8I9t+lnPQ/tggcvhEbvw/bR0yGohg3+SOAlUyXE4VirMdPytBAU/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RzNs3wtVxSK3AG15VbOp289gBuFdWfPqxIqPjz5dVs7YbzQwK
2SKRx9LqCKkwtTeAdwWiKOg5coHJmXTbxEqwjAbAojHiHDfB4MYvLb2pI4H7Lrsb
9FeK5nFBwizW7wESWPbDuMUOwsrKDdA7HNddhQK6CljDVl0x/CMEklzvyw3YdS8X
aTRmbaBnnWcWoieQc50LvT0r9nDarhSeyxU97GiRMltrf5X+t6gzegL55j1WJEgE
OIyN20rWep9MacKlhhiqftYaD5OfCd5xL5hYRbWACACzJcVJb93yunMvaaD2CcIv
jX+1PkU45UVA3O9rhhEctDm+H3HuELwIm0/P17CfIty9DNLx21jJPIMQfOh2McLC
5W73u66a69vXWa6x884MgsXdBk8+TGZ7vO8f2SzHdenzWDfOtBKRoyGbaUfplBTv
/T3Z7txYOOZtbEZgor7b4xmkSJDlrtxmaw4c71qQMmwvisJZHdmoazLX/RUeUWbn
JtJzCqnk1uGExnTIGnsGyx69G8KemUDLPUkrMdhhYAJ9JXj58LfucnnJAQr+Vbg+
hhfQ79e3zve2XQKRk8sint7XU3bPmPIRmciQAOyTyzmmIh7vYv2W2CZQWsukKgE6
=+SSg
—–END PGP PUBLIC KEY BLOCK—–

1,000 Tweets Math

We take my first tweet on July 08, Screen shot 2013-02-20 at 11.41.38 AM

and convert it to epoch time.

date --date='08 Jul 2009 14:08 -0500' '+%s'
1247080080

My 1, 000th tweet takes place on Feb 20, 2013 @ 16:00.

date --date='20 Feb 2013 16:00 -0500' '+%s'
1361394000

The difference between the two dates in seconds …

echo "1361394000 - 1247080080"|bc
114313920

… and the average seconds between each tweet …

echo "scale=2;114313920 / 1000"|bc
114313.92

…for an average of …

echo "scale=2;114313.92 / 86400"|bc
1.32

… 1.32 days days per tweet, over 114,313,920 (plus or minus a maximum of 59) seconds!

Creating an OS/2 WARP 4 Virtual Machine – Part 2

Before installing FixPack 15, a few utilities are in order. And since WebExplorer is essentially a broken browser, use FTP to retrieve them.

Info-Zip

Some of the updates involved are in .zip format, so first retrieve Info-Zip’s UnZip utility. Place it somewhere for keeps, like C:Unzip,  and run it in an OS/2 Terminal window.

ftp
open ftp.info-zip.org
anonymous
<any password>
cd pub/infozip/os2
bin
get unz600.exe
quit
unz600.exe

RSUINSTN.EXE

An updated version (1.99) of the RSUINSTN.EXE utility is needed to install both FixPack 15 and Device Driver FixPack 2 by the preferred “Remote Service Utility” (RSU) way. Run it in an OS/2 Terminal window also.

ftp
open service.boulder.ibm.com
anonymous
<any password>
cd ps/products/os2/rsu
bin
get rsuinstn.exe
quit
rsuinstn.exe

Copy RSUINST.EXE and UNZIP.EXE to C:TCPIPBIN. Duplicates of these files should not exist anywhere else in your path. If RXFTP.DLL in C:TCPIPDLL is dated earlier than 1997-09-04, replace it with newer one that was extracted from RSUINSTN.EXE.

FixPack 15

There are two ways to install FixPack 15, the simple way with the “Remote Software Update” (RSU) service, and the manual hard way. Using the RSU way, I needed to transfer XR_M015.RSU to the OS/2 guest and open it with WebExplorer via the File | Open menu, trying to open it directly from the site or Save As wouldn’t work for me.

For the hard way, open up an OS/2 Terminal window and FTP the required files.

ftp
open ps.boulder.ibm.com
anonymous
<any password>
cd /ps/products/os2/rsu/xr_m015
bin
prompt
mget *
quit

While you can do this on VM itself, I chose to store them on a local FTP server. If you try it this was way also, you may want to set your VM to use a bridged adaptor instead and give it a real IP address rather than NAT, otherwise you are probably going to run into problems with the built-in OS/2 FTP client.

Unzip the files you just downloaded in your OS/2 Terminal window.

cd download
C:unzip32-bitunzip.exe -d csf143.zip
md os2serv
cd os2serv
c:unzip32-bitunzip.exe -d c:downloadf*.zip
c:unzip32-bitunzip.exe -d c:downloadx*.zip

To start the FixPack installation, run the following in you OS/2 Terminal window.

cd download
os2serv

Select to install, reboot when it’s complete. Open an “OS/2 Window” and run “syslevel”, the Base Operating System should read “XR0M015”, confirming that it was successfully installed. If you experience any graphical corruption, try resetting your resolution to 640x480x256.

MPTS 5.3

The TCP/IP stack that OS/2 ships with is 16bit, and can’t be upgraded through the RSU service. Download the required files to a temporary directory with the OS/2 Terminal window.

ftp
open service.boulder.ibm.com
anonymous
<any password>
cd ps/products/mpts/fixes/english-us/wr08610_conv
mget *
quit

There’s a readme included that provides instructions on creating these from floppies using the LOADDSKF.EXE utility. This never worked for me, so instead download and the Fastkick utility and place it in the same directory you placed the MPTS download. Next, unzip everything.

ftp
open asavage.dyndns.org
cd /OS2
bin
get fastkick144.zip
quit
C:unzip32-bitunzip.exe fastkick144.zip
dskxtrct.exe /s:w0861b01.dsk /t:. /ra

Repeat the last step for all 8 files, delete fastkick144.zip, then install by running INSTALL.CMD.

In an OS/2 Terminal window run the “syslevel” command. The “IBM TCP/IP Stack” should report the current CSD level as “WR08610” to confirm it was successfully installed. If you’ve been using static IP settings, you should be safe to use DHCP at this point.

Device Driver Fixpak

I could only find this available via RSU at OS/2 FixPak Information. It should be run from WebExplorer with the File | Open menu as well.

VirtualBox Guest Additions

The Guest Additions have limited support, and aren’t required, but do provide some keyboard and mouse integration, so you won’t need to capture/uncapture any longer, as well as improved video support. The Guest Additions are installed by connecting the Guest Additions virtual drive in the same manner as a virtual CD drive. There is no automated installer provided, but instructions are present in the README.TXT file.

Hint: Use TEDIT when booted in command line mode to edit C:CONFIG.SYS.

You can now add custom resolutions to VirtualBox with the following commands. Replace “OS/2 TEST 2” with the name of your VM.

/usr/bin/VBoxManage setextradata “OS2 TEST 2” CustomVideoMode1 “1152x870x32”
/usr/bin/VBoxManage setextradata “OS2 TEST 2” CustomVideoMode2 “1440x900x32”
/usr/bin/VBoxManage setextradata “OS2 TEST 2” CustomVideoMode3 “1152x870x16”
/usr/bin/VBoxManage setextradata “OS2 TEST 2” CustomVideoMode4 “1440x900x16”

A custom monitor definition is required to support these increased resolutions. As an example with my own monitor, I’ve placed the following in C:OS2PRIVATE.DIF.

[Monitor]
OEMString = "LG Flatron W1952TQ"
XSize = 300
YSize = 225
[comment]
Graphics Mode: 640 x 480 at 60Hz vertical refresh.
[ModeInfo]
XResolution = 640
YResolution = 480
VerticalRefresh = 60
HorizontalRefresh = 31
VPolarityPositive = 0
HPolarityPositive = 0
[comment]
Graphics Mode: 800 x 600 at 60Hz vertical refresh.
[ModeInfo]
XResolution = 800
YResolution = 600
VerticalRefresh = 60
VPolarityPositive = 0
YPolarityPositive = 0
[comment]
Graphics Mode: 1152 x 870 at 75Hz vertical refresh.
[ModeInfo]
XResolution = 1152
YResolution = 870
VerticalRefresh = 75
HorizontalRefresh = 68
VPolarityPositive = 0
HPolarityPositive = 0
[comment]
Graphics Mode: 1440 x 900 at 60Hz vertical refresh.
[ModeInfo]
XResolution = 1440
YResolution = 900
VerticalRefresh = 60
HorizontalRefresh = 56
VPolarityPositive = 0
HPolarityPositive = 0

Web Browser

WebExplorer isn’t capable of rendering any modern websites, but a Firefox port is available at Warpzilla, and isn’t too difficult to install.

There are still a few OS/2 resources out there, and eComStation has taken it a step further with a number of enhancements and ports. Most however are disappearing and look to have not been updated in a very long time. I’ve already added this article to my Evernote notebook.

Creating an OS/2 WARP 4 Virtual Machine – Part 1

When OS/2 WARP version 4 was first released I installed it because it was supposed to be technically superior than what Windows offered. I came across OS/2 again a couple of years ago while flipping through some old CDs, and thought “Wouldn’t it be fun to get this up running again, for jokes?”. So I downloaded VirtualBox and installed it as a virtual machine. The installation, and necessary upgrades with FixPacks in order to run a modern browser, ended up as a complicated routine compared to more current operating systems. OS/2 WARP 4 was released back when the internet as it’s seen today was pretty much in it’s infancy, and what little information that was out there has started to disappear. Anyway, OS/2 was forgotten about again until for some reason it caught my eye among all the other virtualized operating systems I have installed, and I thought about all that time I had spent installing it. I couldn’t recall every step I had taken for the procedure, and if anyone is ever going to do this in the future, a guide might be nice.

Creating installation media

I did this on an early-2011 MacBook Pro running Mac OSX 10.8 and VirtualBox.  Most of the steps should be pretty similar with other virtualization software.

Aside from requiring the OS/2 Operating System CD, if you’re installing under an OSX host, then either a Windows or Linux guest to create images of the bootable floppies is needed. The OS/2 CD itself isn’t bootable, and OSX isn’t even able to read the CDFS filesystem that was used to write it with. Alternatively, you can get disk images of the floppies online. If you’re using a Linux host, then you can get away without having to use another guest OS altogether.

The guest OS under which you do create the boot floppy images will need both a floppy controller and drive. In the virtual machine guest settings, go to the “Storage” tab (make sure the guest OS is powered down first), and add a new controller to the storage tree, then select “floppy controller”. Next, add a floppy drive to the controller itself. If it asks for an image file, just choose to leave it empty for now.

storage tab

Start by creating 3 blank floppy images in your OSX or Linux host with the following from a command prompt. If you have a Windows host, you can transfer them from a guest OS, or download them online.

dd bs=512 count=2880 if=/dev/zero of=disk0.img
dd bs=512 count=2880 if=/dev/zero of=disk1_cd.img
dd bs=512 count=2880 if=/dev/zero of=disk2.img

On the OS/2 CD, in the “DISKIMGS” directory, is a utility to create the bootable floppies, “XDFCOPY.EXE”, that should run under a Windows guest in a Command Terminal.

D:DISKIMGSXDFCOPY D:DISKIMGSOS235DISK0.DSK A:

Do the same for DISK1_CD.DSK and DISK2.DSK.

Under a Linux guest or host,  you can create the boot floppy images directly with the “dd” command.

dd if=/media/OS2WARP4/diskimages/os2/35/disk0.dsk of=disk0.img
dd if=/media/OS2WARP4/diskimages/os2/35/disk1_cd.dsk of=disk1_cd.img
dd if=/media/OS2WARP4/diskimages/os2/35/disk2.dsk of=disk2.img

Installation

Now create a new virtual machine, pick a name for it, and choose “IBM OS/2” as the Operating System and “OS/2 Warp 4” as the version.

System requirements are pretty trivial by today’s standards, the 64 MB of RAM and 2GB hard disk defaults are more than plenty. The file type can just be VDI (VirtualBox Disk Image), unless you know you’ll need something else.

Change the audio controller under the Audio tab in the virtual machine’s Settings menu to SoundBlaster 16, and add both a floppy controller and floppy drive under the Storage tab.

Finally, start your virtual machine with disk0.img in the virtual floppy drive and your host’s CD drive attached with the OS/2 CD inserted. If all goes well, you will be see a blue OS/2 boot screen and be prompted to insert disk 1.

OS/2 boot screen

Just follow the prompts at this point, choose Advanced Installation if you want to use HPFS or change the default partitioning scheme.

At the “System Configuration” screen, select “Sound Blaster 16” for Multimedia Device Support, and “GENGRADD” for Primary Display.

After awhile of file copying, you will be prompted with a software selection screen. Select whatever looks interesting, at the minimum you will probably want TCP/IP services. Win – OS2 will even allow you to run some Windows 3.1 applications.

To configure your network settings once the OS/2 guest is up and running, follow the “OS/2 System” icon to “System Setup”, and “TCP/IP Configuration”. Enable Interface 0 and enter your network settings. I wasn’t able to get DHCP working properly until MPTS was upgraded (we’ll do this in Part 2, my suggestion is to enter the settings manually for now. A reboot was needed to get networking started, but once you do, start up WebExplorer to see the world’s leading edge web browser, circa-1996.

IBM WebExplorer

At this point you want to bump the screen resolution and you can do so by  going to the OS/2 System icon and following down to the System Setup, System icons, and the Screen tab.

In Part 2 we’ll update the newly installed system with FixPack 15, Device Driver FixPack 2, and MPTS.

Ubuntu Trash maintenance

The functionality of the old Trash folder is something that’s always annoyed me. You either never remember to empty it, and if you do, it’s all or nothing. While playing around with Ubuntu, I noticed this and a lack of a secure delete option. Nor was there any simple way to clear your history of recently opened documents. Missed features like this are fun to script around.

Pretty similar to an OSX script I’ve written to do the roughly the same, Periodic.sh will prune your Trash based on how old it is. Securely deleting it should be a feature of any Trash folder, so that’s in there too (secure-delete toolkit required, apt-get install secure-delete). Clearing your recently opened items is optionally thrown in also, since Ubuntu is missing this as well.

Usage:

Periodic.sh -n [seconds to keep trash] -w [your home directory] -m [maximum entries]  -h [true|false] -s [true|false]

-h = delete history
-s = secure delete, requires srm (secure deletion toolkit)

I don’t have any desktop Linux machines other than Ubuntu, but it’s probably safe to say this wouldn’t work with any other distribution.. at least not without some minor modifications.

GeekTool Network Info Script

GeekTool, in their words “is an application for Mac OS 10.6+. It lets you display various kinds of information on your desktop via 3 default plug-ins.” With a little bit of scripting ability, you can display all sorts of useful information on your desktop.

GeekTool desktop

Here I have some weather, and whatever network interface my MacBook using along with my current IP address. You can download my network interface script here. To get it running, you’ll need to create an IPAddresses.cfg in the same directory you’ve put the script in (I just use Scripts under my home directory). All it contains is a list of the network interfaces to probe, typically just…

en0
en1

…which should be your ethernet and WiFi ports. You can run “ifconfig -a” from the Terminal app if you’re unsure. Once this is done, you can test this in the Terminal app again by running “./IPAddresses.sh” from the directory you stored the script in. You should see an output similar to the screenshot above.

Once this is all working, you just need to drag a new “Shell” widget from GeekTool onto your desktop, and set the Command field to the script location, “/Users/username/Scripts/IPAddresses.sh -c /Users/username/Scripts/” The -c switch just specifies the location of the configuration file you created, the GeekTool scheduler won’t be able to find it otherwise, even if it’s in the same directory. The refresh field is how often you want the script to rerun, I chose 3,600 seconds, but you can go with either shorter or longer intervals. Everything else is pretty much optional, you can select fonts, colours, position, etc. GeekTool will automatically pick black text, so if you have dark backgrounds like I do and you don’t see anything, check the font colour first!

All me, me, me.