A feature that I wish Linux package managers had

One of the things that I wish Linux package managers like yum and Apthad was a convenient way of retrieving the original, stock version ofsome file and optionally reinstalling it into its original place. I'dexpect (and wouldn't mind) that this would require re-downloading theoriginal package that the file came from (and thus it was restrictedto packages that were still in the package repository and hadn't beenobsoleted and removed by some more recent package).

You might wonder what use this


A downside to syndication feed readers respecting permanent HTTP redirects

In theory, well behaved syndication feed readers are supposed to noticewhen the URL that they are polling changes; when they see a permanentHTTP redirect, they should update the feed URL. I recently ran into adownside to this behavior.

One of the online webcomics sites that I read bits of recently failedto renew its domain name in time. While the domain name was overdue forrenewal, the registrar redirected all URLs on the domain's website to amore or less generic domain parking and advertising page on a


Limitations on custom NFS mount authorization on Solaris

As it turns out, there are some limitations with our custom NFS mountauthorization hack that we've discovered.First, Solaris 10 puts some security restrictions on what mountd cando; the specific bit that we ran into is it can't fork() and exec() shell scripts. Mountd can make outgoing socket connections, so we gotaround this by putting most of the complex work in an inetd-spawned'daemon'. (There is probably a way to turn this security feature off,


What you can't do before you drop setuid permissions

Let us suppose that you have a program that is setuid root but thatusually drops its setuid status and reverts to running as the user thatran it. Of course you want to do this as early as possible to reducethe potential security risks, but at the same time you might want dosome operations while still root (for reasons of either necessity orconvenience in your code structure).

Consider the following tempting sequence, presented in pseudo-code:

chdir(pw->pw_dir);
drop-


Using SystemTap to trace the system calls of setuid programs on Linux

Suppose that you have a setuid program that is failing mysteriouslyand you want to see what it's doing. With normal programs you can use strace , but not even root can strace a setuid program (if you try,the program runs non-setuid).

(Yes, strace has the -u option, but it doesn't help if the setuidprogram is being run as part of a whole chain of processes in a specificenvironment and you can't just run it directly. It would be


How fast various ssh ciphers are

Periodically it surprises people to learn this, but ssh is notnecessarily very fast (in the bandwidth sense). It's plenty fast fornormal interactive use, but this speed issue can matter if you aremaking large transfers with scp , rsync , or the like; depending onyour environment, ssh can go significantly slower than wire speed.

Ssh is slow because it has to encrypt and decrypt everything that goesover the wire, and this is a CPU-bound operation. How much time thistakes depends on


How we do custom NFS mount authorization on Solaris 10

Suppose that you want to use some custom method of authenticating andauthorizing NFS mounts, and that your fileservers are Solaris 10 systems(although the same general approach could probably work elsewhere).Further suppose that you don't have the source to mountd , or at leastdon't want to modify it for various sensible reasons. Fortunately,there is an evil hack that you can commit that will let you do whateverauthorization checks that you need.

(When thinking about all of this, remember that NFS mount


The shift-selection trick in X terminal programs

Seeing this todayreminded me of a relatively obscure feature and counter-feature in xterm and similar imitators like gnome-terminal and konsole.

First, the feature (sometimes 'feature'): in order to let text modeprograms still have clickable objects, xterm lets programs steal leftmouse (button-1) clicks; instead of selecting text, the program getsescape sequences that tell it about the click and it can do whatever itwants with them. The most obvious application is text-mode web browserslike links


Spammers are quite dedicated in their address scraping

This is one of those entries that require some apparently irrelevantbackground.

The Atom syndication feed format requires that each entry have a uniqueidentifier assigned to it (the atom:id element, to use XML jargon).This identifier is a valid URI, formed using any number of schemes(see here ). DWiki (the software behind WanderingThoughts ) initially used the fullURL of entries as the Atom ID, because this required no additionalconfiguration or per-entry metadata. However, this causes seriousproblems if you ever


Why you should do code reviews for sysadmin scripts

Through my experiences over the past while, I've come around to theview that you should try to have code reviews for sysadmin shellscripts. There's two reasons for this, and they both have to do withthe fact that the Bourne shell is not really a programming language .

First, you want code reviews so that other people can convince you thatyour clever Bourne shell idioms are a little too clever. People's tastesand standards for this vary widely, and you're writing scripts not