A new toy: Yubikey by Yubico

Recently I started using Yubico's Yubikey. After some days
of use I think it's something every geek should have on his desk, or even
better, in his keyring.

What the Yubikey is

The Yubikey is a small, thin USB device that acts like an USB keyboard, thus
it doesn't require any driver installed.
It's made of plastic and it's waterproof, it contains no battery so it
should last forever.
The Yubikey has two slots, I set the first one, activated by pressing the
button for less than 1.5 seconds, to be the One-Time-Password (OTP)
authentication, while I set the second one, activated by pressing the button
for more than 2.5 seconds, to be a static, 28 characters long password.

Yubikey by Zach Copley

I bought the Yubikey + LastPass bundle, so the
first thing I did when I received my key was to enable two factor
authentication in LastPass. It took less than 10 minutes to do it and now
my LastPass account (and all the accounts contained in it) are more secure.

How I use it

Because I don't use many services that support YubiCloud OTP validation I use
mostly the static password.
I use the static password as a sort of poor man two factor authentication,
first I type an unique password for that service, then use the Yubikey to
append the long, static string. For example, my notebook login password is
something like this:

"8 characters password" ++ "28 characters Yubikey password"

Now to login on my notebook you need to know my password and have my key, this
is also more secure and convenient than typing a 16 characters password every
time.

Bonus: fast keyboard layout switch for i3wm

To work properly the Yubikey expects the system keyboard layout to be QWERTY,
while I use dvorak. To switch between layout OS X has a menu item in the
top bar, but i3wm by default has no way to do it. For this reason I changed
my configuration files
as follows:

# .i3/config
# Change keyboard layout
# b and n are the same physical key
bindsym $mod+b exec "setxkbmap us"
bindsym $mod+n exec "setxkbmap dvorak"
bar {
    status_command $HOME/.i3/status_bar.sh
    colors {
        background #1B1D1E
        statusline #F37D11
        focused_workspace #333333 #272822 #95D92B
        active_workspace #333333 #272822 #62CBEE
        inactive_workspace #333333 #272822 #F1F1F2
        urgent_workspace #333333 #272822 #F71A5C
    }
}

And to display the current layout in the status bar:

# .i3/status_bar.sh
#!/bin/bash

i3status --config ~/.i3/i3status.conf | while :
do
    read line
    LG=$(setxkbmap -print | grep xkb_symbols | awk -F"+" '{print $2}')
    if [ "$LG" == "us(dvorak)" ]; then
        dat="[{ \"full_text\": \"LANG: ${LG}\", \"color\":\"00FF00\" },"
    else
        dat="[{ \"full_text\": \"LANG: ${LG}\", \"color\":\"FF0000\" },"
    fi
    echo "${line/[/$dat}" || exit 1
done

Photo courtesy of Zach Copley.