20th Dec 2007

Hacking Firefox at my library: instructions & stuff

I think I’ve done enough tinkering and tweaking with the Firefox hacking that I think I can share the instructions with the world. This post is on the long side, because I tried to make the instructions as clear as possible without too much tech speak, and without drowning you in too much minutia, while actually giving you proper instructions. Enjoy!

Now, you will need more than basic computer poking skills to make this work, and I must say, these instructions may not be *perfect* (for sooth, I’m basically trying to clean up my notes without having to rewrite everything). There are files to download and copy into places (userChrome.css and mozilla.cfg), and there are links to those files in the instructions. Make sure you get this working exactly how you want it before you try it on any other machines. Trust me, you don’t want to get to machine 4 and realize that you need to correct something big (I’ve *totally* been there ;D). If you have questions, post comments here, and I’ll do what I can. :)

Quick computer configuration context notes:

  • We have 4 “kiosk” machines right in front of the Information Desk, meant for catalog and quick internet stuff. Patrons only have access to a browser, readers for Adobe, Word, Excel, and Powerpoint, My Documents, Recycle Bin, basic Accessories, and Windows XP Accessibility tools.
  • The Reference room has 4 computers, and the Computer Lab has 6 computers. These computers are more “normal,” with the full Office Pro suite, FTP and web editing freeware, IM clients (Yahoo!, MSN, and AIM), Picasa, browsers and more.
  • All public computers have Deep Freeze Enterprise (which requires unfreezeing/refreezing the computer for the changes to take), Firefox installed.

Now, for the actual instructions…

Step 1: Install basic plug-ins
Go to: https://addons.mozilla.org/en-US/firefox/browse/type:7

Install basic plug-ins for:

  • Acrobat Reader (WITHOUT Adobe Photoshop® Album Starter Edition): This one takes the longest, and requires that Firefox is open when it starts, so do this one first.
  • Flash & Shockwave: both of these require Firefox to be closed, but are fairly quick, so do them second. This will insure that all the crazy web games for kids will work. Do a check by going to the test page on the Adobe site and making sure that the little animations actually work. If the Flash animation isn’t going, click on the puzzle piece to install it. If the Shockwave animation isn’t working, click on the puzzle piece to get to the download of the manual install.

All our machines have Java, Quicktime Alternative, and Real Alternative installed, so we don’t need those plug-ins, but you may need them if you opt for the originals (the latter two are just as well at the real ones, without all the nagware madness and update/app mail notice freakishness).

And, well, Windows XP comes with Windows Media Player.

Step 2: Install & Configure Add-ons
ALL MACHINES:
CuteMenus2
: Iconifies your menus, making them very visual.

REFERENCE KIOSKS ONLY:
Auto Reset Browser: Closes all the windows and open a new browser window after a specified time of inactivity. To change settings go to the Extension Manager (after you restart the browser), click Options (I set the refresh to 600 sec = 10mins).

Step 3: Other Firefox bits to configure

  1. Type about:config into the Firefox address bar (where you would normally type a URL). Type browser.sessionstore.enabled in the bar at the top of the page (not the address bar, but a blank field in the page), and double-click on it to set it to false. Do the same with browser.sessionstore.resume_from_crash. This should keep the browser from spewing a session restore dialog when the machine is restarted (I think this is why Auto Reset Browser tells you to disable Session Restore on the addon page). You can read more about what you can do with about:config file by checking out the knowledge base page on mozillaZine.
  2. Go to View >> Toolbars and uncheck Bookmarks Toolbar to turn that off.
  3. Tools >> Options menu fun (the caps indicate the tab within the options dialog box):
    • MAIN: Save files to My Documents.
    • TABS: New pages should be opened in a new window, to help people who might be confused by opening pages in new tabs.
    • TABS: Uncheck Warn me when closing multiple tabs.
    • CONTENT: Uncheck Block pop-up windows (because some sites require pop-ups, and it’s easier to leave them on than to confuse the user).
    • CONTENT: Click on the Manage… button under File Types. Search Adobe Acrobat, click on Change Action… to set to Open them with the default application (no more .pdf printing confusion from opening within the browser).
    • PRIVACY: Uncheck everything in the History section.
    • PRIVACY: Check everything in the Private Data section and in the Settings button window.
    • SECURITY: Uncheck Remember passwords for sites.

Step 4: Icons
Startup folder: Copy & paste Firefox icon, rename it Internet, delete the Public Web Browser icon. That way, Firefox will open on startup. The home page for the browsers is a web-based “button” interface to help people get around from within the library, because they like the button thing (but it’s not as crazy restrictive as, say, WinU or something like that).

Step 5: Hiding menu stuff
If you want more details on the stuff you can edit using the userChrome.css file, check out the Chrome element names and IDs page on on mozillaZine, as well as this discussion thread on Addons Mirror.

  • Copy userChrome.css (right-click/Ctrl-click to Save as… or drag and drop somewhere) to C:\Documents and Settings\public\Application Data\Mozilla\Firefox\Profiles\xxx.default\chrome (this will only make the change to the “public” user, in this case. You would need to copy this file to each user that you want to affect).
  • The userChrome.css file has code in it to hide specific whole menus and specific menu options, including Option and Add-ons. This is why all that other stuff needs to be done first. However, if you ever need to see these menus, the quick and easy way is to:
    1. Open the userChrome.css file
    2. Comment out (/* at the beginning of the line, */ at the end of the line) the
      • menuitem[label="Options..."], and/or the
      • menuitem[label="Add-ons"],

      lines (respectively, including the comma at the end).

    3. Save the file.
    4. Restart Firefox, and the menus will appear, so you can make your changes. When you’re done, uncomment the lines (delete the /* at the beginning of the line and */ at the end of the line), and save the file. You will need to restart Firefox logged in as the “public” user, in this case, to see the changes.

Here’s a composite image of all the menus in Firefox (click on the image for a larger view). CuteMenus2 makes them nice and visual, which actually helps people a lot.

Hacking Firefox: menu customizations

This is what the full window looks like, with our library start page loaded up.

Hacking Firefox: Full window view

Step 6: Locking down Firefox
Many, many thanks to silentk::cbx3 for his awesome posts — “Security Firefox for schools usage” part 1 and part 2 — for helping me figure this part out! For details on how this works, check out those posts.

The mozilla.cfg file contains stuff you really, really want to lock down. But why do we need this if we did all that other stuff with the options and hiding the menus and whatever? Using the mozilla.cfg file will make it so that even if they figure out how to unhide the menus from Step 5, they can’t actually change anything.

Let’s look at a quick example. You could prevent users from installing more plugins by editing the about:config file (see Step 3, above). However, if you do it that way, the next time the user tries to install a plugin, the browser will show a super-helpful message explaining that the option is disabled, and it will give the user a friendly button to press to re-enable the setting. That’s suboptimal, at best. So, consider this step insurance, especially against those super-industrious nosey users.

There are three parts to this step. Part one is to create a text file which contains the code that locks down specific items. Part two is to do something called byteshifting, so that Firefox can actually read the instructions you set in the text file. While “Security Firefox for schools usage - Part II” notes that byteshifting is unnecessary, the file didn’t work for me on Windows XP without that step. Part three is to tell the browser where to look for the instructions, so it’ll actually do what you tell it to.

Now, in an effort not to give away all of our hacky secrets to, say, the super-industrious Reading patrons ;D, you can download a modified version of our mozilla.cgf file (right click/Ctrl-click the link and Save as…, or drag the link somewhere to save), already byteshifted. Opening the file will just read as garbeldy gook, because it’s all in Mozilla’s crazy moon language. This mozilla.cfg file locks the following settings:

  • Start Page is whatever you set it as in the Firefox Options
  • Browser cache limited at 50mb
  • Disables automatic updates to the browser (So that it won’t harass the user with constant update notices. The Windows permissions on our computers don’t allow for users to install new programs, and with Deep Freeze installed, the updates wouldn’t take, anyway.)
  • Javascript and Java enabled
  • Downloads go to the last folder chosen to save downloads (will default to the folder set in the Options)
  • Keeps users from installing plugins, for serious.

If this satisfies all your wants and desires, then you can skip the next two paragraphs and follow the all.js file instructions that follow.Alternately, if you want to get all sorts of custom with yo bad self, you can check out the very detailed notes in the “Security Firefox for schools usage - Part II” post to make your very own file. If you’ve already gone through all the steps listed here, the bits you’ll need will depend on your library’s configuration. If you want help figuring it out, take a look at that post first and give it a shot, then post questions here as a comment (I can’t make custom files for people, but I can help you figure it out).

Once you have your mozilla.txt file all set, save it in a safe place, just in case you want to change it later. Now, you need to byteshift the file to convert it to a mozilla.cfg file, so that Firefox can actually read and execute your instructions. You can do this by going to the Upload mozilla.txt to get mozilla.cfg (byteshift 13) section of the Automatic Mozilla Configurator home page (about midway down). You will now have a nifty new mozilla.cfg file, which you should copy into the C:\Program Files\Mozilla Firefox\ folder.

Now you need to tell your browser how to find your new instructions.

  1. Make sure that Firefox is CLOSED.
  2. Open the C:\Program Files\Mozilla Firefox\greprefs\all.js in Notepad (double-clicking on this file will likely give you a Javascript error, so be sure to open it from Notepad, and have Notepad show you all file formats instead of just .txt files, then you’ll see it).
  3. Comment out thepref(”general.config.obscure_value”, 13); // for MCD .cfg filesline, so that it ends up looking like//pref(”general.config.obscure_value”, 13); // for MCD .cfg files
  4. Copy this line just below the line from step 2 above pref(”general.config.filename”, “mozilla.cfg”);so that the resulting code looks like this//pref(”general.config.obscure_value”, 13); // for MCD .cfg files
    pref(”general.config.filename”, “mozilla.cfg”);
  5. Save the all.js file and close it.

Easy way to manipulate plug-ins after you install the mozilla.cfg: Comment out the pref(”general.config.filename”, “mozilla.cfg”); line (by adding the // at the beginning of the line), then save. When you’re done, uncomment the line (by deleting the // at the beginning of the line) and save.

If at any point you want to alter the instructions in the mozilla.cfg file, you must make the changes in the mozilla.txt file, then byteshift it, then paste it over the existing file. It’s a lot of steps, so make sure you have what you want before you make it final.

Step 7: Other housekeeping – to do when testing

  • Open Adobe Reader application once, and be sure to check the box that tells Adobe not to show that big screen when it opens.
  • Check Firefox to make sure it works.

So yeah, that’s the long and long of it. Remember that you can play with just parts of these instructions to, say, customize your copy of Firefox on your home computer, or make a snazzy custom browser at work.

Just a note, I’ll be out of town starting Sunday, back on the web officially Tuesday, and I’ll do what I can about answering questions in between. Happy Merry to you all!

Posted in Uncategorized | 8 Comments »

08th Nov 2007

Hacking Firefox: customizations for my library (NaBloPoMo #8)

Today was quite the intellectual roller coaster ride, filled with moments of extreme brilliance and achievement, countered by moments of nose-down thinking, researching, problem solving, and bug fixing.

My mission: to rid our library of Public Web Browser, and replace it with a Firefox install that does exactly what I want it to. The ride actually started last Thursday morning; my library is open on Thursdays from 1-9p, but I’m there in the morning, which makes for excellent Do Stuff With Computers time.

Last week, I did some poking around, forming a plan. We have a few different flavors of computer configurations (all running Windows XP Professional SP2), but the general gist is that we have 4 “kiosk” machines, designed for web browsing with readers for Word, Excel, Powerpoint, and Acrobat Reader to aid in opening and printing attachments. Then we have the more full-scale workstations including Office 2003 Professional, web page and FTP software, various IM clients, Picasa, and a few other bits of software.

My priority with the computer configurations to create as normal a computing environment as possible, so that there is no “library way” versus “home way” or “office way” to do things. Locking too many things down, or creating too many dummy button systems for access really just confuses people, and makes teaching people how to use the technology ineffective.

That said, my dream install of Firefox would:

  • Remove the full Bookmarks menu, as well as any menu items that referred to bookmarking, sending links via email, add-on and options management.
  • Automatically refresh the browser every 10 minutes to bring it back to the library home page.
  • Not allow users to install plug-ins.
  • Show the user that, yes, your private information is being deleted, for serious.
  • Anything that might make the user interface easier to work with.

Not a huge shopping list. I figured I could a good amount of the work with plug-ins, and I knew a Firefox plug-in for kiosk mode did exist. But in evaluating the R-kiosk extension as a solution, I found it entirely too limiting in its default setting, and not flexible enough in the alterable settings for what I wanted. After poking around a bit more, it looked like the solution was to use a combination of plug-ins and straight-out hacks.

I settled on the following plug-ins:

  • Cutemenus2: Adds sassy little icons to the standard and context menus in Firefox, to give visual cues on what each command stands for. It’s a great help for inexperienced users, and it’s quick visual reference for get-in/get-out patrons.
  • Auto Reset Browser: Refreshes the browser after a period of inactivity. I configure it to refresh after 600 seconds (10 minutes).

Then there was the issue of menu customizing. At first, I thought I’d go with the Menu Editor extension, which is really easy to use. However, if I wanted to hide the ability to access the Add-Ons management utility from regular users, and I hid it using the extension, then I wouldn’t be able to get back to it, ever (funny thing, after talking it through to myself out loud, I had to try it to see if I was right, and I was, resulting in uninstalling and reinstalling Firefox to fix it).

My solution: userChrome.css. Believe it or not, much of the menu rendering and other features in Firefox are controlled by a style sheet. I used the elements & IDs page in the MozillaZine wiki and these instructions to help me figure out the best way to format and customize my Firefox style sheet, and it worked like a dream. This way, reactivating a menu that has been hidden is as easy as commenting out the “don’t show me” command in the style sheet and restarting the browser.

The tough bit was locking everything down so it couldn’t be changed browser-side. We have Deep Freeze Enterprise installed on all of the computers, so worst case we can just restart the machine to take it back to it’s original configuration. However, my greater concern is the consistency of the user experience: what if someone installs a plug-in or extension that confuses the patron using the machine after them? What if it creates a user expectation of a behavior at another machine?

Now, I could use about:config, which allows you to edit all sorts of features in Firefox (type about:config, just like that, into the address bar in Firefox, and you’ll see what I mean), but disabling something in the about:config doesn’t lock it down. For instance, I set extension installs to “disabled,” and instead of a blocking message when I tried to install a plug-in, I got a friendly, helpful message telling me that I needed to enable the feature, as well as a handy enable button.

Not what I was looking for. I needed something stricter, firmer, with a clear neon NO! on it, but, you know, polite and diplomatic.

More nose to the grindstone research later, I came up with a series of handy posts from a fellow in the UK who was locking down Firefox for schools. It’s kinda geeky, and requires playing with code, but the instructions he followed are fairly easy to understand (especially if you read them carefully, out loud if you need to), and the stuff he did with it also makes sense for what most libraries would want to do. The lockPref("xpinstall.enabled", false); bit was the pay dirt of this exercise, but I was able to lock down a bunch of other stuff so that, just in case someone actually accessed the Options box, they wouldn’t be able to edit it.

By the end of the day, I had the 4 kiosk machines working almost like I wanted them to. I’m still researching a way to have the Firefox window pop back open as a fresh browser just on those kiosk machines; tomorrow is another day ;).  I’ll get to all the other machines in the library over the course of the next week, now that I have the process down to 2 plug-in installs, 2 file copy/pastes, and a small text change in another file, totally perhaps 5 minutes per machine.

Shiny!

So what took all day? I didn’t check email all day, and I really didn’t even touch my desk, so where did all the time go? Well, there was updating the Firefox install on the machines, removing the dreaded Public Web Browser (explaining that is a whole other post entirely), letting people play with it, tweaking it, and just a whole lot of trial and error. And, say, breaks for lunch and snacks, and other work conversations and sundries.

I’ll post some screen shots tomorrow, but in the meantime, questions/comments are welcome!

Posted in Uncategorized | 8 Comments »

Bad Behavior has blocked 447 access attempts in the last 7 days.