Digitalisering i praksis – *suk*

Public service. Log direkte på uddannelseskort via faelles.uddannelseskort.dk.

I morgen skal jeg starte igen. Men jeg har stadig ikke fået noget uddannelseskort til at rejse med.

Til gengæld har jeg fået en faktura fra DSB. I dag. Med betalingsfrist i dag. Der står også at der kan gå op til 14 dage fra de har min indbetaling til jeg modtager kortet.

En af de ting der under mig, er at på DSBs hjemmeside står der at jeg kan/skal betale med betalingskort.
Søvlpapirshattene ville straks proklamere at det var for at sende nogen penge i retning af PBS Nets (jeg lærer det nok med tiden) – men det tror jeg nu ikke.

Napoleon Bonaparte giver en bedre forklaring.

Never ascribe to malice that which is adequately explained by incompetence.

Jeg betaler fakturaen og tjekker inde på mituddannelseskort.dk, næh det var et typosquatting domæne. uddannelseskort.dk så.
Nej, heller ikke?
Nåå www.uddannelseskort.dk! URL redirection er en også en svær disciplin.

Men hvor kom jeg fra? Nå ja, kortbetalingen! Måske har jeg overset noget.
På siden kan jeg ikke andet end at vælge betalingsform (giro eller betalingskort) og skifte gyldighedsperiode. Altså må det være hos DSB betalingssystemet må være.

Min konklusion bliver her så at DSB ikke har deres online betalingssystem klar endnu – og derfor bliver sorteper sendt videre til bogholderiet der så skal sende fakturaer ud mere eller mindre manuelt.

En ting der dog fanger mit blik inde på www.uddannelseskort.dk er følgende:

Bestillingsstatus:
25-08-2011: Uddannelsesstedet har godkendt din bestilling 
            og sendt den videre til trafikselskabet.

Det har altå taget dem 10 dage (8 hverdage) at finde ud af at jeg er studerende på DTU

Hvorfor i alverden skal mit uddannelsessted nu godkende mig? Hvorfor kan uddannelseskort.dk (undskyld www.uddannelseskort.dk) ikke snakke sammen med minSU som allerede ved at jeg er under uddannelse? Den flaskehals som de 8 dage repræsenterer, er efter min bedste overbevisning, af bureaukratisk karakter. Der skal med andre ord sidde en kontormedhjælper og taste/ringe/brevsende oplysninger rundt og godkende.

Jeg kan ikke i min vildeste fantasi begribe hvorfor det er bedre at have én flaskehals i stedet for flere i form af kortsalgsstederne.

Til dem der ikke ved hvordan systemet var, kommer proceduren her.

  1. Jeg søger om uddannelsesrabat via minSU
  2. Jeg modtager et papir der fortæller hvilke måneder jeg er berettiget til rabat.
  3. Papiret vises ved kortsalgsstedet ved kortkøb og rabatten udløses

Den nye procedure er:

  1. Jeg bestiller uddannelseskort via faelles.uddannelseskort.dk via borger.dk via www.uddannelseskort.dk 14 dage før studiestart – som anbefalet.
  2. Jeg modtager en faktura fra DSB 14 dage efter
  3. DSB sender mit kort (op til) 14 dage efter de har modtaget min betaling
  4. Jeg køber et periodekort ved et kortsalgssted
  5. Jeg refunderer periodekortet når jeg har modtaget mit uddannelseskort

Man skal ikke være være den store logistiker for at erkende at der i det nye system er et enormt ressourcespild i form af mandetimer spredt ud over flere instanser. I øvrigt er proceduren en del længere hvis man går ind via en søgning p Google.

Uddannelseskortet virker fra mit synspunkt mest som digitalisering og sammenlægning for digitaliseringen og sammenlægningens skyld. Slutbrugerens udbytte er i hvert fald ikke eksisterende.

Migrating Dovecot 1.2 Maildir to Dovecot 2.0 dbox

I am in the process of migrating to a new mail server. Therefore I need to, as painlessly as possible, move users. The details about the setup is another story for another day – promise.

This guide is targeted for Debian systems, but the concepts apply for all other systems as well.

Dovecot 2.0 comes with a nice tool called dsync which eases migration by a great deal. Unfortunately, my current mail server runs Dovecot 1.2 and therefore does not have the tool.

What to do, then.

Basically I have thought up three options for migrating.

  1. Using dsync on both sides
  2. Using rsync, then dsync
  3. Using dsync over sshfs

This post will serve as documentation for my experiments with mailbox migration.

If you are in a hurry, you can skip to the conclusion.

Using dsync on both sides

Being that I run Dovecot 1.2 and thus do no have dsync available I will need to pull down the sources and compile them myself. (I do not want to use dpkg’s as they may intervene with the existing installation.)

I got as far as getting the source compiled, but have not investigated further. Some paths were wrong – I cowardly quitted.

Later experiments with the two other approaches have shown that this, most likely, will not prove successful.

Using rsync then dsync

Next solution was to create a two step migration solution. First I used rsync to copy my Maildir mailboxes to the new server.

rsync -poazuHK -e ssh \ 
     root@oldmailserver.tld:/var/spool/postfix/virtual/ \ 
     /var/vmail.migrate/

You can log in as root here, as the -o (preserve ownership) maps the uname to the uid on the target system. Clever :-)

Then, run dsync for each user in order to import the new emails.

dsync -R -u myaddress@mydomain.tld backup \
maildir:/var/vmail.migrate/mydomain.tld/myaddress/Maildir/

Mirroring does not really make sense here as we have a local copy of the mailbox

This approach is by far the fastest and easiest.

Using dsync over sshfs

Notice: This only works with backup and not mirror.

Why? Dovecot2 log format is incompatible with Dovecot1’s that will timeout with a message about an unknown record type (0x8000) after a mirror operation.

# apt-get install sshfs
sshfs -o uid=`id -u vmail` -o allow_other \
vmail@oldmailserver:/var/spool/postfix/virtual/ \
/var/vmail.lucretia/

Remember the -o allow_other or the dsync will fail because the vmail user will not have access to the mount point.

Then, run dsync for each user in order to import the new emails.

dsync -R -u myaddress@mydomain.tld backup \
maildir:/var/vmail.oldhost/mydomain.tld/myaddress/Maildir/

Ownerships is of the essence here. Do not use root as this user will take ownership of dovecot metadata files causing your source mail server to coredump or just stall.
vmail is not the best option either – but I was lazy. You should take advantage of the fact that the vmail folders are (usually) gid vmail. Putting a migration user in this group and chmodding will probably be preferred, security-wise.

This approach works well when refined (eg. usíng the right uid on both sides), but is pretty slow – about 100kb/s sync. This not really acceptable for 1GB+ mailboxes. But as always, your milage may vary.

Your remote Dovecot will keep on running as nothing has happened – if you get the permissions correct. Unfortunately there are problems with the dovecot transaction log resulting in problems with uid of the Mailbox being inconsistent, resulting in something like this:

Error: Corrupted transaction log file /var/vmail/domain.tld/username/dbox/mailboxes/INBOX/dbox-Mails/dovecot.index.log seq 4: indexid changed 1313910265 -> 1313868319 (sync_offset=0)

Conclusion

My previous attempts have lead me to one conclusion: I need to move the mailbox once.

I chose the rsync+dsync approach and then did the following:

  1. Migrated all users to the new server
  2. Updated DNS
  3. rsync’ed first time
  4. Stopped the Dovecot and Postfix service on the old server
  5. rsync’ed second time
  6. dsync’ed the mailboxes
  7. Turned virtual_mailbox_maps and domains into relay_recipient_maps and domains respectively

If you decrease the TTL for you domain up until the move, you can minimize downtime. If you maintain a local DNS – even better.

This is not the fancy minimal down-time approach I had hoped for, but it has been sufficient for my needs. Feel free to contribute feedback.

Troubleshooting

I got a:

dsync(root): Fatal: Mail locations must use the same virtual mailbox
hierarchy separator (specify separator for the default namespace)

Some google-ing revealed that I needed to setup a namespace separator. The technical explanation for this left to the more Dovecot-savy.

In short, add the following to /etc/dovecot/conf.d/10-mail.conf (or uncomment the relevant ones).

namespace {
  separator = /
  inbox = yes
}

An now it works. migration is just a matter of setting up a cron job now, lower the TTL on the domain and move in day or two.

I got some

Error: Can't rename mailbox INBOX to
INBOX_ff3e01082bcf4e4e352c00002b747e8a:
Renaming INBOX isn't supported.

Using rsync->dsync which I haven’t been able to solve yet. Maybe shutting down the Dovecot service on the remote side would help. Race conditions are likely to occur.

Buffalo WLI-U2-KG54L on Debian

The dongle under treatment

I have a Buffalo WLI-U2-KG54L USB wifi dongle. It very convenient as my router and access point is placed in the basement, and I sometimes have computers on the main floor that do not have built-in wifi.

The dongle works out-of-the-box™ on Ubuntu, but as debian are more restrictive, it need a bit more work.

You can find the instructions here: http://wiki.debian.org/zd1211rw

And instructions on how to activate it here: http://wiki.debian.org/WiFi/HowToUse. The part about wpa_supplicant is most relevant, as network manager just works when the device works.

Proftpd and LDAP on Debian Squeeze

This is a short howto (hopefully) providing enough information to install Proftpd and use LDAP as user database.

Background

I have become obsessed with LDAP – at least for the time being. It seem to be the answer to my redundancy and distribution plans.

A production server is in the process of being converted (migrated actually) to have a single SSO LDAP structure.

A virtualization host crash (thank you Linode) forced me to move a couple of sites onto this new fancy LDAP server. Shortly after, a user prompted me about the lack of FTP on the new webhost.

Now the shoe needs to fit.

Installing the required packages

This is the easy part.

# apt-get install proftpd-mod-ldap

The LDAP module will depend on the proftpd server so this is really the only thing you need to install.

Requirements for the LDAP server

The LDAP module for Proftpd is hard coded to lookup only users of objectClass: posixUsers which in my opinion is less intuitive than having a specified schema for proftpd.

An example .ldif is shown below. I have added objectClass: domain, which is unnecessary.

The uidNumber and the gidNumber maps the uid and gid on the system. 115 is proftfd user and 65534 is group nobody. From a ftp client owner will appear as domain.tld or whatever you specify as uid.

version: 1

dn: dc=domain.tld,ou=webhosting,dc=example,dc=com
objectClass: domain
objectClass: top
objectClass: posixAccount
cn: domain.tld
dc: domain.tld
gidNumber: 65534
homeDirectory: /var/www/domain.tld/www
uid: domain.tld
uidNumber: 115
loginShell: /bin/false
userPassword::

Configuring the authentication

First you need to edit /etc/proftpd/ldap.conf to match you LDAP setup. Somthing like this is appropriate.

<IfModule mod_ldap.c>
  LDAPServer ldap://example.com/??sub
  LDAPDNInfo "cn=proftpd,dc=example,dc=com" "password"
  LDAPDoAuth on "ou=webhosting,dc=example,dc=com"
</IfModule>

notice the ??sub after the ldap. This is very important as it specifies the search scope. The configuration parameter LDAPSearchScope is apparently ignored.

Again, a sour comment; the bind should have been done as the user logging in, and not as a dedicated user. Admin is a bad choice – create a dedicated user. Besides, the /etc/proftpd/ldap.conf is world readable!

Next you have to tell proftpd to load the module.
Uncomment the line

LoadModule mod_ldap.c

in /etc/proftpd/modules.conf.

Now you have to uncomment the line.

Include /etc/proftpd/ldap.conf

in /etc/proftpd/proftpd.conf to load the Ldap configuration.

Finally:

While editing proftpd.conf you should also lift the RequireValidShell restriction (or give the user a valid loginShell parameter. If do not do this, you will not be able to log in.

Now is the time to take a look at the standard proftpd configuration and make sure that anonymous login is disabled and ditto /etc/passwd users.

Chenbro ES34169 mini-review

I have had my eye on the Chenbro ES34169 case for some time now. It is relatively inexpensive small case with 4 build-in sata harddisk bays. My plan was to replace the current chassis to make a more compact NAS.

Top-down view
Nice and compact chassis

Unfortunately, the power supply does not work with the Jetway NC9C-550-LF I am using as a NAS mainboard.

I have contacted Chenbro, and got a reply from saying that they are testing the case with Jetway boards.
This was a very bad first impression, but lets not draw hasty conclusions from this.

The case is a designed for use with a mini-ITX board and has room for one 2,5″ drive inside. All cables are included and the power supply ranges from 120W to 180W depending on the product code. The one I tested is a 180W.

Motherboard tray
Motherboard tray for a mini-ITX board

The case has a front door which is dark semi-tranparent. This gives a nice dimmed look when the case is operational. The door is made from plastic and contains a tiny lock which you may be familiar with if you have ever had one of these 3,5″ floppy storage bay back in the days where splitting archived files made sense. Breaking it open will most likely require very little force, hence it is not very secure.

Case door
Case door is semi-transparent

The case includes a CF/SD card reader – althought optional (check before you buy). This really gives the case an edge and opens up for variaty of deployment options.

Behind the door
Card reader an slim cd slot

I’ve taken off the plastic front for no particular reason other than I like to take things apart.

Drive trays without plastic front
Drive trays without plastic front

Hardware installation

Hardware installation was easy. Every drive bay slides out without any force, and mounting the drives is just a matter of screwing in four screws.

All cables are either supplied or already installed, and the mini-ITX board installs without any space problems. Just remember a low profile CPU heatsink.

Getting all the cables fixated, do they don’t apply force to case side can be somewhat challenging – but what can you expect from a case with such limited space.

The case has room for one low profile pci/pci-express card.

Conclusion

The drive bays seem sturdy, but the general impression of the case is: cheap. Maybe this is because the previous NAS case was a full-aluminum case from Lian-Li, but I cannot look away from the fact that the metal bends very easily and seems very soft in general.
Nevetheless, when the case is assembled everything is solid, and there are no wobbely or loose parts.
A good, affordable and very recommendable case.

Nye fagre uddannelseskort

Som studerende på en videregående uddannelse er jeg pr. juli måned dette herrens år tvunget til at udskifte mit gode gamle blå SU-pendlerkort fra DSB med et fimset grønt plastikskolekort.

Nå, det æstetiske præg er jo en smagssag – det nødtvungne NemID et senere debatemne.

Mit første forsøg på at logge ind dirigerede mig videre til borger.dk hvor jeg skulle vælge kommune hvilket skulle vise sige fuldstændig overflødigt.

Jeg har jo tidligere benyttet mig af uddannelseskort.dk i forbindelse med at jeg gik på adgangskursus i Lyngby. Derfor har de åbenbart stadig min gamle adresse i deres system.
Nå ja, selvom jeg er logget på med min NemID SSO-adgang-til-alle-mine-oplysninger, kan den jo smutte – selvom den burde opdatere selv.

Jeg må jeg så opdatere min adresse manuelt. Jeg trykker på det øverste punkt der hedder “Ret din profil” hvor jeg ganske rigtigt kan se min adresse, men ikke ændre den.

Jeg fortsætter min søgen efter stedet hvor jeg kan ændre min adresse..

Der er et punkt der hedder “Du flytter”. Mjae, men det er nu et stykke tid siden.

Her kan jeg igen se min adresse i et indtastningsfelt jeg ikke kan rette i. Der er dog et lille link ude i siden af feltet med teksten “Ret”. Bingo!
Jeg trykker triumferende… Og … Intet sker. Jeg trykker igen på bedste “den har nok glemt jeg har tykket”-manér, men heller ikke dette tryk registreres. Jeg sætter mig slukøret tilbage i stolen og mærker nederlagets bitre smag på mine læber.

Bedst som jeg sidder der og har ondt af mig selv dukker en lille dialogboks op hvor jeg nu kan indtaste flyttedato. Så er vi tilbage på sporet! Der er endvidere en knap med skriften “Jeg kan ikke finde min adresse” desværre lader den ikke til at have nogen effekt overhovedet.

Jeg forsøger at ringe til uddannelsesstyrelsen, men får et “Alle vores linjer er optaget, ring igen senere” Hvorefter der meget uhøfligt bliver lagt på uden et “Ha en go’ dag”, eller “Det var hyggeligt (ikke) at snakke med dig”. Nå, men jeg er da så ikke den eneste der har problemer.

Jeg får ideen at prøve med anden browser (Iceweasel aka. firefox), og det går straks bedre. Nu kommer der en lille roterende vifte når jeg trykker på et link der ikke umiddelbart gør noget med det samme. Der er dog stadig ~4s forsinkelse på alle navigationstryk.

Det lykkedes mig (vistnok) til sidst efter en længere kamp at få bestilt et uddannelseskort og “meldt flytning”.

Ideen med at skifte alle over på uddannelseskortet er rigtig god, og da jeg i sin til oprettede det erindrer jeg ikke at have haft de store problemer. Dengang loggede man på med en selvoprettet adgangskode og sit CPR nummer. Man kan i øvrigt stadig finde den gamle logind side – det var tredie hit på google for mit vedkommende.
Det lugter lidt af at en politisk beslutning har forsaget at systemet skulle løfte nogen helt andre krav end de oprindelige, og skalerer ikke til kravene. Jeg henviser selvfølgelig til de sløve svartider.

Til sammenligning tog det mig 5 minutter at få fornyet mit gamle pendlerkort i forbindelse med jeg alligevel var på stationen. Det tog mig omkring en time at bestille det nye kort.

Min akilleshæl har i denne forbindelse været to ting: Jeg har benyttet mig af Chromium (12) browseren, som ikke helt har været understøttet. Og at jeg allerede havde en konto oprettet under det gamle system.

Hvis Danmark skal fremgå som et IT-fremgangsland syntes jeg det er for sløvt at man har en så træg arbejdsgang når der skal udføres rimelig simple tast-selv opgaver. Jeg er klar over at det hele skal gå op i en større enhed rent dataintegrationsmæssigt – men det er til grin at man skal taste tingene ind manuelt når vi nu har en SSO løsning. Kom ind i kampen.

Fornuftig usability og sparet tid er vejen til at få samfundet digitaliseret – ikke tvang og frustration.

Til slut lidt tø-hø’er af småfejl jeg mødte:

uddannelseskort billede

HD time-lapse movies with Motion and Linux

NSLU2 with webcam
The system

Background

I have previously experimented with time lapse videos, but wanted a more dedicated platform which could be set up, and run pretty much anywhere.

This is the first iteration, where the the purpose is to get the system up and running with headless operation.

Components

The original idea was to use a PC Engines alix1d system board in a box1c enclosure, but unfortunately the board I had was running very unstable – so I brought in an old friend of mine:

The Linksys NSLU2 aka. “slug”. The one I had ran Debian 5.0 Lenny, but had to be upgraded in order to get the webcam to work.

I recklessly tried doing a dist-upgrade, but ended up with bricked slug. Guess a fresh installation was the right answer indeed.

Debian Squeeze on a NSLU2

Due to a required proprietary firmware, the official Debian 6.0 installer does not ship with support for the on board Ethernet controller – which is bad because this is the only way of communicating the the device. Well, technically you can use the serial pin header or an USB Ethernet device, but I think I have burned the circuit for the serial port in a previous modding attempt :-\

There is a few guides that  give you directions on how to add the proprietary firmware to the installer image, and after about 5 reflashes I finally had one that worked.

Before starting the installation, I checked around for known installation errors. The installation takes about 5 hours, so you really want to get i right the first time.

I learned that others had experienced out of memory errors during the installation. Though luck.

To the rescue came Martin Michlmayr. He has the answer to all my quarrels; a compiled guide, with a complete Debian 6 userspace and kernel. This saved me a lot of time.

 Install and configure Motion

You can install motion by

apt-get install motion

as root or via sudo.

On Debian (Squeeze in my case), Motion is disabled by default – as many other services. Enable it, as mentioned in the notice:

Not starting motion daemon, disabled via /etc/default/motion ... (warning).

Setting the value start_motion_daemon to yes in /etc/default/motion as such:

start_motion_daemon=yes

 

The trick to disable motion detection in Motion, is to set the threshold to 0 in the config file:

threshold 0

Enabling time-lapse by setting the following in /etc/motion/motion.conf:

# Use ffmpeg to encode a timelapse movie
# Default value 0 = off - else save frame every Nth second
ffmpeg_timelapse 10

In this case, I take a pictures every ten seconds.

You should also adjust the width and height parameters, and the target_dir.

You can also get a copy of my preconfigured motion.conf by running the following set of commands

/etc/init.d/motion stop
mv /etc/motion/motion.conf /etc/motion/motion.conf.orig
wget http://retrospekt.dk/files/motion.conf -O /etc/motion/motion.conf
mkdir /home/motion
chown motion:motion /home/motion
chown root:motion /etc/motion/motion.conf
chmod g+r /etc/motion/motion.conf
/etc/init.d/motion start

An example can be seen here: http://retrospekt.dk/files/timelapse.mpg

Budget-friendly FreeNAS raid-z

When I wrote my previous post, I did not want to too much into detail about my NAS setup.  But, I still had an urge to tell about the splendid configuration.

My motivation for setting up my own freenas server, was my very positive previous experience with the software. And, by having my own configuration, I would be better able to provide both usability and technical troubleshooting.

These sort of posts are usually only of interest of potential buyers googling a specific product – and likewise software product.

But, without further adieu here is:

Yet another hardware configuration blog post

FreeNAS logo

The NAS consists of the following components

  • Jetway NC9C-550-LF motherboard
  • 2GB DDR3 1333 SODIMM I bought along with the motherboard
  • Jetway 4x SATA daughterboard
  • 4x WD20EARS harddisks
  • Lian Li 6070 Scandinavian edition chassis
  • An old usb key (2Gb .. I think)
  • An old pci ethernet adaptor

Lian li has apparently taken the chassis off their site, but Anandtech still has a nice review of the case.

The main reason I used this chassis is because I had it laying around, so to speak. The same goes for the motherboard, as it was a surplus from my previous NAS building experience.

The motivation for building the was the horrible near-datadeath experience I recently  had.So, I thought the time was ripe for a fault-tolerant storage medium.

As I had previously had a positive experience with both FreeNAS and zfs, the choice naturally fell on these. The installation is so very very easy: Download the the embedded gzipped image, put in an empty (or with non-precious content) usb key, and run the following (on a Linux box):

gunzip -c <path>/FreeNAS-amd64-embedded-xxx.img | dd of=/dev/sdx

Replacing the x’s and <path> with the relevant parameters.

Getting the RTL8111E to work

Note: This only applies to FreeNAS 7. The interface is supported in the FreeBSD 8.0 branch, and hereby FreeNAS 8.

The two onboard Realtek interfaces is not supported by the FreeBSD 7.3-RELEASE kernel.  This is also where the old pci network adapter comes in play. I used an older 3com 10/100 card, these are well supported.

However, you can get the onboard NIC’s up and running by downloading and installing the appropriate driver.

You can download the driver here: Realtek RTL8111E FreeBSD 7.3 64-bit driver

Remount /cf as read-write

# mount -o rw /cf

And place the driver in /cf/boot/kernel/

Lastly, you need to update /cf/boot/loader.conf to include the line if_rl_load=”YES” – and your’re done.

Now you can reboot, or remount /cf as read-only and use kldload to load the new driver.

You can follow a related discussion about the driver here.

The filesystem for the disks is zfs, and the raid-z pool is created manually as described in this previous post.

To finish it off: here are some photo’s of the current setup:

The 120mm fan is almost as large as the mainboard
A mini-ITX board looks kind of lonely in an ATX case :-)

Some words about performance

The embedded Atom CPU is definitely not a speed demon in any way. SSH transfer speeds peaks at 5 MB/s but are usually around 3-4 MB/s.
Sequential FTP uploads are about 25 MB/s. CPU usage is about 70% across all “cores”

As far as i can remember, the whole system uses about 50W.

The price of the system is not really represented here – as I have used spare parts, but similar components can be bought for about 450€

All in all a good, stable and robust system.