Yearly Archives: 2009

Hacking zenphoto for https admin

Trying to use zenphoto I found it does not have an option to have the admin tasks in https and the gallery in regular http.

WordPress is doing this and reading Rian’s article: SSL and Cookies in WordPress 2.6 I had a better idea on how it works.

Before coding, I also read How to Properly Provide Mixed HTTP and HTTPS Support from mikeperry’s blog.

And this is basically what I implemented.

For once the result of my work is not hosted on my blog but directly on zenphoto’s trac : The ticket with zenphoto patch to allow both http and https.

Trading Places on Debian

To fit a particular job, several choices are often available. For softwares, it the same!

For example, while configuring a system we need a text editor. On recent distros, we get nano, on others we have vi (or a variant like nvi, vim…). On debian the defaukt editor is simply called editor.

Let’s see that:

$ which editor
/usr/bin/editor
$ ls -la /usr/bin/editor
lrwxrwxrwx 1 root root 24 mar  4 09:01 /usr/bin/editor -> /etc/alternatives/editor

So editor is not a program, simply a symbolic link to the same file name in /etc/alternatives and that last on is an other link to the actual editor program.

To update the editor we could change the link, but that’s quite direct were debian gives us a nice way to do it with the command: update-alternatives.
Obviously to update system configuration you have to be root (use su or sudo whatever you like best)

# update-alternatives --config editor

A text menu will propose you the available alternatives.

That’s for the big picture, I was first on using this on the case of the flash plugin for firefox (well iceweasel). Even after installing flash form debian-multimedia repository, firefox was still using swfdec, ad removing swfdec was breaking gnome’s dependencies… The solution is above, firefox uses a flash-mozilla.so plugin, this is an alternative! So:

# update-alternatives --config flash-mozilla.so
There are 2 choices for the alternative flash-mozilla.so
  Selection    Path
-----------------------------------------------
*+        1    /usr/lib/swfdec-mozilla/libswfdecmozilla.so
          2    /usr/lib/flashplayer-mozilla/libflashplayer.so
Press enter to keep the current choice[*], or type selection number:2
update-alternatives: using /usr/lib/flashplayer-mozilla/libflashplayer.so to provide flash-mozilla.so.

You did it!

That’s no because flash is not open source that we have to read on debian or ubuntu forums that the solution is to remove manually libswfdecmozilla.so or any similar nonsense, there is a way to do it, that what new users should learn.

Music Player Daemon

If you are storing your music file on your home server’s hard drive, so why don’t you play it from here ?

That’s just what I did, especially with the SPDIF output on the server’s motherboard connected to my sound system, that would have been a waste not to use it!

But it’s a server, it has no screen, no keyboard…

You can play your music using mpg321 from an ssh connection, you can even use screen, that would work. But there is a nice program that’s even better for that case: Music Player Deamon aka MPD

Continue reading →

ANSI Color support for xrootconsole

Having the system log on a background transparent window on the desktop look nice and can be useful (USB key plug events, network connection events and so on).
One way is to use a terminal like aterm or Eterm for instance using the following command:


aterm -tr -bl -ib 0 -title log -name log +sb -geometry '140x16+0+791' -e bash -c "tail --follow=name /var/log/full.log | ccze" &

With the -title and -name option the window decoration can be removed at the window manager level. OK, this is nice.

But when using fluxbox desktop wheeling will not work over the log as it is a window not the desktop.

So I switched to xrootconsole, but it has no color support… not a big deal, I just hacked it in 😉

Here is a sample usage of the hacked xrootconsole, the important part is the -A parameter for ANSI to ccze as the default is to use curses:


tail -n 16 --follow=name /var/log/full.log | ccze -A | xrootconsole --wrap --bottomup -geometry 233x16+1+818 &

Continue reading →

becoming bilingual

Thanks to the Gengo plug-in my blog is becoming bilingual.

Obviously things are never that simple, Gengo is not ready for WordPress 2.7 so I had to install the development version… I justs have to check that it works!

  • French layout was kind of strange, English seams more ok… for now!

Don’t worry non-french reader’s (do I have any reader yet anyway) I will continue to write in english.

WordPress 2.7.1 !

Now that Lenny is out, testing is moving again !

So I could upgrade my wordpress debian package to the testing version and get the 2.7.1 !

Note that my system is still running lenny (stable), this is using basic apt pinning, the more basic you can do is :

  1. add

    APT::Default-Release "stable";
    

    in /etc/apt/apt.conf (or in one file in /etc/apt/apt.conf.d)

  2. then add the tesing distrib in your source.list !

  3. Finally

    sudo aptitude update
    

    and that’s it you can install some specific packages from testing.

However to use stable, testing and unstable you have to really do the pinning !

But for testing, unstable and experimental the above method with testing as default release will works. Just because experimental has NEVER automatic upgrade.

Signed Personal Debian Repository

Hi all,

That was long, but here is my signed debian repository !

Investigations:

  • Debian Repository HOWTO mostly describes trivial repository setup.
    After some trial it appeared to me that trivial repositories cannot be signed (well at least will not be verified by atp)

  • mini-dinstall does basically only trivial repository to.

  • This article about Unofficial Debian repository describe a setup with debarchiver however this has special user, cronjob… it seamed quite complex to me

  • Basically what I wanted was like a trivial repository but secured, and the solution was on the debian wiki, it first confirm that trivial repository are not compatible with apt-secure. And it give the solution:

    Even with an “official archive”, you can create a much simpler archive than the real official one. This is explained in Debian Reference (lenny) using apt-ftparchive in apt-utils and dupload. All uploaded packages are located in a directory and no database server is needed. This may be good enough for people hosting a few packages.

Well this was good enough for me, also I’m currently not using dupload but I put the commands suggested as postupload in a script.
The update script, apt-ftparchive configuration and pgp public keys are on the root of the repository.

to use it:

#add in source.list
deb http://silicone.homelinux.org/repository/ unstable main
deb-src http://silicone.homelinux.org/repository/ unstable main

#for gpg signature verification get siliconerepositorykey.asc
# sudo apt-key add siliconerepositorykey.asc

The actual content of the repository is currently just one program: a hacked xrootconsole with ANSI color support, but this will be the subject of a next post 😉

netsed

An old hack (2 years old  according to my subversion db !!)

This started with my 5.1 Yamaha audio amplifier, this device has network access to listen to netradios directly ! I wanted to hack it to play a personal netradio.

I configured my dhcp to have it report my server as gateway and used wireshark to listen how it was connecting the Internet. It appeared that the menu on the device was provided by XML streams.

I first did some DNS spoofing and placed on my apache server a fake XML file, the Yamaha amplifier couldn’t tell the difference and I could play some local mp3 files.

The next step was to have both the normal radios and some personal radios. That’s here netsed becomes useful. The idea was to filter the main menu XML to add an extra item that liks to a local XML page linking to personal radio.

I never get to the step where I setup an Icecast server however I got the extra menu working.

netsed did basically the job, but for some reason it was not closing connections to the http server so it generated several timeout errors, that’s basically what I fixed in the netsed code.

my Trac page about netsed

Vim spell-check

I long used vimspell plug-in for vim, but now, vim 7 include a spell checker !

To enable:

:setlocal spell spelllang=en_us

However, I’m French and by default French dictionaries are not installed on debian, so

mkdir -p /tmp/vimspell
cd /tmp/vimspell
wget http://ftp.vim.org/pub/vim/runtime/spell/fr.utf-8.sug
wget http://ftp.vim.org/pub/vim/runtime/spell/fr.utf-8.spl
wget http://ftp.vim.org/pub/vim/runtime/spell/fr.latin1.sug
wget http://ftp.vim.org/pub/vim/runtime/spell/fr.latin1.spl
sudo cp * /usr/share/vim/vim71/spell

and that’s it :setlocal spell spelllang=fr works!