Skip to content

Blog

Reminding myself which machine I am authenticating to with a sudo “lecture”

I frequently SSH into various systems from my primary Linux machine. There is an analogous issue to “too many browser tabs” that exists here — having too many SSH sessions open in different terminal tabs!

There is a risk in these cases of accidentally typing a higher-privileged sudo password into a lower security system by typing into the wrong terminal. There are various approaches that can help here; I have used screen banners with different colours before.

A good “last line of defence” approach to this risk that I have settled on is to make use of sudo‘s “lectures”. You will have seen the default:

We trust you have received the usual lecture from the local System Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.

We can customise this, and also set it to always show, rather than just the first time you ever use sudo on that machine. We’ll create a custom lecture file with our desired text — in my case, the hostname I’m logged into, so I’m sure where I am before I type the password!

Then, use visudo to set these options:

Defaults lecture=always
Defaults lecture_file=/etc/custom_sudo_lecture

Light

Morning

WordPress, Custom Field Suite and the WP REST API as a Middleware Platform

WordPress logo

Over the last five years or so, I’ve worked a lot with WordPress — developing custom plugins as well as piecing together pre-existing components to build (hopefully) really great websites.

But WordPress is more than just a blogging tool, and can be more just a tool for websites.

My most recent WordPress-related endeavour has been in my day job.

I have been looking at taking various bits of information about business processes that thus far have been disparate and disconnected and structuring and centralising that information so it can be more useful.

I’ve been using custom post types in WordPress for different types of information. Custom Field Suite makes describing the metadata we want to store a breeze, and effortlessly provides a beautiful and usable interface for “mere mortals” to input and manipulate the data later in the WP-Admin interface.

I work in an education environment; a simple example of one of these entities is the lunch menu (formerly just a Word document with no meaningful machine-readable structure at all). This was a nice, easy and public entity to start with.

So, we have a:

  • Custom post type for a lunch menu
  • A Custom Field Suite field group attached to the custom post type
  • Members plugin to control read and write access to that custom post type 

The final piece of the puzzle is using the WP REST API to be able to expose this data to other systems.

With a very small amount of code, the REST API can be convinced to enable access to these custom entities — and of course we still retain WordPress’ access control (with a little help from the Members plugin) to ensure we’re not too free with our data!

Now we have somewhere where non-technical users can go to input data and the ability then to export that data through the REST API into any other application. Because we’ve formalised the structure of the information, we have the flexibility to display it in all sorts of different ways that are appropriate for the medium.

So our lunch menu can be:

  • Exposed via the web
  • Displayed on a screen in public areas
  • And more!

The lunch menu design was an exciting proof of concept of the idea. I’m now moving on to slightly more ambitious projects which involve using a little bit of custom ‘glue’ in PowerShell (but whichever programming language is appropriate could be used!) to write data from other external systems into WordPress for later use.

Getting information out of big proprietary information systems using their provided tools that require… shall we say patience… has been a challenge. But, once liberated, this information is now stored, structure, and now can be queried simply and securely for all sorts of uses.

Back in 2011 when I started developing for WordPress with Chris from Van Patten Media, I remember thinking to myself, “yeah, I can probably figure this out”. It perhaps wouldn’t have been so obvious then that building a skill set with a ‘blogging tool’ would prove useful five years later in a quite different context, but this is testament to the versatility of the WordPress platform and what it has become!

Whiskers

One of the reasons I do love the camera on my iPhone. It truly is remarkable the enormous power we carry in our pockets!

Happy Leap Day from this random cat!

Close-up of whiskers and nose of domestic cat

Photo by Peter Upfold, available under Creative Commons Attribution-Noncommercial-Share Alike 2.0 UK: England & Wales License, if you’d like to use it. My view in this case is that including the photo in a larger publication should not invoke the “Share Alike” clause, but modifications to the photo itself should.

Merry Chris-TLS-mas

Just a quick note to wish you, dear reader, a very Happy New Year. As I enter my 11th year of blogging, I hope I will be able to make a little bit more time in 2016 for more regular posts!

Also, I’m pleased to note that thanks to the wonderful folks at the Let’s Encrypt project, the whole of my site is now served over HTTPS. Given my more recent security focus, that was something that was long overdue. I’m very grateful to the Let’s Encrypt project sponsors, as the project offers a solution that provides equal, if not better, verification that traditional Domain Validation TLS certificates, at the cost of precisely zero.

Here’s to 2016!

One Decade

I made my first blog post on this day ten whole years ago.

Back then it was all pre-self-hosting, and the blog (sans the rest of the website) lived over at Blogger. Beyond just the technology, I think my blogging style and the content that I have focused on has evolved quite a lot since my first few posts as well!

The years brought a migration to WordPress, upon which the blog still runs, and four major design revisions too.

pwdb_decade_pwdb2  pwdb_decade_2009  The new site design screenshot  PWDB 5.0 Mobile display

Here’s to the next ten years!

Merry Christmas and a Happy New Year

Just a quick note to wish everyone that visits here, whether you are a good friend, or just stopping by for a tutorial or some software, a very Merry Christmas and Happy New Year.

I hope 2010 will be prosperous and productive. 🙂

Write in Helvetica in iPhone OS Notes

UPDATE: As of iOS 4.2, you can now change the font via Settings > Notes. No hacks required!

If you don’t like Marker Felt, the default font used when writing notes in the Notes application in iPhone OS, you can actually write in a different font. It’s not a feature that is exposed via the user interface — in fact it seems to be something that is an unintended side effect rather than a feature.

First, you need to enable the Japanese QWERTY keyboard. From the home screen, go to Settings > General > Keyboard > International Keyboards. Now scroll to Japanese, tap it and switch on the QWERTY keyboard.

Japanese QWERTY

Now fire up Notes and make a new note, or edit an existing one. Press the globe button at the bottom left of the keyboard to switch over to the Japanese keyboard.

Toggle keyboards

Then type a character — doesn’t really matter which one — and immediately press the globe again to switch back to your default keyboard. The rest of this note will be beautifully typeset in Helvetica.

I Love the Little Details…

Need for Speed Most Wanted Box Story

I love tiny little details, even if they’re not ever intended to be seen by the public.

The screenshot above is one I took in Need for Speed: Most Wanted (while looking backwards). What I find interesting in this is the detail written on the cardboard box texture on the left.

» Read the rest of this post…