Search Results: "tca"

21 January 2007

Jan Wagner: Music and Debian

Today I found a way to combine consuming my favorite Radio Station and using my favorite System Distribution.

On working hours and most of the time at home I’m listening to Frisky Radio, founded by Faisal Sultan. But I’m missing it the 3 hours per day, when I’m traveling between work and home town. I did realize, Frisky Radios provides podcasts, but only one per week and the download history isn’t such long. Some days later, I thought stream ripping could be nice. So I did run:
$ apt-cache search stream ripper
goobox - CD player and ripper for GNOME
kstreamripper - kde frontend for streamripper
streamripper - download online streams into audio files
tunapie - Lists audio and video streams from Shoutcast and Icecast
My decision was to use streamripper in combination with screen.
Streamripper can provide a relay server, where you can listen to and save bandwidth and decide, what should happen with already existing tracks. This all seems very nice and I’ll see how lovely it will work together with my player, which name I will not mention in this context. ,

19 January 2007

Enrico Zini: tagminer

Cute things one could do with debtags While answering to a long message in the debtags-devel mailing list I accidentally put together the pieces of a fun idea. This is the bit of message I was answering:
  • It would be very useful if the means for indicating the supported
    data formats was more comprehensive. This could mean a lot of
    expanding in the "works-with-format" section of the vocabulary, which
    doesn't even include formats such as gif or mpg at the moment. I don't
    know how feasible it is to alter underlying debtags functionality, but
    perhaps it would be the easiest to make "works-with-format" a special
    case tag which allows for formats not listed in the vocabulary.
This is my answer:
Good point. The idea has popped up in the past to list supported mime types among the package metadata, so that one could point to a file and get a list of all the packages that can work with it. I'm not sure it's a good idea to encode mime types in debtags and I'd like to see something ad-hoc for it. In the meantime works-with-format is the best we can do, but we should limit it to the most common formats.
This is the fun idea: if works-with-format is the best we can do, what can we do with it? Earlier today I worked on resurrecting some old code of mine to expand Zack's ls2rss with Dublin Core metadata extracted from the files. The mime type scanner was ready for action. Some imports:
import sys
# Requires python-extractor, python-magic, python-apt
# and an unreleased python-debtags from http://bzr.debian.org/bzr/pkg-python-debian/trunk/
import extractor
import magic
from debian_bundle import debtags
import re
from optparse import OptionParser
import apt
A tenative mapping between mime types and debtags tags:
mime_map = (
        ( r'text/html\b', ("works-with::text","works-with-format::html") ),
        ( r'text/plain\b', ("works-with::text","works-with-format::plaintext") ),
        ( r'text/troff\b', ("works-with::text", "works-with-format::man") ),
        ( r'image/', ("works-with::image",) ),
        ( r'image/jpeg\b', ("works-with::image:raster","works-with-format::jpg") ),
        ( r'image/png\b', ("works-with::image:raster","works-with-format::png") ),
        ( r'application/pdf\b', ("works-with::text","works-with-format::pdf")),
        ( r'application/postscript\b', ("works-with::text","works-with-format::postscript")),
        ( r'application/x-iso9660\b', ('works-with-format::iso9660',)),
        ( r'application/zip\b', ('works-with::archive', 'works-with-format::zip')),
        ( r'application/x-tar\b', ('works-with::archive', 'works-with-format::tar')),
        ( r'audio/', ("works-with::audio",) ),
        ( r'audio/mpeg\b', ("works-with-format::mp3",) ),
        ( r'audio/x-wav\b', ("works-with-format::wav",) ),
        ( r'message/rfc822\b', ("works-with::mail",) ),
        ( r'video/', ("works-with::video",)),
        ( r'application/x-debian-package\b', ("works-with::software:package",)),
        ( r'application/vnd.oasis.opendocument.text\b', ("works-with::text",)),
        ( r'application/vnd.oasis.opendocument.graphics\b', ("works-with::image:vector",)),
        ( r'application/vnd.oasis.opendocument.spreadsheet\b', ("works-with::spreadsheet",)),
        ( r'application/vnd.sun.xml.base\b', ("works-with::db",)),
        ( r'application/rtf\b', ("works-with::text",)),
        ( r'application/x-dbm\b', ("works-with::db",)),
)
Code that does its best to extract a mime type:
extractor = extractor.Extractor()
magic = magic.open(magic.MAGIC_MIME)
magic.load()
def mimetype(fname):
    keys = extractor.extract(fname)
    xkeys =  
    for k, v in keys:
        if xkeys.has_key(k):
            xkeys[k].append(v)
        else:
            xkeys[k] = [v]
    namemagic =  magic.file(fname)
    contentmagic = magic.buffer(file(fname, "r").read(4096))
    return xkeys.has_key("mimetype") and xkeys['mimetype'][0] or contentmagic or namemagic
Command line parser:
parser = OptionParser(usage="usage: %prog [options] filename",
        version="%prog "+ VERSION,
        description="search Debian packages that can handle a given file")
parser.add_option("--tagdb", default="/var/lib/debtags/package-tags", help="Tag database to use (default: %default)")
parser.add_option("--action", default=None, help="Show the packages that allow the given action on the file (default: %default)")
(options, args) = parser.parse_args()
if len(args) == 0:
    parser.error("Please provide the name of a file to scan")
And here starts the fun: first we load the debtags data:
# Read full database 
fullcoll = debtags.DB()
tagFilter = re.compile(r"^special::.+$ ^.+::TODO$")
fullcoll.read(open(options.tagdb, "r"), lambda x: not tagFilter.match(x))
Then we scan the mime type and look up tags in the mime_map above:
type = mimetype(args[0])
#print >>sys.stderr, "Mime type:", type
found = set()
for match, tags in mime_map:
    match = re.compile(match)
    if match.match(type):
        for t in tags:
            found.add(t)
if len(found) == 0:
    print >>sys.stderr, "Unhandled mime type:", type
else:
If the user only gave the file name, let's show what Debian can do with that file:
    if options.action == None:
        print "Debtags query:", " && ".join(found)
        query = found.copy()
        query.add("role::program")
        subcoll = fullcoll.filterPackagesTags(lambda pt: query.issubset(pt[1]))
        uses = map(lambda x:x[5:], filter(lambda x:x.startswith("use::"), subcoll.iterTags()))
        print "Available actions:", ", ".join(uses)
If the user picked one of the available actions, let's show the packages that do it:
    else:
        aptCache = apt.Cache()
        query = found.copy()
        query.add("role::program")
        query.add("use::"+options.action)
        print "Debtags query:", " && ".join(query)
        subcoll = fullcoll.filterPackagesTags(lambda pt: query.issubset(pt[1]))
        for i in subcoll.iterPackages():
            aptpkg = aptCache[i]
            desc = aptpkg.rawDescription.split("\n")[0]
            print i, "-", desc
\o/ The morale of the story:

18 January 2007

Ross Burton: Dear Interweb...

Quick question for the Interweb regarding bash completion. If I do cat ~/[tab], I get to pick from 182 completions, as it lists all of the dotfiles. Is there a way of telling bash to only complete dot files if I put a dot, otherwise only complete non-hidden files? Answers on a postcard, or if you must, a comment on this blog. Thanks! NP: IBM 1401, a User's Manual, Jóhann Jóhannsson

4 January 2007

MJ Ray: Cycling: Injuries, Death, Roadworks and the Cycle Forum

I used to live in Norfolk, so Norwich Evening News: Was top cyclist killed by driver asleep at the wheel? (Updates: EDP: Death crash trial hears of "most viable explanation" and EDP: Driver guilty of causing cyclist's death ) and Norwich Evening News: Cyclist hit by bus on A47 are rather worrying. Weston super Mare Weston Mercury: Town centre havoc reports that Wales and West Utilities will be digging up Orchard Street followed by Alexandra Parade, Regent Street, Walliscote Road, High Street and Knightstone Road over 16 weeks from 8 January, and also
"Three months worth of work to remove the central reservation and add a filter lane to Herluin Way is also due to start on the same day [...] Uphill Road South in Uphill is closing on January 9 for six weeks as Wessex Water repairs the highway's sewer. [...] Winters Lane in Redhill is shutting for two months while a new sewer is put in."
Pipe works seldom seem to take up the full width of the road and the Herluin Way cycle track only crosses Herluin Way at a few points. Will these roads be kept open for cycling? They should be. All of these seem to be starting just before next week's Cycle Forum (7pm Wednesday 10 January at Worle Campus, press release ). Interesting new year present.

2 January 2007

Evan Prodromou: 11 Niv se CCXV

What a great day it was in the Bay Area today -- just beautiful. It's Rose Bowl weather, of course -- Nature blesses California on the day of the Rose Bowl, just so people in the rest of the USA say, "Damn those Californians and their great weather!" Still, there's something so rejuvenating every year around the 10th-11th of Niv se. I wonder what it is? Oh, and: no, we don't have the Rose Bowl in northern California. It's just one of the few times of year that San Franciscans are happy to share the state with their southern neighbors. tags:

Fruitcake So, there's a comedy tradition around the holidays that marks the crappiest possible gift you can get for Christmas as a fruitcake. This is stupid; fruitcake is delicious. Candied fruit + nuts + cake + rum = hooray for fruitcake. My parents got a couple of fruitcakes for Christmas, and they tasted great. I've been noshing on them a bit at a time all week. Great stuff! Rumtastic. Anyone who says otherwise is full of malarkey. In conclusion, fruitcake is delicious and Carthage must be destroyed. tags:

New Year's Eve Maj, Amita June and I had a hard New Year's Eve. Our friends Earl and Sue have an NYE party in Walnut Creek every year, and a lot of our friends from Pigdog Journal are there every year. We had planned to have a room at the nearby Embassy Suites, and have friends over before the party to see Amita June (who needs to be asleep by New York midnight, i.e. 9PM PST). But Maj is feeling really sick -- flu-y and nauseous -- and we had to cancel this pre-event. Bad feelings about this; we've missed seeing this group of friends a few times since the baby was born, and some of them have never met her. Eventually, we all managed to go to Earl and Sue's party together, then left early so Amita could get to sleep. A pretty good solution all around. I got to see a lot of old friends, including Sam and Shannon who just announced that she's blogging for two now. (Congrats!) Tjames was there with his ladyfriend Robyn, which was really nice. They made out a lot, which makes me pretty happy. We saw Dan, Johnny, Randy, Dave, and of course Earl and Sue themselves. A really good party. tags:

All is quiet I had a pretty mild shom-pan-yah hangover this morning, so we were fully able to go see friends Zach and Wendy in El Cerrito for brunch. We hit delicious Picante off of Gilman Street, which is a massive Mexican restaurant, near the Berkeley Gourmet Ghetto and showing some of the foodie-ism of the weird East Bay scene. I had a really good plate of chilaquiles, and Maj had some huevos rancheros and made a pretty good dent in them -- the first food she's really eaten in a few days. Amita June got a great quesadilla with queso fresco that tasted really good. Then, everyone was ready for a nap, so we said goodbye and cut the visit short by heading back to Los Altos Hills. tags:

Ads on Wikipedia So, there's been quite a dust-up on Wikimedia Foundation lists about their recent fund-raising drive. The WMF is having its annual fundraising drive (and, if you can, please help with a donation), and the Virgin Group's charity organization, Virgin Unite, set up a matching fund a few days ago so that all donations to the WMF were effectively doubled. All fine so far, right? But a small logo in the donations notice -- seen by non-logged-in users on every page of every WMF site -- was considered by many Wikipedians and other WMF editors as dangerously close to the line on advertising -- or over it. There have been several prominent users who have left the project because of it. I'm not sympathetic with these folks; in fact, I'm in solid opposition. I think that Wikipedia's huge amount of Web traffic is a resource that the Foundation is squandering. Traffic like Wikipedia's is worth tens of millions if not hundreds of millions of dollars in ad revenue per year. That's money that could go to disseminate free (libre and gratis) paperback pocket encyclopedias to millions of schools and millions of children, in their own language, around the world. It's irresponsible to abuse that opportunity. Brion Vibber's defense of the logo on the Wikimedia Foundation's mailing list is really interesting and instructive. tags:

21 December 2006

Russell Coker: hybrid Lexus is best luxury car

The Lexus GS 450 hybrid petrol/electric car has been given the award for Australia's best luxury car!

The judging for this contest rated fuel efficiency as low importance, because luxury car owners traditionally aren't very concerned about such things. The Lexus won because of it's quiet engine (can't beat an electric motor at low speed), high performance (3.5L petrol engine that outperforms mode 4L engines because of the electric motor assistance), safety, security, and other factors.

There has been an idea that hybrid cars are only for people who want to protect the environment at all costs. The result of this contest proves that idea to be false. The Lexus won by simply being a better luxury car, the features that benefit the environment also give a smoother and quieter ride and higher performance - which are factors that are very important to that market segment! Also it wasn't even a close contest, the nearest rival achieved an aggregate score of 9% less (a significant difference as there was a mere 2.5% difference in score between the 2nd place and 5th place).

This of course shouldn't be any surprise. The high torque that electric motors can provide at low speed is well known - it's the reason for Diesel-electric hybrid power systems in locomotives. It was only a matter of time before similar technology was introduced for cars for exactly the same reasons. The next development will be hybrid Diesel-electric trucks.

18 December 2006

Biella Coleman: VIVA ZYPREXA!

I am about 2/3 over with my haul from Edmonton to San Juan, PR (laying over in the beautiful JFK) and am too tired to blog anything much of substance but do check out Furious Season’s impassioned and excellent commentary on the recent NYTimes article (and this one )that reveal how Eli Lily knowingly downplayed the risks of Zyprexa. And if you read the second article, you will find out what Viva Zyprexa means. Here is Eli Lily’s press release, which I have included on the next page as these things tend to vanish… Statement from Eli Lilly and Company: Response to The New York Times Article from December 18, 2006 December 18, 2006 INDIANAPOLIS, Dec 18, 2006 /PRNewswire-FirstCall via COMTEX News Network/ — Eli Lilly and Company (NYSE: LLY), vigorously objects to the characterization of company practices in a New York Times article based upon selective documents illegally leaked by plaintiffs’ lawyers. “At Lilly, we do not engage in off-label promotion - as alleged in The Times article,” said Dr. Steven Paul, Lilly’s executive vice president, science and technology. “Lilly is committed to the highest ethical standards and to promoting our medications only for approved uses. We have clear guidelines and extensive training for our sales representatives to help assure that they provide appropriate promotional information that is within the scope of prescribing information approved by the FDA.” Lilly works to bring Zyprexa to physicians who are confronted with the need to diagnose and treat serious schizophrenia and bipolar disorder wherever they practice. * About half of medical care for serious mental illness takes place in a primary care physician’s office. This is due to the fact a large number of people in the United States have no access to a psychiatrist or do not seek psychiatric care. * Our experience in mental health has taught us that primary care physicians are asking for education on severe mental illnesses, since they see many of these patients in their offices. * We believe that it is absolutely appropriate to discuss Zyprexa and its indicated uses with primary care physicians in the interest of meeting a critical medical need. * It is important that the public understand that physicians can and do prescribe medications outside of their approved indications to meet the needs of their individual patients. “While it is accurate to say that mental illnesses like schizophrenia and bipolar disorder begin early in life — with a higher prevalence during early adolescence and childhood — it is simply untrue to assert that these diseases somehow end — and therefore prescribing for them ends — in young adulthood,” added Paul. “To dismiss the devastating impairment of these disorders throughout a patient’s life is wrong. “Bipolar disorder and schizophrenia are often treated in the offices of primary care physicians. In fact Lilly did research with primary care physicians and found that they were challenged in making the diagnosis of bipolar disorder. Many primary care physicians appreciate the educational outreach Lilly provides in mental illness,” he added. The Times failed to mention that these leaked documents are a tiny fraction of the more than 11 million pages of documents provided by Lilly as part of the litigation process. They do not accurately portray Lilly’s conduct. As part of Lilly’s commitment to patients and healthcare professionals, many high-level Lilly physicians and researchers — along with researchers from outside Lilly — were engaged for a number of years to study the issue of Zyprexa and diabetes. Leaked documents involving these discussions do not represent an accurate view of company strategy or conduct. Lilly deplores the illegal release of select confidential documents. This illegal and selective disclosure of incomplete information will cause unwarranted concern among patients that may cause them to stop taking their medication without consulting a physician. This is the unfortunate result we saw when plaintiffs’ lawyers aggressively advertised about Zyprexa in recent years while searching for clients. Lilly, a leading innovation-driven corporation, is developing a growing portfolio of first-in-class and best-in-class pharmaceutical products by applying the latest research from its own worldwide laboratories and from collaborations with eminent scientific organizations. Headquartered in Indianapolis, Ind., Lilly provides answers — through medicines and information — for some of the world’s most urgent medical needs. Additional information about Lilly is available at www.lilly.com. C-LLY Zyprexa (olanzapine, Lilly) (Logo: http://www.newscom.com/cgi-bin/prnh/20031219/LLYLOGO ) SOURCE Eli Lilly and Company Tarra Ryker, +1-317-276-3787, mobile: +1-317-332-7502, or Marni Lemons,
+1-317-433-8990, mobile: +1-317-532-7826, both of Eli Lilly and Company http://www.prnewswire.com Copyright 2006 PR Newswire. All rights reserved News Provided by COMTEX

Joey Hess: virtual postcard

I finally took some time to play with Google Earth, and came up with this view: This is a pretty fair approximation of my favorite view ever out of an outhouse door. The outhouse is on Angel Island, in the bay offshore of San Fransisco.

10 December 2006

Holger Levsen: security? get over it

It seems, that GnuPG has much more problems then the recently fixed security hole. The linked post is unfortunatly in german (except for a quote of some appearantly pretty bad code in gnupg). Fefe (who does code reviews for a living) points out the following highlights: gnugp2 now includes graphical outputs (why o why), links non-optionally to libusb and a smartcard-library, and the code size has tripled since version 1.0. And basically Werner Koch agrees with him: in the announcement he writes, that the whole codebase needs a security review, but they cannot afford to do it. Doh.

Stefan Esser retired from the PHP Security Response Team. Until reading his post I basically believed PHP code basically has so many problems, because it's so easy to code. Today I just want to thank Alexander Wirt, Jan Wagner and Stefan Esser, the author of suhosin.

Last but not least, firefox or iceweasel also seems to have problems. /me hugs dillo but misses its CSS support...

7 December 2006

Jeff Bailey: News Roundup...

In the news:

* Gates approved as new defence head

How's that for frightening? But, no, it's not Bill Gates. =)

* Victoria's Secret catalogue no longer in pulp friction

At Opus a few years ago, there were some folks doing a letter writing campaign to get Victoria's Secret to stop using Caribou habitat wood in their catalogues. It seems that it's now been successful.

In other news, TD Meloche Monnex can't provide a definition of when we will be living in the new place in order for them to insure it. I've done the rounds with two people now to try and sort out whether they'd be willing to insure or not. They can't decide whether us living in the new place is when we're eating and sleeping there or when every last box has moved. They're pretty happy to tell me that it's a grey area. I hear that as a pretty clear "you're screwed if you need to make a claim". Next!

That said, I took some pictures of the place this evening while we were moving some boxes over. We're trying to make this place not look cluttered. Will post them soon.

Also, note to self: Stairs are slippery. Luckily I was near the bottom step when I discovered this. Walking is a bit sore, but still okay. *sigh*

4 December 2006

Joachim Breitner: A Developer s GUI for Infon

One of my projects here at the KACE in Accra, Ghana, is to make the live programming game Infon a useful tool to teach programming. Until now, programmers had to upload their code to the server over a telnet or netcat connection. To lower the initial threshold for new users, I wrote an editor for infon bugs, using python and gtk. The features are:You can find a screenshot on the webpage for infon-devel.I also created Debian packages for the infon server, the infon viewer and my GUI, which you can find on my people.d.o page. The server and viewer packages are currently waiting for inclusion in Debian s experimental branch in the NEW queue and infon-devel will follow that path after some positive feedback (or lack of negative, we ll see).Further plans include a comprehensive documentation of the bug s API and maybe some hints for teachers how to use the program in classes. Comments with regard to the GUI, the debian packaging or the game in general are highly appreciated. You are also invited so swing by #infon on freenode.

26 November 2006

Julien Blache: Debian AMD64 on the Core2 Duo 15 MacBook Pro

So I’ve got my shiny new laptop which should complement my 5 years old PowerBook G4 500 MHz and had a bit of fun installing Debian AMD64 on it. I did it the hard way, not using debian-installer as it was a given for me that both the kernel and debian-installer itself were unable to deal with the machine. Installation method: Note that you do not need to install BootCamp on Mac OS X. On the Core2 Duo machines, the firmware already includes the SMBIOS stuff, so you’d only install a useless Mac OS X GUI which you can’t use because you’ve repartitioned before running BootCamp Assistant :-) Current status: most of what should work with Linux sort of works (that is, to say, everything but the WiFi). Things that do not work: Everything else works, and works fine. Wrote a small daemon to handle the special keys for LCD backlight, sound, keyboard backlight and CD ejection. Still needs a bit of polishing, after what I’ll release and package it. rEFIt isn’t available in Debian AMD64 yet, so gptsync isn’t available and must be run from an i386 system for the time being (plus gptsync is buggy on 64bit architectures). Patches ready, waiting for GNU-EFI on amd64 (#383801). Suspend to RAM and suspend to disk both work, use s2ram -f -p -m until the machine makes it into the built-in whitelist. The machine is pretty nice, though I’d appreciate it if the fans weren’t running at 5500 rpm when I have the laptop on my laps. Might be related to both the applesmc and power consumption issues. WiFi remains the biggest issue, battery life comes second ex-aequo with DVI-I output and sound is third. I’m quite unhappy with having to taint my kernel by using the fglrx (and madwifi in the future) proprietary crap, and even more when it doesn’t work as good as it should. Maybe RMS was right about ATI.

16 November 2006

Michael Janssen: Quickie Hack: Online X-mas list

It's getting around that time of year when kids start singing little annoying songs and thinking of the toys that they will be getting in slightly more than a month. In my family, when everyone gathered for thanksgiving, the younguns were expected to have a list which could be disseminated throughout the family with everything they wanted. This avoided some of the more clich gifts such as sweaters and socks. But who's to say that grownups can't have a little fun as well? It's rather easy to use del.icio.us as a holder for your whole Christmas list. If you find something you want, just add it to your del.icio.us bookmarks with a special tag - I'm using “xmaslist2006”. Using del.icio.us gives you a few advantages over the traditional list: Things on the list need not be completely techie - if you're just looking for a nice sweater, you can add a general page or a representative item with a comment on it. Perhaps include your sizes as well, especially for items which come in a large number of sizes like pants. With any luck, you'll get just what you want this year.

15 November 2006

Matthew Palmer: Severe Discomfort's "The Joy of UDP"

(For the grammar Nazis out there: no, that apostrophe is not misplaced)
There are times when a connectionless protocol almost doesn't seem worth the hassle. Take, for instance, the troubles of a round-trip communication, using UDP, where the initial request is sent to a secondary IP address on an interface. Your code, on the server, might look like this:
 s = UDPSocket.new
 s.bind('', 12345)
 loop   data, remote = s.recvfrom(65535); s.send(data, 0, remote[3], remote[1]  
This is a pretty simple Ruby fragment which just reflects your UDP packets back at you. It really doesn't get much simpler than that. Connect to this thing from somewhere else (using nc -u remoteip 12345) and you can reflect packets back and forth to your heart's content. Or so you'd think... When talking to a regular IP address, your packets probably look something like this (when viewed using tethereal):
 192.168.0.1 -> 192.168.0.2 UDP Source port: 35716 Destination port: 12345
 192.168.0.2 -> 192.168.0.1 UDP Source port: 12345 Destination port: 35716
Fantastic -- I send a packet, and get one back. In netcat, you see whatever you typed printed back out again. But, what if I add a secondary IP address to the server's interface (ifconfig eth0:1 192.168.0.5, for instance) and try sending packets to that IP address (with nc -u 192.168.0.5 12345)? I get this insanity:
 192.168.0.1 -> 192.168.0.5 UDP Source port: 35772 Destination port: 12345
 192.168.0.2 -> 192.168.0.1 UDP Source port: 12345 Destination port: 35772
And of course, no self-respecting network stack is going to accept a packet back from a totally different IP address, even if it did manage to get the ports right. Hence, the client never sees the return packets, and thinks that the server is snubbing it. What's happening here seems insane, but it's actually just a regular artifact of a connecntionless protocol like UDP. You see, we've bound our socket to the "any" address (the empty string in the call to #bind tells UDPSocket to bind to the "any" address -- no, I don't know why either, it's not a particularly intuitive interface). When we get the packet into our app via #recvfrom, we get no information on what address the packet was actually sent to, only that the OS decided that the packet was for us (yay for encapsulation). The only information we get is where the packet was coming from -- and due to the fact that the kernel keeps no connection-related information around for the socket (the kernel figures it'll hold us to our connectionless pledge), when the time comes for us to send a packet back, we have to explicitly say where we want that packet to go -- that's the remote[3], remote[1] arguments in the #send call. The brain-leakage starts when we work out where to say the packet is coming from. When we send the packet, a source address needs to calculated -- again, the kernel keeps no information on source or destination because we're connectionless. Because our socket is bound to the "any" interface, the OS thinks it has carte blanche to set whatever source address it likes. In Linux, the behaviour appears to be to pick the IP address set on the primary alias for the interface that will be used to send the packet out on. So for the common case (one IP address per physical interface) everything is fine. But those corner cases, gee, they're awfully sharp and pointy... The solution, of course, is to send the packet out through a socket that is bound to the particular address you want to use as the source address -- then the kernel knows what source address you want, and there's no confusion. Seems pretty trivial, right? Surely every sensible network application does that already, right? So obviously Ruby's UDPSocket implementation just sucks. That's what I thought, and I don't blame you if you think so too. But before you raise pitchforks and storm the gem-covered castle, try repeating our little experiment with some other widely-used UDP-based applications, such as net-snmpd or your ntp server. (The NTP server is a little different, in that to trigger the problem you need to start it and then setup the interface alias, for reasons I'll explain later). Both net-snmpd and ntpd exhibit the same behaviour as our trivial UDP echo service -- at least, the versions present in Ubuntu Breezy do, although I can't imagine everyone's suddenly cottoned onto this problem in the last 12 months or so and come out with a rash of fixes. So, basically, everyone seems to be suffering from the same malady. For values of "everyone" that equal "some UDP servers". There's some services that don't seem to have such troubles with alias interfaces -- the Bind DNS server comes immediately to mind, and ntpd works fine if you start the NTP server after you setup the interfaces. Why the difference? These services are clever and bind to each IP address on the system separately, like so:
 $ netstat -lun  grep :53
 udp        0      0 192.168.0.1:53          0.0.0.0:*                          
 udp        0      0 192.168.0.5:53          0.0.0.0:*                          
 udp        0      0 127.0.0.1:53            0.0.0.0:*                          
This is very cool, and solves the problem, except that if you add another interface after you start Bind, it doesn't pick up the new address, and you're boned until you restart the daemon. It also increases code complexity a bit, since you need add a select into your request handling loop (instead of just blocking on the #recvfrom call, like I've been doing thus far). Whilst I'm never happy about unnecessary complexity, I'll deal with it where I have to, but the real killer for this application is the "you can't change your interfaces after starting the daemon" rule -- my particular need is to make requests to a virtual service IP address, and restarting my service after each IP address change is going to suck hard. I mentioned ntpd earlier because it has some extra trickery at work. It's list of bound interfaces looks like this:
udp        0      0 10.6.66.6:123           0.0.0.0:*                          
udp        0      0 192.168.250.6:123       0.0.0.0:*                          
udp        0      0 172.14.16.6:123         0.0.0.0:*                          
udp        0      0 172.31.62.1:123         0.0.0.0:*                          
udp        0      0 192.168.37.179:123      0.0.0.0:*                          
udp        0      0 10.64.64.64:123         0.0.0.0:*                          
udp        0      0 127.0.0.1:123           0.0.0.0:*                          
udp        0      0 0.0.0.0:123             0.0.0.0:*                          
It listens to every IP address explicitly plus the "any" interface. I'm not quite sure why, either -- just listening to the specific addresses works for Bind, and if you add an interface alias after starting ntpd, it exhibits exactly the same problem as the trivial UDP echo service, so I don't think that listening on "any" is really gaining it anything. Listening on "any" does make ntpd behave differently to Bind: with Bind, if you send packets to an interface that wasn't available when Bind was started, it just completely ignores you (because it lacks a socket listening for packets to that address), while with ntpd the packets hit the "any" socket and suffer from the wrong-source-address bug. At the moment, my best chance of a solution appears to be to follow Bind and ntpd's lead and hook onto every address, but with the extra twist inspired by ntpd -- listen on the "any" address as well as all of the specific addresses. If I use any packets that arrive on the "any" socket as a trigger to rescan the available addresses (to add any new addresses that have been created since the last scan), that should solve all my problems. Now I only need to make it work (and deal with the insanities that will no doubt result). Wish me luck. The screams of pain and frustration you hear (no matter where you are in the world) are probably mine.

11 November 2006

Russell Coker: more about securing an office

My post about securing an office received many comments, so many that I had to write another blog entry to respond to them and also add some other things I didn't think of before.

One suggestion was to use pam_usb to store passwords on a USB device. It sounds like it's worth considering, but really we need public key encryption. I don't want to have a USB device full of keys, I want a USB device that runs GPG and can decrypt data on demand - the data it decrypts could be a key to unlock an entire filesystem. One thing to note is that USB 2.0 has a bandwidth of 30MB/s while the IDE hard drive in my Thinkpad can sustain 38MB/s reads (at the start - it would be slower near the end). This means that I would approximately halve the throughput on large IOs by sending all the data to a USB device for encryption or decryption. Given that such bulk IO is rare this is feasible. There are a number of devices on the market that support public-key encryption, I would be surprised if any of them can deliver the performance required to encrypt all the data on a hard drive. But this will happen eventually.

Bill made a really good point about firewire. I had considered mentioning it in my post but refrained due to a lack of knowledge of the technology (it's something that I would disable on my own machines but in the past I couldn't recommend that others disable without more information). Could someone please describe precisely which 1394 (AKA Firewire) modules should be disabled for a secure system? If you don't need Firewire then it's probably best to just disable it entirely.

To enable encryption in Fedora Core 6 you need something like the following in /etc/crypttab:
home_crypt /dev/hdaX /path/to/key
swap /dev/hdaX /dev/random swap
Debian uses the same format for /etc/crypttab.

The Peregrine blog entry in response to my entry made some really good points. I wasn't aware of what SUSE had done as I haven't done much with SUSE in the past. I'm currently being paid to do some SUSE work so I will learn more about what SUSE offers, but given the SUSE/MS deal I'm unlikely to use it when I don't have to. Before anyone asks, I don't work for SUSE and given what they have just done I will have to reject any offer of employment that might come from them.

I had forgotten about rsh and telnet. Surely those protocols are dead now? I use telnet as a convenient TCP server test tool (netcat isn't installed on all machines) and never use rsh. But Lamont was correct to mention them as there may be some people still doing such things.

The Peregrine blog made an interesting point about Kerberised NFS being encrypted, I wasn't aware of this and I will have to investigate it. I haven't used Kerberos in the past because most networks I work on don't have a central list of accounts, and often there is no one trusted host.

I strongly disagree with the comment about iSCSI and AoE "Neither protocol provides security mechanisms, which is a good thing. If they did, the additional overhead would affect their performance". Lack of security mechanisms allows replay attacks. For example if an attacker compromises a non-root account on a machine that uses such a protocol for it's root filesystem, the victim might change their password but the attacker could change the data back to it's original values even it if was encrypted. Encryption needs to have sequence numbers embedded to be effective, this is well known - the current dmcrypt code (used by cryptsetup) encrypts each block with the block ID number so that blocks can not be re-arranged by someone who can't decrypt them (a weakness of some earlier disk encryption systems). When block encryption is extended to a network storage system I believe that the block ID number needs to be used as well as a sequence ID number to prevent reordering of requests. CPU performance has been increasing more rapidly than hard drive performance for a long time. Some fairly expensive SAN hardware is limited to 40MB/s (I won't name the vendor here but please note that it's not a company that I have worked for), while there is faster SAN hardware out there I think it's reasonable to consider 40MB/s as adequate IO performance. A quick test indicates that the 1.7GHz Pentium-M CPU in my Thinkpad can decrypt data at a rate of 23MB/s. So to get reasonable speed with encryption from a SAN you might require a CPU which is twice as fast as in my Thinkpad for every client (which means most desktop machines sold for the last two years and probably all new laptops now other than the OLPC machine). You would also require a significant amount of CPU power at the server if multiple clients were to sustain such speeds. This might be justification for making encryption optional or for having faster (and therefore less effective) algorithms as an option.

I believe that the lack of built-in security in the AoE and iSCSI protocols gives a significant weakness to the security of the system which can't be fully addressed. The CPU requirements for such encryption can be met with current hardware even when using a strong algorithm such as AES. There are iSCSI accellerator cards being developed, such cards could also have built in encryption if there was a standard algorithm. This would allow good performance on both the client and the server without requiring the main CPU.

Finally the Peregrine blog entry recommended Counterpane. Bruce Schneier is possibly the most widely respected computer security expert. Everything he does is good. I didn't mention his company in my previous post because it was aimed at people who are on a strict budget. I didn't bother mentioning any item that requires much money, and I don't expect Counterpane to be cheap.

Simon noted that developing a clear threat model is the first step. This is absolutely correct, however most organizations don't have any real idea. When advising such organizations I usually just invent a few possible ways that someone with the same resources and knowledge as I might attack them and ask whether such threats seem reasonable, generally they agree that such things should be prevented and I give further advice based on that. It's not ideal, but advising clients who don't know what they want will never give an ideal result.

One thing that I forgot to mention is the fact that good security relies on something you have as well as something you know. For logging in it's ideal to use a hardware security token. RSA sells tokens that display a pseudo-random number every minute, the server knows the algorithm used to generate the numbers and can verify that the number entered was generated in the last minute or two. Such tokens are sold at low prices to large corporations (I can't quote prices, but one of my clients had prices that made them affordable for securing home networks), I will have to discover what their prices are to small companies and individuals (I have applied to evaluate the RSA hardware). Another option is a GPG smart-card, I already have a GPG card and just need to get a reader (this has been on my to-do list for a while). The GPG card has the advantage of being based on free software.

One thing I have believed for some time is that Debian should issue such tokens to all developers, I'm sure that purchasing ~1200 tokens would get a good price for Debian and the security benefits are worth it. The use of such tokens might have prevented the Debian server crack of 2003 or the Debian server crack of 2006. The Free Software Foundation Fellowship of Europe issues GPG cards to it's members, incidentally the FSFE is a worthy organisation that I am considering joining.

4 November 2006

Clint Adams: You promised me Broadway was waiting for me, a freeborn man of the U.S.A.

I used to write shareware. Some people would just send money with a brief thank-you note. Some people would adopt the attitude that I was beholden to them once I cashed their checks. Since the customer is always right, I was faced with the pressure of customer-directed development. For that and other reasons, I stopped writing shareware. My next mistake was to release everything as postcardware. I did not immediately realize that this was wrong, and I enjoyed the influx of postcards from various places. Never underestimate the power of a simple 53-byte executable to make random people happy. In time, I stopped writing postcardware. Many years later, someone offered me something, with the condition that I do something in Debian that I would have not done otherwise. Another individual was offered the exact same inducement with the exact same condition. We both accepted. I kept my end of the bargain. The other guy reneged. Sometimes I wonder if he inadvertantly did the right thing. Since then I have been paid to work on free software, but never directly on Debian.

26 October 2006

Mike Hommey: Facts about Debian, Mozilla Firefox and Ubuntu

or How Mozilla Corporation is FUDing on Debian. Again. This time, Christopher Beard, Mr Mozilla Marketing is talking about Firefox in Ubuntu, that it’s great, Ubuntu is a good boy, that it cooperates with Mozilla , and that by cooperating, it can use the great Firefox name and logo. To be honest, I don’t care that Ubuntu calls Firefox Firefox instead of Iceweasel or whatever. I don’t care that Ubuntu doesn’t care about freedom as much as Debian does. I could not care less. But, indeed, I do care about (yet other) false claims about Firefox in Debian. Let’s see what Christopher has to say about it:
I understand that Ubuntu is based upon Debian. Is that the same or different than the IceWeasel browser that Debian is shipping with their latest release?
It’s different. The patches that Debian applied to the Mozilla source code (which then resulted in their IceWeasel product) are more significant in scope than those in what Ubuntu is shipping (and branding as an official Mozilla Firefox release). Firefox in Ubuntu represents a somewhat more modest set of divergences from original Mozilla source code.
Let’s check out what it is about. And as I don’t want people to doubt my words, I’ll give you, readers, the ability to check for yourself what it is all about. First, please download the latest currently available patch for Firefox 2.0 beta 2 in Debian. It has been in experimental for some weeks now. It is a bit different from the patch I described earlier, so I’ll also tell you what has been changed since this 2.0b2 patch: (Also note that another change has been done since then, which is actually reverting a previous patch on gfx/src/gtk/mozilla-decoder.cpp, that was adding code that became dead code when we changed the way to fix the bug.) Next, please download the official and supported Firefox diff from Ubuntu. Uncompress both these diff files, and create two directories (let’s call them ubuntudiff and debdiff) which will contain the individual patches for each file. To fill these directories, please use the following commands:

$ filterdiff --strip=1 firefox_2.0+0dfsg-0ubuntu3.diff > ubuntu.diff
$ filterdiff --strip=1 firefox_1.99+2.0b2+dfsg-1.diff > deb.diff
$ cd ubuntudiff
$ splitdiff -d -a ../ubuntu.diff
$ cd ../debdiff
$ splitdiff -d -a ../deb.diff
If you don’t have the splitdiff and filterdiff utilities, you can get them from the patchutils tools (you will also need another of these tools later). Now, let’s have fun with these split patches… Files that are only patched in Debian: (excluding any file that would be in the debian subdirectory, that contains maintainer scripts for build and installation)

$ LANG=C diff -ru debdiff/ ubuntudiff/ grep "^Only in deb" grep -v debian wc -l
6
So, that’s 6 files that Debian patches that Ubuntu doesn’t. Let’s check what they are:

$ LANG=C diff -ru debdiff/ ubuntudiff/ grep "^Only in deb" grep -v debian

(reordering result for convenience)

Only in debdiff/: browser_base_content_aboutDialog.xul

Adds rows=5 to the user agent textbox so as to display the user agent string uncut by default

Only in debdiff/: content_html_content_src_nsGenericHTMLElement.cpp
Only in debdiff/: content_html_content_src_nsHTMLInputElement.cpp
Only in debdiff/: dom_src_base_nsGlobalWindow.cpp

It’s a patch I submitted in bugzilla #343953 and that got applied in Firefox 2.0. No surprise the patch is not applied on Ubuntu.

Only in debdiff/: extensions_reporter_Makefile.in

Patch I submitted in bugzilla #354413 and that got applied in Firefox 2.0.

Only in debdiff/: security_coreconf_rules.mk

Patch from bugzilla #325148 that got applied in Firefox 2.0 (see above), and a small patch to build the NSS library with debugging symbols (put -g in CFLAGS). That leaves only 2 small patches : CFLAGS = -g added to security/coreconf/rules.mk and rows=5 to browser/base/content/aboutDialog.xul Files that are only patched in Ubuntu: (same exceptions as for Debian)

$ LANG=C diff -ru debdiff/ ubuntudiff/ grep "^Only in ubuntu" grep -v debian wc -l
45
Yes, that’s right, that’s 45 files that Ubuntu patches that Debian doesn’t. Most are windows sizes and similar things that upstream can’t get right because they are values adapted to Windows, but that also includes some changes to the code and some other things. Let’s now check differences in files that are patched in both. It’s a bit of shell black magic, but you can check by hand that it does nothing wrong :

$ LANG=C diff -ru debdiff/ ubuntudiff/ filterdiff -p1 -x configure -x debian"*" lsdiff --strip=1 while read f; do diff -u debdiff/$f ubuntudiff/ awk "! /^--- ^\+\+\+ ^ ^[-+]*\@\@/ print \"$f\"; exit "; done

That gives a list of patch files that have more differences than line numbers changes, and that do not apply to the debian directory or the configure script (which is generated from configure.in), which is what we really want to compare here. You can take this list and run interdiff between these files from the ubuntudiff and debdiff directories. I’ll explain for you what these differences are: Overall, Ubuntu applies the same set of patches as Debian, plus some more. A somewhat more modest set of divergences, huh ?!? For what it’s worth, Ubuntu, like Debian, builds its Firefox with flat chrome and pango enabled.
What’s different in the shipping Ubuntu version of Firefox than the proposed Debian version of Firefox (that didn’t ultimately ship)?
Technically, changes include fixes to the User Agent string and the feed preview, a well as addressing issues of coherent branding. More significant than any specific difference in code, however, is Ubuntu’s commitment to work together with Mozilla and our community on releases going forward to insure product quality and integrity.
Why are you working with Ubuntu when you wouldn’t work with Debian?
We did try to work with Debian and would prefer a situation in which we work together. Ultimately, Debian took a position that was consistent with their own policies, and not compatible with some of the exceptions to Mozilla trademark policies that we offered. While we understand and respect their decision not to work with us under our branding guidelines, Mozilla believes that brands like Firefox are important for consumer protection. In any event, Ubuntu developers are working closely with Mozilla developers to insure product quality and features that are what users expect when they use Mozilla Firefox, which means that they’ll ship (and will continue to ship) a fully branded version.
Reading between the lines, that means Debian is not working with Mozilla. It’s not like we’re submitting patches. No. Never. Ever. I’m also glad to hear from Asa Dotzler, in comments to Mr Beard’s article, that this great collaboration with Ubuntu will lead to patches applied to Firefox (I guess the paid Canonical employees having more time to deal with Mozilla than the volunteer Debian maintainers may have helped, especially considering they didn’t have to do all what we already prepared). Anyways, it’s not like some of the patches we sent got applied. So, while I’m at it, here is an exhaustive list of the bugs where we took or sent the patches that are applied to Iceweasel: #51429, #161826, #252033, #258429, #273524, #287150, #289394, #294879, #307168, #307418, #314927, #319012, #322806, #323114, #325148, #326245, #330628, #331781, #331785, #331818, #333289, #333308, #343953, #345077, #345079, #345080, #345413. These don’t cover the following patches (see the rationale for these in my previous article): It’s so great to spend a great amount of time on a package, send patches, try to understand how things work to get patches applied, and yet, see such denial and false claims about our work. So please, Christopher, Asa, and the others, just stop talking about Debian, it will be better for everyone. PS for Rob in comments out there: No, ColorZilla won’t work on Ubuntu, because of the ABI incompatibility I explained in my previous entry, that Mozilla doesn’t seem to care much about.

16 October 2006

Robert Collins: 16 Oct 2006

Just landed a sweet feature for bzr: dotted decimal revision numbers. There is a sample log (warning its 2Mb) where you can see this in all its glory. A sneak preview is here:
------------------------------------------------------------
revno: 1986
committer: Canonical.com Patch Queue
Manager<pqm@pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2006-09-06 00:33:01 +0100
message:
  (robertc) Add TestCase.applyDeprecated, a common-case
helper for testing deprecated functions.
    ------------------------------------------------------------
    revno: 1982.3.3
    merged:
robertc@robertcollins.net-20060905231840-bd95f673d0205a81
    committer: Robert Collins <robertc@robertcollins.net>
    branch nick: applyDeprecated
    timestamp: Wed 2006-09-06 09:18:40 +1000
    message:
      Change raise AssertionError to self.fail in the new
applyDeprecated test support method.
    ------------------------------------------------------------
    revno: 1982.3.2
    merged:
robertc@robertcollins.net-20060905230133-2c68611e38fd7922
    committer: Robert Collins <robertc@robertcollins.net>
    branch nick: applyDeprecated
    timestamp: Wed 2006-09-06 09:01:33 +1000
    message:
      New TestCase helper applyDeprecated. This allows you
to call a callable
      which is deprecated without it spewing to the screen,
just by supplying
      the deprecation format string issued for it. (Robert
Collins)
------------------------------------------------------------
revno: 1985
committer: Canonical.com Patch Queue
Manager<pqm@pqm.ubuntu.com>
branch nick: +trunk
timestamp: Tue 2006-09-05 23:13:00 +0100
message:
  (robertc) Add symbol_versioning.deprecation_string, a
helper for establishing what a deprecation warning for a
symbol, version-format pair will look like.
This is really nice for users, because it lets them address revisions in a somewhat more predictable manner than the UUID each revision has. This feature is in the mainline now, look for bzr 0.12 to be able to use it - or grab bzr.dev now!

13 October 2006

Matthew Garrett

You know you've been spending too much time thinking about PhDs when it's 5AM in the morning and
CACTCGAAGCCGCCACGGCCACACTGCACCCTCAGTTTCGTGCAACTTTT
TGTACGCAAATAAGAAAAACATTAAATTTGCTCTCAGCAAATCGATAATT
GCAAACGCAGTGCCGTTTCAATTGCAGCACAAACCGCAACGAAAATGTTG
GCGACCGAGGCGAGACAGATCCTGAGCCGCGTGGGATCCCTGGTGGCCAG
GAACCAGATGCGCGCCATCAGCAATGGCACCGCCCAGCTGGAGCAGCAGG
CGCAGCCCAAGGAGGCCCAGGAGCCGCAGATCAAGAAGTTCGAGATCTAC
CGCTGGAACCCGGACAACGCCGGCGAGAAGCCGTACATGCAGACCTACGA
GGTGGACCTGCGCGAGTGCGGCCCCATGGTGCTGGACGCGCTGATCAAGA
TCAAGAACGAGATGGACCCCACGCTCACCTTTAGGCGCTCCTGTCGCGAG
GGCATCTGCGGCTCCTGCGCCATGAACATCGGCGGCACCAACACGCTGGC
CTGCATCAGCAAGATCGACATCAACACCTCCAAGTCGCTGAAGGTGTACC
CGCTGCCCCATATGTACGTGGTGCGCGACCTGGTCCCGGACATGAACAAC
TTCTACGAGCAGTACCGCAACATCCAGCCCTGGCTGCAGCGCAAGAACGA
AGCGGGCGAGAAGAAGGGCAAGGCCCAGTACCTGCAGTCCGTCGAGGATC
GCTCCAAGTTGGACGGCCTGTACGAGTGCATCCTGTGCGCCTGCTGCTCC
ACCTCGTGCCCCTCGTACTGGTGGAACGCCGAGAAGTACCTGGGCCCCGC
CGTGCTGATGCAGGCCTACCGCTGGATCATCGACTCGCGTGACGAGAACT
CCGCCGAGCGTCTGAACAAGTTGAAGGACCCCTTCAGCGTCTACCGGTGC
CACACGATCATGAACTGCACGCGCACCTGCCCCAAGGGGCTCAATCCCGG
CCGTGCCATCGCCGAGATCAAGAAGCTGCTCTCGGGCCTGGCCTCCAAGC
CGGCTCCGAAGCTGGAGACGGCGGCGCTGCACAAGTAGGGCCCAAGTCCT
CTACTCCCAGTTCGTCCCCTGCTGTCCTTAACCAGTGAGCTAAGCCTCCG
AAAATGTGTATTGGAGACTCCTCCAGCCAACATGCTTACTATGTTATAAT
TTATTTAAGCCTAAAGTATCCGACACTTGTTATTACAGTTTGTAAAGGGA
ACAAGACGCGAAAATAAATAATTGTGTATCCACCA
has become meaningful to the naked eye.

8 October 2006

Petr Rockai: power management on a linux laptop

I have been using powersave until recently, but I have gone from unhappy to fed up. I also have acpi-support and laptop-mode-tools and hell knows how they all interact. To add insult to the injury, powersave loves to crash or get stuck at times and dbus screws up at times too, which in turn screws powersave. Oh dear. So i have ditched powersave, left laptop-mode-tools and acpi-support around. And i wrote a perl script, i have called it "pm" to handle things i used powersave for. Primarily dpm (device power management) in linux, suspend to ram/disk, battery monitoring and friends. Right now it's ~250 LOC with comments, and more importantly, i know how it works. And it can do things powersave can't. So i am basically happy. It can suspend and resume pci devices (using id<->function mapping) and report their status. It has a very slim suspend wrapper, that just locks screen, syncs drives, remembers power states of pci devices and asks kernel to suspend. After resuming, it restores power states, does chvt voodoo to wake up my intel graphics and sets drive spindown timeout (something, somewhere screws this one up). I also added a "summary" output, that i run using watch on one of terminals in my screen session, that reports cpu frequency and scaling policy, system temperature, battery state (including charge/discharge rate in watts and remaining capacity in mAh), harddrive state (when spinning, also temperature and number of spinups in the drive's lifetime... if you know how to get those two without spinning up the drive, tell me). Then power states of devices (usb, ethernet, wlan, sound, modem, pcmcia, smartcard controller and isa bridge). And as a cherry on top, a list of processes and pids that have recently caused block reads from the drive (needs vm/block_dump enabled in kernel), so you can find out what caused drive spinup. That is about it, now for the catch. It works for me, it probably won't for you, at least not out of the box, unless you have same laptop as me. The pci ids of devices are hardcoded (although not hard to change near the top of the script), so is the screen lock function and probably a bunch of other things. It shouldn't be hard to make a similar script for your system using mine as a starting point though. Another thing that is missing is a nice reporter for KDE to be put on the panel or somesuch. Also, since the script is simplistic in its design, it assumes lots of things about both kernel (tested on 2.6.16 stock debian) and userspace utilities (acpi, hdparm, smartctl) and (oh, coarse-grained evilness), that you have sudo (needed for hdparm at least). Another assumption is that you have single battery and single cpu. But for all the limitations, it goes that if you are going to use a script like that, you probably know enough to extend it to multi-battery and/or multi-core situations. The script definitely needs a hacker-nature :-). So for the brave, the script is to be found on the pm page.

Next.

Previous.