Archive for the 'howto' Category

Howto: Securing a folder with apache’s built in htaccess options

Tuesday, May 24th, 2011

If your web site is running on Apache, and almost all are, there’s a simple way to protect directories on your web server. This method can be very secure, when combined with HTTPS and some good practices on your part, but it can also be a simple way to limit access to just a few people who know a password – perhaps as an alternative to Facebook sharing.

The feature being used is Apache’s HTTP Basic Authentication module. Apache has their own How-To at their web site, but here are the basics:

You need to add two files to your web server, and it helps if you have access to a terminal/command prompt.

Here are two key files and their their contents.
.htaccess

#Force HTTPS
#RewriteEngine On
#RewriteCond %{HTTPS} !=on
#RewriteRule ^(.*) %{HTTP_HOST}%{REQUEST_URI} [R,L]

AuthType Basic
AuthName "Restricted Files"
AuthBasicProvider file
# Needs full unix file address, output of pwd command
AuthUserFile /var/www/html/examples/guest_w_pass/.htpasswd
Require valid-user

These are basic .htaccess directives, that most web servers should allow. The first segment is to force the use of HTTPS, you might want uncomment that if HTTPS is important to your application. The second section turns on basic authentication and directs the web server to where to get the password file – you can put the password file anywhere your web server can access it and it does not have to be in the same folder as the .htaccess file. You are responsible for finding the full unix path to the file, either from the pwd command or the “Get Info” option inside a file browser.

.htpasswd

guest:{SHA}K8+J8fKKKxjnREM2J4/C72Qawa4=

This file is the results of the command htpasswd -sc .htpasswd guest. The s after the – is for SHA-based password hashing and the c after the – is for create. The file can be added to or updated with the command htpasswd .htpasswd username. Run the command htpasswd --help for more information.

What to Look for when Trying to Author Accessible Content: My List

Monday, February 21st, 2011

A picture of the HTML source of this blog post.I’ve assembled my list of things to look for when preparing content for the web with an eye to accessibility. I would like to add to this advice that I’ve always found that accessible web pages are the easiest way to create content that is well indexed by a search engine – as both serve the goal of helping a machine interpret the content better.

This list is written assuming that most modern tools that help construct content directly for the web help individuals create accessible content by default, and that this is the primary way content makes its way to the web. Tools like WordPress for blogs, or Learning Management Systems (LMSs).

Multimedia content is particularly challenging, as it can require the use multiple senses, and unless accommodations such as transcription or description are added, some individuals may not be able to access multimedia content.

Evan more than with most posts; I’d love to read your comments and suggestions about this list and these practices.

My Checklist for Preparing Accessible Content

This list was created by Matt Clare with resources from World Wide Web Consortium. [1] The W3C has a simular checklist document: www.w3.org/TR/2006/WD-WCAG20-20060427/appendixB.html [2]


Simple Formatting

What happens when you wipe your iPhone with Exchange

Friday, January 28th, 2011

If you’ve ever wondered what happens when you wipe an iPhone via MS Exchange here’s my video.

I hope you don’t find yourself in a situation where you need to wipe your MS Exchange linked iPhone because you lost it or it was stollen, but I think everyone who has their phone connected to Exchange at work or Apple’s MobileMe service appreciates this kind of piece of mind. I know I really value knowing that if someone’s got my phone they at least don’t have my data like E-Mails, contacts, pictures and whatever else is on my most personal device.

In the case of MS Exchange 2010 here is what the confirmation E-Mail looks like afterwards.

If you don’t have your phone linked to Apple’s MobileMe service I’d recommend the Exchange based options that you might have through work (or a BlackBerry Enterprise server) or Microsoft’s hosted Exchange services or Google’s Apps for domains premium services.

PHP script to download files from GMail

Wednesday, December 15th, 2010

While my wife was getting a valuable two hours of sleep before she was woken with contractions signaling the birth of our first born child 19 hours later, I was not quite tired enough to sleep. UnknowingIy missing out on my last chance to sleep for a while, I was typing away at a PHP script to allow us to share pictures of our new baby – whenever he was going to arrive – with our friends and family privately with nothing more complex than the ability to eMail photos from my iPhone.

It was important to us to be able to share these pictures of our new child, but also to protect our child’s image from the very public exposure of the public internet and the still too public (or at least, un-trustable privacy of) Facebook.

Here’s how I was able to achieve this with a web server, some PHP, a GMail account and my iPhone:

Creating Galleries
First off I created a folder with standard Apache Basic Auth settings and let our friends and family know the simple username and password. I also turned on WebDAV access for the geekier viewers. In order to construct interesting galleries I placed a copy of Qdig, a Quick Digital Image Gallery PHP script to create galleries and thumbnails on the fly (and secured it against the WebDAV access). I had to increase the amount of RAM PHP could use, but otherwise it was very easy to implement.

Getting eMail Attachements from GMail with PHP

I created a new GMail account (specifically through my Google Apps domain) to receive all of these cute baby pictures via eMail from my iPhone. The next step was to check it automatically and store the attached pictures in a specific folder.

Building the Baby’s Room

Tuesday, August 3rd, 2010

After a lot of planning, sawing, hammering and a little bit of screwing [up] it is finally ready. I think I had a good plan and I benefited from [grand]dad’s experience.

In the interest of practicing what I teach I modeled two walls worth of wainscotting in the tiny room via Google SketchUp. It helped to both visualize the plan and explain it to Lindsay and my dad. The SketchUp model also helped when it game to dividing space evenly and dealing with the irrational system the is the imperial measuring system.

Nursery3DSC_0012

If anyone else is interested in a simple wainscotting plan, here’s the Google SketchUp plans and the Home Depot suplies:

Full gallery can be found here

Roy Tanck‘s Flickr Widget requires Flash Player 9 or better.

Get this widget at roytanck.com

The raised parts are 3/4″ x 36″ 1/2″ Primed Fiberboard mounted on 1/4″x48″x96″ STD Hardboard. It was cutdown at Home Depot to 1/4″x 37″ x96″ – both to make it a good hight for the room, and to make it fit in the back of my car.

The hardest part, other than all the leveling was the joins. The room is ~126″ x ~111″ – and the STD Hardboard is only 96″ long each wall. There was a liberal use of wood filler to help join the two.

I’ll also get trim for the “chair rail” and quarter round for the bottom, but I didn’t add that to the drawing.