During this year's Debconf I have been quite unproductive taking pictures.
The few I have managed to take are mostly irrelevant and with low to null artistic value (except one or two).
One of the reasons is that I brought my small camera (Canon IxusV2) instead of the 350D to avoid carrying too much wait, but the other might just be the weather.
It is so hot that the minimal amount of exercise will make me sweat, so I tend to move less. I dislike to feel wet, does not matter if it is because of the sweating or because of getting to the swimming pool.
Which reminds me we arrived to the conclusion that naked swimming should be mandatory.
PS: JoeyH: they have a sauna here. After some long discussion the guy at the gym said to Amaya: "Oh'right, you can be naked in sauna if you are alone and you put your swimming suit on if someone comes in." So it is not a REAL sauna ;)
Actually, all the Linux systems are very much alike. The libs are in /usr/lib,
the bigger apps in /usr/bin, only the core system utilities in /bin and so on.
Everything has it's place, and with the LSB that is pretty well defined.
And it's not just the kernel and a text editor, this applies to most of your
system. Including three office packages, a couple web browsers, a dozen IM
applications and so on.
Windows however is very fragmented. Well, not really fragmented, because no
two Windows systems are alike. On some systems it's "C:\Program Files", others
use "C:\Programme", maybe a dozen other translations. I've seen apps using
"C:\Progra~1" which works with both of above path names, at least on FAT, due
to the old 8+3 filename restriction. So I don't know about NTFS.
This makes supporting Windows a PITA. You can test something on all your
Windows boxes, and it just won't work on the first clients box you need to
run it on. Happens all the time. Not to mention surprises with actually
different Windows versions.
Thats what I love with OpenSource, Linux and Debian. You just "apt-get install
lyx" and you end up with a complete, working LaTeX and LyX environment on your
system within minutes. Completely hassle free. The amount of "third party
software" shipped with Linux is it's biggest strength. Everything is there,
and it'll just work and still not really make your system different from
anybody elses. Even across distributions. I have an Ubuntu workstation at one
institute at the university. The CS computer lab is all OpenSuSE currently.
But I don't need to care. It works just like my system. I google how to
change to page ordering when printing PDF slides 4-up, and it just works.
Because I'm currently seeing a forgotten logout screen, and have witnessed that
a dozen of times now, with both GNOME and KDE (and Windows I think, too; but I
rarely witness anyone using Windows...):
Please make the logout dialog automatically logout.
People tend to click on "Logout", and forget about the usual "do you really
want to logout, or maybe shutdown, or maybe reboot, or maybe ..." dialog
pretty much any operating system has.
I've never heard of anyone forgetting to pick "cancel" in that dialog, so I
think you could safely default to the "logout" option after a timeout of 60
seconds or so. Just make it not leave computers unprotected (a screensaver
will NOT activate!) for a long time just because people forget to logout twice.
So, I'm not going to
Debconf.
I suspected this long ago, when the dates were changed to early May, but you
never know. During the last month, I've been finding daily pink notification
alerts on my irssi window, with different people asking me to start
swimming to Mexico, to book a last minute flight, to work overhours
so I can justify leaving office for a whole week. In short, to POP THE
TRUNK.
But unfortunately, it doesn't look like I'll make it, being Thursday, and
when I was planning a hypothetical departure on Saturday in the same flight
as other Spanish Debian people. So, I've spent some time reading the blog
entries that start flooding Planet Debian from people who are already
attending Debcamp. NO NO NO! I can't believe there are even 10m diving
platforms.
There's talk at the office about me maybe having to go to some conference
in Seville.
jacobo and ana had an
opinion on that.
12:06 < ana> jordi: dude, mexico es mucho mas interesante que sevilla
12:07 < jacobo> en vez de decirte "quillo" te dicen "cuate"
I still have 1 and a half days to take some wild decision and get there by
surprise. That would be fair with azeem. :)
A
long
time ago, I reported about how I couldn't compile belpic 2.40 on Debian.
At the time, I'd assumed it had something to do with my
(mis)understanding of
SCons, a
make/automake/autoconf/... replacement written in python that upstream
had migrated to.
As it turns out, that isn't the case.
Script started on do 11 mei 2006 11:28:01 CEST
wouter@country:~/Desktop/bel-eid-nl-linux/_stap_2/src/pkcs11/src/include/opensc$
ls -l
totaal 4
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 asn1.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 cardctl.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 emv.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 errors.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 log.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 opensc.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 pkcs11.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 pkcs15.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 pkcs15-init.h
drwxr-xr-x 2 wouter wouter 4096 2005-12-01 10:14 ;34mrsaref
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 scconf.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 scdl.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 scldap.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 scrandom.h
-rw-r--r-- 1 wouter wouter 0 2005-12-01 10:14 types.h
wouter@country:~/Desktop/bel-eid-nl-linux/_stap_2/src/pkcs11/src/include/opensc$
Script done on do 11 mei 2006 11:28:05 CEST
AAAAARGh!
I got the MoinMoin parser running in django, and now have a mostly working wiki implementation using the MoinMoin parser (yay!), I ended up using the text_xml rather than text_html formatter for MoinMoin, this turned out to be a good idea, and meant that I didn't have to worry about them thar themes that get called otherwise. It still needs a few mins more work to actually make it a usable wiki, but the proof of concept worked.
Next on the list: writting a nice blog engine and moving my blog over to it rather than using pyblosxom... actually, I can do this one very trivially for a straight port of the current blog :)
We have a decision to make in the Hecl project that highlights how much computer programming is really an art, rather than a science. Namely, how to name a series of string handling commands. Tcl has a series of string commands like
string first string1 string2 ?startIndex?
string equal ?-nocase? ?-length int? string1 string2
string index string charIndex
which are mostly consistent. At times, they're also just a bit more unwieldy than I might like. For instance;
set somechar [string index "the nth char is" 4]
is just not as quick to write as
somechar = "the nth char is"[4]
For something that you need to use frequently like 'string equals', a shorter, quicker version is really a must - infact, Tcl's expressions recognize the 'eq' operator. Hecl has 'eq' and 'ne' as commands, which makes things a bit less consistent, sure, but a lot more convenient.
The decision we need to make, though, is where to draw the line? String equality is so common that it doesn't take much thought to opt for convenience. How about string index? string length? The artistry involved is to make something that's appealing to people, but also practical. Elegant, but not so much that it remains unsullied by use in real work.
Nattie (
tea_cantata) and I arrived safely in Mexico and have been fairly busy since then, while not blocked by lack of network access.
The Debian archive mirror prepared by
Steve made it here safely and is now attached to our main server. Yay for USB2.
Video team preparations are a bit behind
schedule but we are just about to do a smoke test with cameras and computers (but no audio mixer yet). I have backported Icecast 2.3 and Ffmpeg2Theora to sarge, and written a "dvtail" program to read the DV recordings for streaming, so that problems with our Internet link won't break recording or result in a huge lag in the streams.
I have also had to make and lay out a 100m power extension cable for a switch in the middle of a 200m stretch of network cable. This requiring fixing the crappy extension socket shut with a hammer, jumping^Wclimbing from rooftop to rooftop with cable, and then untangling it under a baking sun.
I'm loving the spicy food here, though I think I can do without jelly as a "vegetarian" dessert (I think this mistake will not be repeated) and may have to ask for refritos sin queso (without cheese). The heat is bearable and my hat and sun cream have so far protected me from sun burn. The insects are horribly noisy, but one eventually tunes them out, like the noise of fans.
So about two weeks ago I
started playing
with Kerberos. And I'm still not finished with it, kerberizing one
service after the other. Really fun, that.
Kerberizing a network protocol involves somehow sending the Kerberos
ticket in-band with the rest of the conversation. This is not entirely
defined by the Kerberos protocol, and indeed, different network
protocols have come up with different ways of sending the Kerberos
ticket to the service. So far, I've encountered SPNEGO for HTTP, GSSAPI
for IMAP and SSH, and SASL for LDAP. It sounds like a complex mess, but
it really isn't; in general, kerberizing a service involves three
steps:
- Installing the Kerberos plugin (if any) for both the server and the
client;
- Generating the service principal, and adding it to a/the keytab;
- Configuring the service so that it knows it can do Kerberos, and so
that it knows how to act when a Kerberos request is sent
Yes, in the cases I've seen it's really that simple. Although I'm
skipping step 0 here–reading the documentation. But I've done that
for you already ;-)
The hardest part is the initial setup. But even that isn't very hard,
because the process is very well documented. For starters, install the
krb5-doc package, and read the excellent
/usr/share/doc/krb5-doc/README.KDC which explains just enough
of the system to get you started. The rest will be explained to you
through debconf and the like; and if you want more, the
krb5-doc package also contains three info files which explain
concepts and usage very well. There's an alternative implentation called
heimdal, which I presume works similar; but I haven't tried it,
so I don't have much details on that one. The process of installing
krb5 is very straightforward; the only thing I'll let you know
is that you should ensure that any host you're going to kerberize should
have reverse name lookups configured and working correctly; otherwise,
you're going to run into a bunch of serious problems.
After the initial setup, you'll have a Kerberos realm, usually your
domain name in upper case (GREP.BE in my case). You'll now want to set
up principals for your users and principals for your hosts. Now, let me
show you how to configure Kerberos for LDAP, PAM, HTTP, IMAP, and
SSH:
- PAM
- By installing and using the libpam-krb5 package, you'll
log in to kerberos and receive your
TGT immediately at login
time; the alternative would be having to use kinit (in the
krb5-user package) afterwards. pam_krb5.so also takes
care of destroying your tickets when you log out, so that you don't have
to worry about that. This is very handy, but not really required; you
could just use kinit all the time. Of course, using
pam_krb5.so also means you have only one password for
everything—and that is a very good argument to use it.
- Anyway; our three steps:
- Installing the plugin
As you've guessed, libpam-krb5 is the package you'll
need. That, or the heimdal implementation.
- Generating and installing the service principal
In the case of any service such as PAM that will give you a shell
(thus, as we'll see later on, also SSH), the principal is supposed to be
host/<hostname>@<REALM>. For instance, on
rock.grep.be, the principal PAM will use is
host/rock.grep.be@GREP.BE. We'll create it with kadmin (which
can be done on any kerberized host):
wouter@rock:~$ sudo kadmin
Password for root/admin@GREP.BE:
kadmin: addprinc -randkey host/rock.grep.be@GREP.BE
WARNING: no policy specified for host/rock.grep.be@GREP.BE; defaulting to no policy
Principal "host/rock.grep.be@GREP.BE" created.
kadmin: ktadd host/rock.grep.be@GREP.BE
Entry for principal host/rock.grep.be@GREP.BE with kvno 3, encryption type Triple DES cbc mode with HMAC/sha1 added to keytab WRFILE:/etc/krb5.keytab.
Entry for principal host/rock.grep.be@GREP.BE with kvno 3, encryption type DES cbc mode with CRC-32 added to keytab WRFILE:/etc/krb5.keytab.
kadmin: q
Generating the principal can really be done as any /admin
user; but as the same isn't true for writing the keytab, I'm using
sudo in the above example to become root.
- Configuring
account required pam_krb5.so ignore_root
auth sufficient pam_krb5.so ignore_root forwardable
password optional pam_krb5.so ignore_root
session optional pam_krb5.so ignore_root
After adding the above lines to the relevant files in
/etc/pam.d, you should log off, then log on again, run 'klist',
and marvel.
If you add the lines to your passwd file as shown above, and don't
remove the pam_unix.so lines, then local passwd-based
authentication will still work. This can be nice if, for
example, the Kerberos server is down, or you're working on a laptop that
isn't always within reach of the Kerberos server. It doesn't do any
harm; the worst that can happen is that at some point you happen to be
on a network where there's a firewall which drops packets on the floor
rather than sending you an ICMP port unreachable; in that case, you need
to wait for the Kerberos login to time out, which takes half a minute or
so (I haven't timed).
- SSH
- Installation
If you're running unstable, you don't need to do anything. The
OpenSSH packages in unstable are all set to understand Kerberos.
If, however, you're running stable, you'll want to replace your
ssh package by the ssh-krb5 package, which is the
regular SSH package plus some patches to enable GSSAPI (read: Kerberos)
authentication.
- Service principal
If you've done the PAM setup above, you're all set; SSH, being a
service which gives you a shell, also uses the host/ service
principal.
- Configuration
Make sure both the server and the client have the
GSSAPIAuthentication option enabled. After you've done so,
restart the server.
- IMAP
- I'm using dovecot as my IMAP
server, which has builtin support for GSSAPI authentication (at least in
unstable; haven't checked stable in this regard).
- Installation
As dovecot comes with everything compiled in, there is no need for
installing extra packages.
- Service principal
You'll need the imap/ principal (e.g.,
imap/rock.grep.be@GREP.BE). Note that the host name which is
found by doing a reverse lookup on the ip of the server is what counts,
not the name of the server as you're using it (so not, e.g.,
imap/imap.grep.be@GREP.BE)
- Configuration
Edit your dovecot.conf, and find the line that starts with
"mechanisms" in the auth default stanza. Make sure it
contains at least the word gssapi. Restart dovecot.
I haven't found a Free (as in speech) IMAP client that supports
GSSAPI authentication. My client of choice, offlineimap,
doesn't seem to support it; mutt doesn't either (unless I'm missing
something); and while thunderbird in unstable is
supposed to support it, I haven't been able to configure it
correctly yet. Probably me. I have, however, been able to verify that it
works by using a non-free software package. Obviously, this
isn't good enough. In addition, I found that horde and imp don't like an
IMAP server that has GSSAPI enabled if they don't, while enabling GSSAPI
in horde requires a PHP extension that isn't packaged in Debian. So I've
disabled it for the time being. Stay tuned.
- LDAP
- Installation
LDAP requires uses SASL for authentication, which doesn't have GSSAPI
modules in the default package; for those, you need the
libsasl2-modules-gssapi-heimdal package.
Attentive readers will have noticed that this package contains the
string heimdal in it, rather than krb5, and that this is not
the same implementation that I've been using previously. Yes, true. But
since there's no libsasl2-modules-gssapi-krb5, and since
Kerberos is, after all, a well-defined protocol, this is not an
issue—except in that you need a bit more diskspace for the
additional libraries.
Note that the modules have to be installed on both the client and the
server.
- Service principal
You need a service principal that starts with ldap/,
obviously followed by the hostname and the realm.
- Configuration
For those people whom you want to allow to authenticate themselves
using Kerberos, make sure they have ' SASL <principal>'
in their userPassword attribute set (e.g., I have
userPassword: SASL wouter@GREP.BE). You can have that in
addition to a regular encrypted password; the userPassword
attribute is a multi-value attribute. Now if you use ldapsearch
or anything similar, it will try to negotiate GSSAPI authentication as
the SASL mechanism. If it doesn't do so, you can force it by adding
-Y GSSAPI to the command line.
- HTTP
- Installation
You need the libapache-mod-auth-kerb or
libapache2-mod-auth-kerb modules on the server. For the client,
you need a browser which has SPNEGO support; Konqueror and Firefox are
two examples of browsers that do.
- Service principal.
The prefix here should be HTTP/. That's right, in upper
case, contrary to previous examples where this wasn't the case.
HTTP is also different in that apache usually isn't running as root.
This is a good thing; however, it does mean that the kerberos
authentication module is unable to read /etc/krb5.keytab. You'll have to
write the service principal to a different keytab for apache; I've used
the -k option to the ktadd command in kadmin to specify the
keytab as /etc/apache2/keytab; I'll assume you do the same.
- Configuration
Something like this, on the server:
<Location /some/URL>
AuthType Kerberos
KrbMethodNegotiate on
Require valid-user
Krb5Keytab /etc/apache2/keytab
</Location>
This will enable SPNEGO authentication; and if SPNEGO authentication
fails for some reason (for example, because the used browser doesn't
support SPNEGO, or because the user isn't logged in to Kerberos), it
will fall back to Basic Authentication.
While the latter is usually a good idea, it's less of a good idea if
you're not using SSL, since then your password would be sent over the
wire in cleartext. Luckily, the basic authentication can be switched
off, by using KrbMethodK5Passwd off. If you go to my webserver logs,
you'll see that you'll get a 401 right away, while the HTTPS version of the
same allows you to try to log in by using basic authentication.
On the client side, if you're using Firefox, you need to go to
about:config, and set the option
network.negotiate-auth.trusted-uris to a string that will
identify the servers that may do SPNEGO authentication in your realm. In
my case, I've set it to grep.be. For konqueror, doing something
similar is not required—it'll do SPNEGO authentication out of the
box.
So, that's what I've got set up on my network currently. Next on the
list: NFS4 kerberos auth (requires updated nfs utilities, which aren't
in Debian yet because of issues with NFS2, IIRC), PostgreSQL (it
does
seem to support it), and finding out if or how I can create
principals can't be used for one authentication scheme or the other.
Phew, that was a long post. I'll stop now.
Do you remember the time that Kenneth Branagh was supposed to serve me tea and scones?
No? Well, I do. What I remember most about that is that he never did. Seeing Roger
Moore in a dress made up for having to pay $1 to see Roger Moore in a dress, but did
it make up for the lack of scones? I don't know.
On friday the 5th I started my trip to MX. I am assisting to Debconf 6 from the very first day, so that I can help the local team (at least with translations and such).
I arrived to the airport early, so that I didnt have to suffer last minute stress if I see that the line is way too long and I have too little time to catch the plane.
It all started fine (well, I forgot my keys at home when taking the dog for a walk, but I managed to reach my girlfriend and she came back to open the door for me).
I must be the worst traveler in the world, since I seem to be causing only problems. Or maybe is that I question too many things that are the status quo and seem reasonable for other people.
From the begining. It was check-in time, and the lady ask me about my hand luggage. I mentioned that since my friends were going to be waiting for me at the airport for almost 2 hours, I had prepared all my stuff so that I was not carrying anything dangerous in my two backpacks. Heck, I even left behind the regular tools that I carry with me, including the nail scissors,...
The lady said it was not possible. "Sir, you can only carry 8 kilos of hand luggage". I looked around and saw people with lighter bags, but bulkier than mine. "Sorry, but, what is the reason? My luggage is smaller that the regular luggage, and I just need to get out asap". "Security reasons, sir". "Could you describe those reasons?". "... ... (surprise face) Security, sir. I would like to travel with my 20 kilos os luggage with me, sir". Yeah, sure. I am happy about that. I dont recall going away for such an extended period with such an small amount of things.
When did all this madness start?
Well, she did not manage to give me any reason why I could not take my things with me, but she got her sweet revenge. She put me on the back of the plane, with a guy who had at least 50k more on than I, although we both paid the same price for the ticket. I wonder where the security reasons are then, for those 50k...
(Mental note: add to the travel checklist not to EVER forget deodorant and to take a shower before leaving home. Two showers. I had enough torture with the guy beside me...)
The nice part of the flight was that for the first time i traveled on a Jet. Boy, is nice.
Landed in Germany. The plane went to park on the backyard of the airport. We had a long 10min trip back to the terminal.
The check-in for the plane to MX was a full hour set in advance, so that the HUGE amount of people that fits on one of those 747 had the time to show (for the 10th time) the passport. But looking aroung one wonders again where those security reasons not to let me carry my 8 kilos of luggage are: people around me had bought nearly their year salary on duty free stuff that wights more than 15k.
Oh, boy, now I am confused. Is it so that someone has decided to add a rule in the name of security at some point after 11/9 and they forgot why? What difference does it make to get the luggage with 8 kilos from outside the terminal than from inside?
As a side note, one can see that mexicans still keep much of the Spanish attitude. The speaker goes on, a man speaks in German and explains that people with children will board before anyone else. Nobody has understood anything, but they are already piling before the boarding gate. Once the man speaks in English, only the ones who dont understand English still await impatientily at the gate, mostly disturbing the check-in procedure for the flight, which will probably be delayed because of that.
The second part of the trip was a bit more relaxed... I will skip the story about the looks-like-it-is-not-her-day flight attendant who could not understand a shit, and will only mention that when she served me a light coke and I handed her the empty can for dispossal, she gave me another full can with a face of "take-this-and-shut-up,dont-you-see-i-am-not-having-a-good-day?".
I did not know Mexico was in the south hemisphere. At least that was the reason given for the satellite-linked internet only working the first three hours, although we were flying through Greenland, Canada, USA and Mexico's gulf for the 12h of flight, and Mexico IS on the (using the lonstanding critizised convention of not putting the map upside-down and say that is the right possition) north side.
After landing it was a bit of rush, until I had to wait for my luggage, which of course came after waiting for almost 40min (Revenge of the Check-in Lady, take three... hi, if you read me). The people who create those inmigration forms MUST have short names. They have a big horizontal box with small vertical lines on the boxes to put your data trying to force you to put every character of your name in one small designated area. So there you go: "J E S U S _ D A N I E L _ C L I M E" That's right. Not even my first surname fits. Forget the second. This are the times that a friend of mine comes to mind: Enrique Garcia-Villarubia Gomez-Limon (Hi, if you read me).
After all this I went out to find Amaya and h01ger waiting for me. We met Ganneff, Stockholm, Sam and Jeroen, and Damog, along with Agi, were coming right after picking up the van.
We put Ganneff and Stockholm on a taxi and sent them to Oaxtepec, and left the airport for some dinner.
Mexico is BIG, BIG, BIG. After driving for more than half an hour we got to a bridge from where you could see the city lights. And still, they were covering the horizon. HUGE. That realization is something I have not digested yet. Some local beers and tacos made the end of the night and we headed to Hector's place, where we were going to spend the night.
From a not so negative point of view, the whole experience has been positive, and enlightening, to say it mildly. The food is mostly spicy. It could burn hell. Amaya is trying to get use to it by eating an insane amount of hot stuff but I refuse to do so.
For the scared (hi, helix) I have not managed to get anything from the tap water. So nobody is dead, yet, although rumor has it that some are in comas.
The net is here, although the roundtrip values are not very exciting.
Mao has visited already the place, and said it is here to stay.
Summary for the ones to come: this is HOT. I mean, really HOT. Forget your long jeans and bring shorts, even if you dont like to show your legs, sun screen cream, t-shirts, deodorant, swimming suit, and keep a bottle of water all the time with you.
Food is served at a more sensible time than in Finland: 02:00h and 20:00h.
See you in MX.
Thanks to the excellent
JhAutoBuild, I discovered a problem in
my recent Sound Juicer refactoring that even a
make distcheck
didn't detect, causing a build failure. It's now confirmed to be fixed,
as another machine has
just
done a clean build. Sweet.
As thanks I'm contributing possibly the slowest build machine in the
world: my LinkStation NAS box. It's a PowerPC running at about 100MHz,
with 64MB of RAM. I hope I've got enough of the dependencies installed,
you can follow it's rather slow progress
here. 25 minutes in and it's still building the first module,
libxml2. Go Melchett go!
NP: Protection, Massive Attack
We arrived here in Oaxtepec yesterday in the evening. All in all, I was 24
hours on the way. I met with some guys from Finland in Amsterdam, so it
wasn't that boring waiting for the plane to Mexico City. From the airport in
Mexico City we took a taxi to Oaxtepec. We ate something, and I learned an
important lesson... if a mexican guy tells you something is spicy, it _is_
spicy. After dinner, I went to bed.
This morning, we did some infrastructure work (setting up network cables
between the locations). Now we're sitting here in the hacklab, and waiting for
internet. We have a local wireless network, but no upstream yet. And thanks to
Ganneff I can't make pictures currently, because he required my batteries for
his radio.
Ross,
I don't think something like that exists. But it's not actually hard to
make, really.
- Apache can be configured to redirect any PUT request to a given
script. Just write yourself a small PHP or CGI script that will take a
file, put it somewhere safe, and send a 200(ish) status code back. PHP
has a function for precisely that purpose.
- Writing something to give you an HTML form back if someone does a
GET / isn't exactly hard.
Altogether, it sounds like a bit of tinkering that'll be finished in
an hour or so.
Someone just asked something on
be.comp.os.linux for which I spent
quite some time on reading relevant documentation to find a working
solution. It's not hard if you know it, but since it's hidden in a lot
of documentation, some of which only partially relevant, I thought it'd
be nice to show it here.
The question was about how to do some traffic shaping based on the
process which is sending out the data. This is not directly possible;
however, it is possible to match packets based on the PID by using
iptables'
-m owner. The nice thing about this solution
is that it doesn't
have to be the PID you're selecting on; you
can really use anything (yes,
anything) in iptables to decide
on traffic shaping later on.
The trick is to use the
-j MARK stuff from iptables. In our
example:
iptables -t mangle -A PREROUTING -m owner --owner-pid <some PID> -j MARK --set-mark 1
Now our packets are marked based on what PID is sending them out.
Next, we'll have to make sure those packets are given lower priority
over other packets:
tc qdisc add dev $OUTIF root handle 1: htb default 10
tc class add dev $OUTIF parent 1: classid 1:1 htb rate 256kbit burst 15k
tc class add dev $OUTIF parent 1:1 classid 1:10 htb rate 100kbit burst 15k
tc class add dev $OUTIF parent 1:1 classid 1:20 htb rate 50kbit burst 15k
tc qdisc add dev $OUTIF parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $OUTIF parent 1:20 handle 20: sfq perturb 10
tc filter add dev $OUTIF protocol ip parent 1:0 prio 1 u32 match mark 1 0xffff flowid 1:20
Et voila, you have traffic shaping based on the iptables -J MARK
stuff. Nice, huh?