Archive for December 2007


So, yeah, I’m back.

December 10th, 2007 — 12:58am

Things have been busy, y’see? We made another kid last January, so that slowed things down a lot (main thing that slowed: my brain). Also it is the case that things have been lively at my workplace and well so the fact of the matter, dear reader, is that I just didn’t really feel up to throwing any text at you for a while.

But I’ll see what I can do.

Upcoming will probably just be brain-dumps on various technology topics so I can stop thinking about them. Also, complaining.

Cheers.

Comment » | meta

An OpenID, via WordPress/phpMyId, on Dreamhost

December 10th, 2007 — 12:35am

Returning to this venue, after long hiatus: hi!

Today’s topic: So You Want To Get You One Of Them OpenIDs. And, you’re the sort of rugged DIY nerdo who hosts his own sites; and, you’re the sort of cheapskate who uses Dreamhost to do it. And, in a further creepy emulation of me, you run your own WordPress, *and* you have stumbled through just enough text on OpenID to understand that you were stymied enough to google for a page very much like this one. In which case: hi!

The specific case I’m addressing is that you host your own WordPress, perhaps named similarly to http://andy.boyko.net/, and you’d prefer, for whatever misguided reason, to use that same fine URI as your OpenID, and that furthermore you’re not afraid of 15 minutes of fiddling for its own sake. This will *not* help, in any way that I can discern, if you want to allow people visiting your WordPress installation to log in with their own OpenIDs in order to comment. I gather there are WordPress plugins to help you achieve that; I surely haven’t tried them yet (because, really, my focus at this moment is on making life easier for me, not any of you) but I imagine those plugins would work in tandem with what you do in the following steps.

If you’re not using Dreamhost, maybe you just want a general explanation on what to do, such as those provided by Sam Ruby or Simon Willison. This explanation is mostly lifted from their work, modulo the Dreamhost-isms.

But so we’ll assume this:

  • you’re a Dreamhost user, running your own WordPress instance under its own domain or subdomain (e.g. ‘myblog.com’, ‘andy.boyko.net’)
  • you understand Dreamhost’s Panel sufficiently to add a new domain
  • you have shell access
  • you only care about a one-person solution
  • you’re not afraid

Do these things:

  • In the Dreamhost panel, create a new subdomain on your blog’s domain, which will host the phpMyID tool, which is the secret sauce here, providing you with an “OpenID provider”, if I get the jargon right. Note that you won’t use the name of this subdomain that you choose here directly, though it will appear buried in HTML tags in your site. Given a WordPress instance at andy.boyko.net, I chose to create the subdomain ‘openid.andy.boyko.net’ for this purpose, though its name needn’t relate to your WordPress’s URL. I’ll refer to this new OpenID provider subdomain as openid.yourblog.domain.
  • Get a copy of phpMyID (version 0.7 at this writing; newer versions may invalidate some of this instruction) and unpack the .tar.gz file into your home directory, resulting in ~/phpMyID-0.7/
  • You need three files from the unpacked phpMyID package in the newly created directory for the OpenID subdomain, ~/openid.yourblog.domain/:

    cp ~/phpMyID-0.7/MyID.php ~/openid.yourblog.domain/
    cp ~/phpMyID-0.7/MyID.config.php ~/openid.yourblog.domain/index.php
    cp ~/phpMyID-0.7/htaccess ~/openid.yourblog.domain/.htaccess
  • Edit the .htaccess file, and uncomment the first of the three provided solutions — since PHP runs as a CGI on Dreamhost, you need mod_rewrite trickery to overcome some problem or over. Just accept it.
  • Follow the phpMyID README configuration, so that you create a new MD5 hash for your password, and update the index.php file accordingly with your new name and the resulting password hash. (Create the hash as instructed in the README, through ‘openssl md5‘.)
  • To preclude a baffling HTTP redirection loop later, trust the impossibly wise Sam Ruby, and add this line:

    'idp_url' => 'http://openid.yourblog.domain/',

    to the $GLOBALS['profile'] hash, along with the username, password, and realm.
  • Follow the README’s advices and test the installation of phpMyID, which at this point should be substantially complete, by visiting http://openid.yourblog.domain/ and logging in. Apparently, it is not unreasonable to be confident that this is OK despite not being SSL-encrypted, because of the use of digested authentication. Go with that. Prove that you’re able to log yourself in with the password you provided. You’re now done fiddling with the installation of phpMyID, and you can leave this new subdomain alone.
  • Well, before you leave it alone, take one more peek at the index.php configuration, and because you’re a savvy self-starting soul, and you realize the implications of the $GLOBALS['sreg'] array, you might as well populate it with as much boilerplate personal info (e.g. full name, nickname, location) as you’re comfortable automatically transmitting to various Web-two-dot-zero entrepreneur types; minimal testing suggests those sites will helpfully pull that data in for you when you establish a new account after having logged in via OpenID.
  • Now, head over to your WordPress, and bolt this new OpenID provider into it, by editing your chosen template (via ‘Presentation’/’Theme Editor’). Specifically, crack open the ‘header’ and, right before the closing </head> tag, insert this voodoo boilerplate:

    <link rel="openid.server" href="http://openid.yourblog.domain/">
    <link rel="openid.delegate" href="http://openid.yourblog.domain/">

    The wise Mr. Ruby suggests that, by adding the idp_url config above, the second (visibly redundant) line becomes unnecessary, but I’m too lazy to even bother eliding it. Note that there’s apparently a WordPress plugin that achieves the same one-or-two-line patch without you having to hand-tweak the HTML head, which might be preferable, but I haven’t investigated.

Anyhow, upon saving that change to your header, you should find that by simply providing the URI for your WordPress installation to the various ‘Web-two-dot-zero’ sites that offer an OpenID login option, those sites will do the right thing, reading the “link rel=” tag and as a result contacting your new minimal phpMyID-based OpenID provider. And, apparently, this is all OK.

Good luck.

2 comments » | sysadmin

Back to top