Limiting web browsing on LTSP terminals

Running Linux
cover
Amazon | Powells
IndieBound

With LTSP, all applications run on the server. This is great for the low maintenance involved: install an application program once, and it is available immediately on all terminals.

However, some times you may want to discriminate between different terminals. For example, you may want to restrict web browsing at one terminal or another.

Because the browsers run on the server, all outgoing HTTP connections come from the same machine. This means you cannot just restrict by IP address. You need a finer grain of control, by X display.

There is no easy perfect solution for this problem. The best solution would be to have two different terminal servers, and have the two classes of terminals connect to the appropriate server.

I’ll describe my hack attempt to solve this problem. My approach was to set browser proxy settings based on the X display.

First, you must decide how you want to limit the browser. In my case, I created two browser proxy configure scripts, which are usable by Netscape, Mozilla, Opera, and Internet Explorer browsers.

Script for allowing internet access: “proxy.pac”

function FindProxyForURL(url, host) { if (isPlainHostName(host)

Printing from Open Office through KPrinter


RedHat Linux 9 Bible
cover
Amazon | Powells
IndieBound

To print from Open Office through KPrinter, set up a printer in Open Office for it.

Run spadmin as root. On RedHat 8.0 it is at

/usr/lib/openoffice/spadmin

Add a new printer of type “Generic Printer”. This means simple Postscript output. For the command line specify

kprinter –stdin

Name your printer entry “KPrinter” or something recognizable to you.

Now when you print from Open Office, you can select this printer and be able to make use of KDE features such as the prefilters.

Submitted by amillar on Sat, 2004-02-07 13:35

Printing Greeting Cards in Linux


Linux in a Nutshell
cover
Amazon | Powells
IndieBound

Many people are familiar with the “print your own greeting card” idea. You print four small page images on a single sheet of paper and fold it in half twice. You get a little greeting card with a custom cover and interior, all from one single-sided piece of paper.

I wanted to do this from a Linux application, without needing Windows or MacOS. Preferably, I could use any application to produce 4 pages, and have some magic transform it into the single page with all parts reduced and oriented properly for folding.

After a little googling, I was able to find this list archive message by Ronan Heffernan describing exactly what I wanted. His “make_card” script takes a postscript file and does the appropriate transformation:

#!/bin/shcat $1 | pstops -pletter -b “4:3U@.5(1w,1h)+0U@.5(.5w,1h)+1@.5(0,0)+2@.5(.5w,0)” > $2

This works well, but I wanted something that my family could use from
Linux apps without the command line.

My favorite print spool tool in Linux is KPrinter from KDE 3.0. It can be used with any X Window application, not just KDE apps. It is perfect for the generic X apps like
Mozilla and Acrobat Reader. Instead of sending print output to the command lpr, send it to the command kprinter (or kprinter –stdin if it pipes it).

The method I found is to create a “prefilter” for KPrinter. This
allows you to select greeting card formatting for any print job to
any printer.

Create the following files:

/usr/share/apps/kdeprint/filters/Greeting-card-4-up.desktop

[KDE Print Filter Entry]Comment=Greeting card- 4 pages on double-folded US letterMimeTypeIn=application/postscriptMimeTypeOut=application/postscriptRequire=exec:/ps2ps

/usr/share/apps/kdeprint/filters/Greeting-card-4-up.xml

<!DOCTYPE kprintfilter><kprintfilter name=”Greeting-card-4-up” ><filtercommand data=”pstops -pletter -b ‘4:3U@.5(1w,1h)+0U@.5(.5w,1h)+1@.5(0,0)+2@.5(.5w,0)’ %filterinput %filteroutput” /> <filterinput><filterarg format=”%in” name=”file” /> <filterarg format=”” name=”pipe” /> </filterinput> <filteroutput><filterarg format=”> %out” name=”file” /> <filterarg format=”” name=”pipe” /></filteroutput></kprintfilter>

I found that the KDE prefilters were not terribly well documented, but I
was able to muddle through it. To create one, run KPrinter and select
“System Options”. In the print configuration dialog box, select “Commands”.
This will allow you to create a new filter. You simply need to compare the
entries to other existing print filters.

When your new filter is created, it will be in your personal directory, such as

$HOME/.kde/share/apps/kdeprint/filters/

Move it to your system-wide print filter directory, which might be

/usr/share/apps/kdeprint/filters/

or something similar.

I could not get the paper size to work automatically using the poorly-documented
paper size substitution variable, so I had to hard-code the US Letter paper
size. If anyone knows how to fix this, let me know.

Submitted by amillar on Sat, 2004-02-07 13:35

Latina Pro Populo


Latina Pro Populo
cover
Amazon | Powells
IndieBound

Latina Pro Populo, also titled Latin For People, is a good introduction to the Latin language.

It covers basic Latin grammar and vocabulary. While Latin is known (deservedly so) as a complex language, this book does a good job of providing the basics, allowing the reader to actually read and comprehend simple Latin sentences in just a short amount of time.

Anyone who is simply curious about Latin, without the desire to spend years of study just to read a sentence or two, would find this book to be a great starting place.

Submitted by amillar on Mon, 2004-02-02 11:39

Bad X Server

I have an old laptop being used as an LTSP X Terminal. I have found that the X server software for this laptop is buggy. Somehow Mozilla exposes a bug that locks up the terminal.

Here is what I sent to the LTSP mailing list:

I have ltsp_core-3.0.7-0, ltsp_kernel-3.0.5-0, ltsp_x_core-3.0.4-0, and ltsp_x336_svga-3.0.0-0 on RedHat 8.0 I have one laptop running as an LTSP terminal using the ltsp-wireless package. It is a Toshiba Satellite 110CT with a Chips&Technology 65548 video chip and 24MB RAM. It uses the “chips” driver in XFree86 v4 and the SVGA driver in XFree86 v3. The X server seems to be buggy for this machine. If I display a page in Mozilla containing PNG images, such as http://www.bolis.com/amillar/pg/rdamh/radio-amateur-handbook.html the X server will chew up all its memory and in about 30 seconds, lock up the terminal. Ctrl-Alt-Bksp won’t kill it. The hardware has to be reset. This is in a standard LTSP setup with Mozilla running on the server; no local apps running on the terminal. It seems some X operation initiated by Mozilla is enough to trigger this problem. By putting the terminal in run level 3 and starting X on another VT, I could verify that the memory is being consumed like there is a memory leak. I tried adding swap space, first by NFS swap and then by local IDE swap. It still eats up the memory including the swap space; it just takes longer (60 seconds) to freeze up. This only happens on this one terminal; my other terminals can view the same things without any problems like this. I tried an experiment with the “Xnest” program, creating a new X server window and displaying Mozilla in it. In this situation, the problem does not occur! This reinforces my suspicion that there is a bug in the Chips X Server and Xnest is masking it through its virtualization of the display. Unfortunately Xnest isn’t a good solution because it is not resizable, needs a second window manager, and has some keyboard quirks. I tried copying Xnest from my server as a local app, but it wouldn’t run on the terminal because it complained about incompatible GLIBC versions. Even if that did work, I’m not sure if I could get it to initiate the XDMCP request. Replacing it with another laptop using a different X server is obvious, but I’m trying to make do with what I have. My next thought is to run vncviewer as a terminal local app connecting to an xinetd-launched vncserver, but that sounds like a nasty hack I’d rather avoid. Any thoughts or advice? Thanks

Unfortunately nobody had a solution.

What I did to solve it was to run vncviewer locally on the terminal, and set up vncserver on the terminal server to launch from xinetd. So the terminal is really only running vncviewer in full-screen mode, and the X server is really the vncserver running on the LTSP server machine. This solved it.

Submitted by amillar on Sun, 2004-02-01 21:01