Fotolia_55771234_XS.jpg

But Why?!

Most simply, WordPress just wasn’t the tool for what I needed.

My Requirements

  • Write locally, then push to the server
  • Markdown or Textile
  • Easy backup strategy
  • Performant
  • Maintain existing comments

Write locally, then push to the server

Writing locally means I don’t have to worry about sessions, exposing an admin section of my site that could be compromised, etc. Additionally, it means I can use Git and put my blog under source control.

Markdown or Textile

Self explanatory

Easy backup strategy

With WordPress an export gives you the content, but you also need to make sure you have a backup strategy for your database, images, etc.

Putting my blog in Git with a static generator means my source is my backup. Should someone ever hack my site, I just change my password and push again.

Performant

Self explanatory. You can’t get any faster than statically generated pages, even with WordPress cache plugins (which surprised me, they still seemed slow).

Maintain existing comments

Luckily my comments are already hosted via Disqus, so I simply needed to make sure whatever my solution would be could reference my existing post comments.

The Solution

Hexo! To get started, I just exported my site out of WordPress and imported into Hexo with hexo-migrator-wordpress.

Then, I downloaded all of my WordPress images and placed them into the posts’ asset folders. To use them, change the image references to {% asset_img image_name.png %}

Additionally, my previous code blocks were pretty messed up, so I replaced them with:
{% codeblock FILENAME lang:LANGUAGE %} ... {% endcodeblock %}

Next, I had issues with my image links. Where I wanted to do something like this:

1
{% asset_link full-image.png {% asset_img small-image.png %} %}

Instead I had to use traditional markdown, like this:
1
[![Title](full/path/to/small-image.png)](full/path/to/large-image.png)

The theme I went with (Tranquilpeak) supports both Google Analytics and Disqus, so I simply updated the _config.yml, then in each of my existing posts I added a disqusIdentifier frontmatter that matched my old posts.

And with all of that, here we are! Luckily without too many posts already it wasn’t too much work.

Comment and share

Cloud security

Some Background

I keep a private development server (on DigitalOcean) running FreeBSD. None of the users have passwords, I only use certificate based authentication to get in.

Ever since I first heard of Duo (https://www.duosecurity.com/product) I’ve wanted to integrate it into some of my projects. I figured hey, why not start with my dev server!

Getting Started

Honestly, Duo has done an amazing job at making the process extremely easy.

First, create your free account at https://signup.duosecurity.com/.

In the process, you will want to download their app to your phone (if you want to use push notifications, otherwise you can use SMS).

After you have followed the wizard, you are ready to integrate it into your system, your application, or whatever else you want.

Integrating Duo with FreeBSD

After signing into the Duo administrative dashboard, simply create a new Integration and choose UNIX Integration. Then, at the top of the page click the Duo Unix documentation and follow the guide. Consistent with everything Duo has done so far, it is both thorough and clear.

I chose only to integrate Duo with SSH, not with PAM. So for me I simply had to:

  1. Download duo_unix (https://dl.duosecurity.com/duo_unix-latest.tar.gz)
  2. Compile and install it
  3. Configure /etc/duo/login_duo.conf with the keys generated on your integration page
  4. Execute /usr/sbin/login_duo to test the configuration
  5. Add this to my sshd_config:
    ForceCommand /usr/sbin/login_duo

    That’s it! Now I login to my server with my SSH key, approve the login on my phone, and I’m good to go!

I’ve chosen to configure login_duo.conf to automatically choose push notifications (as opposed to SMS or phone call), and also configured it to only be enabled from the wheel group. For reference, here is my configuration:

[duo]
; Duo integration key
ikey = ***
; Duo secret key
skey = ***
; Duo API host
host = ***
; Send command for Duo Push authentication
pushinfo = yes
group = wheel
autopush = yes
prompts = 1

What’s Next?

Next, I might choose to integrate Duo with PAM (documented in the same integration guide), add it to WordPress, add it to my own applications, who knows?! Either way, I’m certainly impressed with what Duo has come up with.

Comment and share

  • page 1 of 1

Craig St. Jean

Father, programmer, constant learner, @pluralsight author


Software Architect