Kiosk tutorial for public consumption

Discussion of general topics about Mozilla Firefox
Post Reply
cbaechle
Posts: 10
Joined: January 19th, 2007, 6:27 am

Kiosk tutorial for public consumption

Post by cbaechle »

I've been working on a kiosk and taking notes along the way. None of the kiosk extensions out there do 100% of what I'd consider using on a real kiosk. It's an extremely rough draft. If anyone is interested hosting a single page for this tutorial I'll clean it up and turn it into something formal. Here ya go...

---- Creating a kiosk w/ debian and firefox ----

Install debian testing

During install:

Use a static ip address so you can do remote administration tasks.

Create a user named "kiosk".

Choose to install "Standard System". Uncheck "Desktop Environment". "Desktop Environment" will install a lot of things you don't need and you'll spend more time removing them than installing the bare essentials.

System should eventually reboot.

Logged in to system as root:

Add in your /etc/apt/sources.list
deb http://www.debian-multimedia.org etch main

and add "non-free" to the end of the lines that say "etch main".

# apt-get update
# apt-get upgrade
# apt-get install g++
# apt-get install openssh-server
# apt-get intsall xorg
# apt-get install xorg-dev
# apt-get install gsfonts-x11
# apt-get install lesstif2-dev
# apt-get install libpaper-dev
# apt-get install libt1-dev
# apt-get install xprintidle
# apt-get install fluxbox
# apt-get install iceweasel
# apt-get install mozplugger
# apt-get install mozilla-mplayer
# apt-get install mingetty
# apt-get install squid



edit /etc/squid/squid.conf. Find the line that says INSERT YOUR OWN RULES HERE.... Insert text after that

acl open_domains dstdomain "/etc/squid/open_domains.txt"
http_access allow open_domains

Comment out the line that says http_access allow localhost. Find the line that says http_port and change it from 3128 to 127.0.0.1:3128 (this will make sure it's just listening on loopback and no one can even see the port open).

You can now edit /etc/squid/open_domains.txt and add domains in squid style dstdomain rules. Basically, domain.com will add just that domain and .domain.com will add domain.com and all subdomains. /etc/init.d/squid/reload when you want to apply these changes.

If you would like to customize your squid error pages (I suggest you do as it gives the kiosk a more uniform feel) they are located in /usr/share/squid/errors.

You should install an optimized kernel for your system at this point. It's not necessary, but if you know how then do this now.

Reboot.

Logged in as kiosk user:

edit .xinitrc and add the line
exec fluxbox

$ startx

Open an xterm.

$ iceweasel -ProfileManager

Click "Create Profile" button. Click "next". Name the profile kiosk and click "finish". Click "exit".

Open firefox and go to http://www.krickelkrackel.de/autohide/ and install the autohide extension. AFAIK this is the only way to start firefox in fullscreen mode. Does anyone know if this is going to change in future releases or another way to do it? There really needs to be a way to start firefox automatically in F11 fullscreen mode without an extension. Close firefox.

edit /home/kiosk/.mozilla/firefox/*kiosk*/prefs.js and add
user_pref("signon.rememberSignons",false);
user_pref("browser.link.open_newwindow",1);
user_pref("browser.sessionstore.resume_from_crash",false);
user_pref("browser.formfill.enable",false);
user_pref("browser.link.open_newwindow",1);
user_pref("browser.link.open_newwindow.restriction",0);
user_pref("plugin.default_plugin_disabled",false);
user_pref("browser.popups.showPopupBlocker", false);
user_pref("privacy.popups.firstTime",false);
user_pref("privacy.popups.showBrowserMessage",false);
user_pref("xpinstall.enabled",false);

edit /home/kiosk/.xmodmap and add
keycode 0x09 = 0x0000
keycode 0x43 = 0x0000
keycode 0x44 = 0x0000
keycode 0x45 = 0x0000
keycode 0x46 = 0x0000
keycode 0x47 = 0x0000
keycode 0x48 = 0x0000
keycode 0x49 = 0x0000
keycode 0x4A = 0x0000
keycode 0x4B = 0x0000
keycode 0x4C = 0x0000
keycode 0x5F = 0x0000
keycode 0x60 = 0x0000
keycode 0x6F = 0x0000
keycode 0x4E = 0x0000
keycode 0x6E = 0x0000
keycode 0x31 = 0x0000
keycode 0x6A = 0x0000
keycode 0x61 = 0x0000
keycode 0x63 = 0x0000
keycode 0x4D = 0x0000
keycode 0x70 = 0x0000
keycode 0x3F = 0x0000
keycode 0x52 = 0x0000
keycode 0x17 = 0x0000
keycode 0x22 = 0x0000
keycode 0x23 = 0x0000
keycode 0x6B = 0x0000
keycode 0x67 = 0x0000
keycode 0x69 = 0x0000
keycode 0x4F = 0x0000
keycode 0x50 = 0x0000
keycode 0x51 = 0x0000
keycode 0x56 = 0x0000
keycode 0x42 = 0x0000
keycode 0x53 = 0x0000
keycode 0x54 = 0x0000
keycode 0x55 = 0x0000
keycode 0x57 = 0x0000
keycode 0x58 = 0x0000
keycode 0x59 = 0x0000
keycode 0x6C = 0x0000
keycode 0x25 = 0x0000
keycode 0x40 = 0x0000
keycode 0x40 = 0x0000
keycode 0x71 = 0x0000
keycode 0x6D = 0x0000
keycode 0x5A = 0x0000
keycode 0x5B = 0x0000
keycode 0x73 = 0x0000
keycode 0x74 = 0x0000
keycode 0x75 = 0x0000

This will create a keymap for X disabling a lot of keys. This is for if you if you don't have a specialized kiosk keyboard. This is for a 104 key keyboard. If you have something else, research the required keycodes and add them to .xmodmap. 0-9 a-z = - \ return , . / shift Up Down Left Right space ; ' should still remain.

Xpdf support
Download the xpdf sources at http://www.foolabs.com/xpdf/download.html then extract them (I used version 3.01). You'll also need a patch available at http://freetype.fis.uniroma2.it/freetyp ... nals.patch. Untar and uncompress xpdf and edit xpdf/XPDFViewer.cc. Find all instances of printBtn and quitBtn and remove the entire line. If printBtn/quitBtn are an argument to a function delete that whole function call. Use your judgement.
$ patch -Np1 </xpdf> preferences -> Advanced -> Network -> Connection Settings. Click "Manual proxy configuration" and set the proxy to 127.0.0.1 port 3128. Click "Use proxy server for all protocols" and click "ok". Go to the "Content" tab. Next to "Enable javascript" click the "Advanced" tab. Uncheck all the boxes. Click "ok". Click the privacy tab. We are going to want to set this as private as possible. Uncheck "Remember visited pages...", "Remember what I enter in forms...", "Remember what I've downloaded". Change cookies to keep until I close firefox. Check "Always clear my private data when I close firefox", and uncheck "Ask me before clearing private data". Click the "settings" box and check all the boxes and click "ok". In the "Security" tab click the "Settings" button and uncheck all warnings and press ok. It is up to you as the kiosk administrator to ensure all the pages available are safe. Uncheck "Warn me when sites try to install add-ons". Also, you may want to download your landing page and/or set your default homepage as it will be difficult to later. Save all the changes and close firefox/iceweasel.

In xterm
$ cd /home/kiosk/.mozilla/firefox/*kiosk*/chrome
$ cp userChrome-example.css userChrome.css
$ cp userContent-example.css userContent.css

Edit userChrome.css and add
#search-container {
display: none;
}

#window-controls {
display: none;
}

Edit userContent.css and add

@-moz-document url-prefix(about:) {* {display: none;}}
@-moz-document url-prefix(file:) {* {display: none;}}

Edit as root /usr/lib/iceweasel/components/nsHelperAppDlg.js. Change:
show: function(aLauncher, aContext, aReason) {
to
show: function(aLauncher, aContext, aReason) { return;

This will make the helper app dialog return immediately and do nothing.

Edit as root /usr/lib/iceweasel/chrome/browser/content/browser/browser.js. Change:
function handleLinkClick(event, href, linkNode)
{
to
function handleLinkClick(event, href, linkNode)
{ return true;

and

onFeedButtonClick: function(event) {
event.stopPropagation();
to
onFeedButtonClick: function(event) {
event.stopPropagation();
return false;

and

case "xpinstall-install-blocked":
to
case "xpinstall-install-blocked-DISABLED":


This will disallow shift+click, ctrl+click, and whatever else button+click you can think of; the second will disable adding rss feeds; the third disables the warning that installing add-ons is disabled.


Edit as root /usr/lib/iceweasel/chrome/toolkit/content/global/printdialog.js and /usr/lib/iceweasel/chrome/toolkit/content/global/console.js
Add window.close(); to the very top of the files. This will disable the printing dialog and also disable the javascript debugging console that may popup sometimes.


Edit /home/kiosk/.xinitrc. Remove "exec fluxbox" and replace it with "exec iceweasel -fullscreen".

Edit /home/kiosk/.bash_profile. At the end of the file add
while [ 1 ]
do
startx
done
exit

As root edit /etc/inittab and change
2:23:respawn/sbin/getty 38400 tty2
to
2:23:respawn/sbin/mingetty --autologin kiosk tty2

Edit /etc/X11/xorg.conf and add in InputDevice section (to enable only left mouse button)
Option "ButtonMapping" "1 1 1"

Edit /etc/X11/xorg.conf and add in the ServerLayout section (to disable screen blanking):

Option "BlankTime" "0"
Option "StandbyTime" "0"
Option "SuspendTime" "0"
Option "OffTime" "0"

You may also want to get rid of the grub menu and boot automatically. Edit /boot/grub/menu.lst and change the timeout to 0.

Get rid of pluginreg.dat so any mozplugger changes can take effect
rm /home/kiosk/.mozilla/firefox/pluginreg.dat

Reboot. When you are rebooting you may also want to password protect your bios. Your system should boot right into firefox straight to your homepage with no intervention.

If everything is 100% the way you want it, enable the /home/kiosk/.xmodmap you created earlier.
Edit /home/kiosk/.xinitrc and before exec iceweasel -fullscreen enter
xmodmap /home/kiosk/.xmodmap

Reboot. This should be your final locked-down kiosk. If you need to change anything after this, ssh in.

---- End ----

The one last feature I would like to add is a script to kill X after 5 minutes of idle so it'll return to the home page; but only to kill it if there's been recent activity (so it won't constantly kill X). It'll be simple, I just haven't gotten to it yet.

Let me know if there's interest in someone hosting this as a single page and I'll clean it up and implement the "home page after idle" feature too.
cbaechle
Posts: 10
Joined: January 19th, 2007, 6:27 am

Post by cbaechle »

Then

Open firefox/iceweasel (you can just open an xterm and type iceweasel). Edit -> preferences -> Advanced -> Network -> Connection Settings. Click "Manual proxy configuration" and set the proxy to 127.0.0.1 port 3128. Click "Use proxy server for all protocols" and click "ok". Go to the "Content" tab. Next to "Enable javascript" click the "Advanced" tab. Uncheck all the boxes. Click "ok". Click the privacy tab. We are going to want to set this as private as possible. Uncheck "Remember visited pages...", "Remember what I enter in forms...", "Remember what I've downloaded". Change cookies to keep until I close firefox. Check "Always clear my private data when I close firefox", and uncheck "Ask me before clearing private data". Click the "settings" box and check all the boxes and click "ok". In the "Security" tab click the "Settings" button and uncheck all warnings and press ok. It is up to you as the kiosk administrator to ensure all the pages available are safe. Uncheck "Warn me when sites try to install add-ons". Also, you may want to download your landing page and/or set your default homepage as it will be difficult to later. Save all the changes and close firefox/iceweasel.
cbaechle
Posts: 10
Joined: January 19th, 2007, 6:27 am

Post by cbaechle »

It won't let me post how to compile xpdf....
old FatJohn
Posts: 0
Joined: December 31st, 1969, 5:00 pm

Post by old FatJohn »

On your right hand menu there's a link to the knowledge base. I guess that's where you could put this stuff. You'll need to register with it however. Give the article name some thought as this is a very specific writeup.
cbaechle
Posts: 10
Joined: January 19th, 2007, 6:27 am

Post by cbaechle »

Thanks. I'll do that. The formatting got somewhat screwed up on here so it'll probably be more effective on the KB.
Post Reply