Archive for December, 2010

Music On Console

Music On Console Player or mocp for short is awesome piece of software for command line geeks. It is somewhat similar to Midnight Commander – on the left panel you can browse through your filesystem and on the right there is your current playlist.

To install on a Debian or Ubuntu box:
apt-get install moc moc-ffmpeg-plugin

Start it up with mocp command. Note that some Qt guys had another program called moc!
mocp

Now the most important part – key bindings! Let’s start with the global ones.

  • q – Exit the user interface but keep player running in the background
  • Q – Exit the whole program and stop any playing audio tracks
  • R – Toggle repeating the playlist
  • S – Toggle shuffling
  • tab – Switch between panels

Now the keys you can use on the left panel for browsing the files:

  • a – Add files/directories to the playlist
  • A – Add playlist to current playlist
  • Enter – Enter directory or add file

And finally the keys you can use on the playlist

  • d – Remove track from playlist
  • C – Clear the whole playlist
  • Enter – Start playing a track
  • Control-f – Toggle track format visibility
  • Control-t – Toggle track duration visibility

Note that shortcuts in capital letters mean the button pressed with Shift. Happy hacking :)

No comment »

Debian Lenny, LTSP ja ID-kaart

Serveri tarkvara paigaldus

Siin on siis väike juhend kuidas Debian Lenny’ga teha sama mida Estobuntu LTSP võimaldab. Pikalt see kord üksipulgi lahti ei seleta mis mida teeb nii et kui huvi on siis küsi e-posti vahendusel.

Kõigepealt paigalda serveris ID-kaardi tarkvara:

echo deb http://id.smartlink.ee/repo/release/debian/ lenny main >
    /etc/apt/sources.list.d/idkaart.list
wget http://id.smartlink.ee/repo/apt-esteid-test.gpg.asc -O - | apt-key add -
sudo aptitude update
sudo aptitude dist-upgrade
sudo aptitude install qdigidoc qesteidutil mozilla-esteid icedove-esteid

Luba repositooriumid:

deb http://v6sa.itcollege.ee/ debian lenny
deb http://backports.debian.org/debian-backports lenny-backports main

Seadista DHCP3 server:

echo "subnet 192.168.0.0 netmask 255.255.255.0 {
    range 192.168.0.220 192.168.0.230;
    option broadcast-address 192.168.0.255;
    option routers 192.168.0.10;
    option subnet-mask 255.255.255.0;
    option root-path "/opt/ltsp/i386";
    filename "/ltsp/i386/pxelinux.0";
}" > /etc/dhcp3/dhcpd.conf
/etc/init.d/dhcp3-server restart

Paigalda tarkvara

apt-get install libpcsclite1 opensc openssh-server dhcp3-server
apt-get install -t lenny-backports ltsp-server

Tee Xsessioni fail mis ütleb kus kohas PCSC-lite socket nüüd asub:

echo "export PCSCLITE_CSOCK_NAME=$HOME/.pcscd.comm" > /etc/X11/Xsession.d/80-pcsclite

Terminali tarkvara paigaldus

Paigalda terminali tarkvara serveri /opt/ltsp/i386 alla:

ltsp-build-client
    --arch i386
    --backports-mirror "http://backports.debian.org/debian-backports"
    --apt-key /etc/apt/trusted.gpg

Seadista NFS server:

echo "/opt/ltsp/i386 192.168.0.0/24(no_root_squash,ro)" >> /etc/exports
/etc/init.d/openbsd-inetd restart
/etc/init.d/nfs-kernel-server restart

Sisene terminali juurikasse:

chroot /opt/ltsp/i386

Lisa repositoorium:

echo "deb http://lauri.vosandi.eu/ debian lenny" >> /etc/apt/sources.list
apt-get update

Paigalda paketid

apt-get install openssh-client pcscd libccid

Lisa OpenSSH seadistused, asenda 192.168.0.10 serveri IP-ga:

echo "Host 192.168.0.10
    RemoteForward [~/.pcscd.comm] :[/var/run/pcscd/pcscd.comm]" >> /etc/ssh/ssh_config

Välju terminali juurikast:

exit

Käsitsi kompileerimine

Paigalda vajalikud paketid

apt-get install libwrap0-dev libssl-dev libpam0g-dev libedit-dev libselinux1-dev libkrb5-dev libgtk2.0-dev hardening-includes libusb-1.0-0-dev mercurial flex autotools-dev libccid opensc
apt-get install -t lenny-backports debhelper

Kompileeri modifitseeritud OpenSSH 5.5

hg clone http://lauri.vosandi.eu/hg/ltsp-esteid/openssh/
cd openssh
dpkg-buildpackage
cd ..

Kompileeri PCSC-lite 1.6.5 + SVN muudatused:

hg clone http://lauri.vosandi.eu/hg/ltsp-esteid/pcsclite/
cd pcsclite
dpkg-buildpackage
cd ..

No comment »

GNU/Linux based terminal-servers with SmartCard support


Our company has been dealing with GNU/Linux based terminal-servers for a while and in Estonia you run into issues with ID-card at some point. Estonian ID-card is a SmartCard which is used to authenticate person online and to give legally valid signature. With terminal-server systems issues arose immediately because PCSC-lite originally didn’t support any network transparency. With few hacks it is possible to do this and that’s what this post is about.

PCSC-lite is a SmartCard framework which allows multiple applications to use multiple cards. Applications use a UNIX domain socket to talk to the process which handles the cards. There also used to be a public shared memory file which was a complete showstopper for LTSP, but after poking the core developer Ludovic it was finally removed. In revision 5373 another important feature for LTSP was implemented, the user can also specify the path to the forementioned UNIX domain socket.

So obviously what you need to do is to run the daemon in the terminal, redirect the UNIX domain socket to the server and tell the application to use that custom path. With version 5 LTSP switched from unencrypted connections to OpenSSH which encapsulates X11 traffic and any other connections between server and terminal. OpenSSH does support redirecting TCP/IP sockets but not UNIX domain sockets altough required code changes are minor.

There was a project called streamlocal, which was basically a bunch of patches for OpenSSH 4.4p1 to allow UNIX domain socket redirecting, I updated the patch and made it available for OpenSSH 4.7p1. After that there were some major rewrites in the OpenSSH core so I didn’t bother porting and I started from scratch to have the bare minimum to make ID-card work. This resulted in hackish rewrites for OpenSSH 5.3p1 and 5.5p1.

LTSP5 uses LDM in the terminal to authenticate SSH connection after which it passes X11 session to the desktop session application on the remote machine. To enable the socket redirection I also needed to modify LDM to inject parameters to SSH client process. This patch is obsolete since LDM now officially reads environment variable LDM_SSHOPTIONS for exactly the same purpose.

There are packages available for Ubuntu 8.04 and Ubuntu 10.04. National Library of Estonia is using them to power their server and 50 VxL terminals. There’s a manual written in Estonian, you can try your luck with Google Translate. There was an article about our solution in Arvutimaailm, again you can try your luck with Google Translate.

PS: OpenSSH is reference implementation of the SSH protocol so incorporation of UNIX domain patches needs protocol standard change first. This could be pushed through Internet Task Engineering Force, so if anyone is willing to lobby them please let me know :)

No comment »