18 · 01

FreeBSD on the ASUS Eee Box using an USB flash drive

I wanted my personal server to be closer to me. So I invested few days ago in the Asus Eee Box, thinking it is the best configuration for a light server at home.

I moved this blog and all my services from my dedicated server to my new one.

To setup FreeBSD on this kind of machine, you have two ways to do it:


Creating a bootable USB flash drive by using the original ISO image is a bit annoying if you haven't got a FreeBSD station yet. I have been using the fbsd2img.sh script,

I share my USB flash drive image: 7.1-RELEASE-i386-bootonly.img.
To setup the USB flash drive, use "dd" (/dev/XXX is the device of your USB flash drive):

dd if=7.1-RELEASE-i386-bootonly.img of=/dev/XXX bs=1m


Here is the result of the server hosting this blog :)

18 · 07

Subversion repository corruption: something to try when svnadmin recover does not work.

I had the wrong habit to keep my old projects in a subversion repository. It's not the good way of keeping code safe. svnadmin recover works when there is no corruption in your repository. If you have an old corrupted repository that you can't recover, you can first try a berkeley db recovery:
cd /var/svn/myrepos
dbX.X_recover
X.X is the berkelay db version of the repository. If svnadmin recover and db_recover don't work, try the solution below, it worked for me. You have to know the database version:
REPOS_PATH="/var/svn/myrepos"
DB_VERSION="4.3"
cd ${REPOS_PATH}/db
rm log.* __db.*
mv changes changes.old
mv copies copies.old
mv nodes nodes.old
mv representations representations.old
mv revisions revisions.old
mv strings strings.old
mv transactions transactions.old
mv uuids uuids.old
mv lock-tokens lock-tokens.old
mv locks locks.old
db${DB_VERSION}_dump changes.old | db${DB_VERSION}_load changes
db${DB_VERSION}_dump copies.old | db${DB_VERSION}_load copies
db${DB_VERSION}_dump nodes.old | db${DB_VERSION}_load nodes
db${DB_VERSION}_dump representations.old | db${DB_VERSION}_load representations
db${DB_VERSION}_dump revisions.old | db${DB_VERSION}_load revisions
db${DB_VERSION}_dump strings.old | db${DB_VERSION}_load strings
db${DB_VERSION}_dump transactions.old | db${DB_VERSION}_load transactions
db${DB_VERSION}_dump uuids.old | db${DB_VERSION}_load uuids
db${DB_VERSION}_dump lock-tokens.old | db${DB_VERSION}_load lock-tokens
db${DB_VERSION}_dump locks.old | db${DB_VERSION}_load locks
svnadmin recover ..
If binaries dbX.X_dump and dbX.X_load does not exist, you have to compile a old version of subversion with the berkeley database corresponding.
Thanks to dmp. Link: http://svn.haxx.se/users/archive-2005-07/0576.shtml
17 · 07

Gmail-Notify improvements and a modified behavior

Gmail-notify is a small program written in Python. I use it because it is light and it just do what I want. I am a regular user of the firefox extension gmail-notifyer and I was uncomfortable with the Gmail-notify behavior, so I wrote a little patch to make it more like I want. I also added the possibility to execute a command when a new message arrive. I use it to play a sound (aplay ~/sounds/mail.wav). I don't know your habits but maybe you could enjoy my modifications. Here is a small description:
  • A click on the event box close it.
  • A click on tray icon open the mailbox.
  • Mailbox is now open as HTTPS.
  • A command can be executed when a new mail is received (like playing a sound).
To use my modifications, download my patch, and apply it to gmail-notify-1.6.1.1:
wget http://garr.dl.sourceforge.net/sourceforge/gmail-notify/gmail-notify-1.6.1.1.tar.gz
wget http://zaphod.eu/pub/gmail-notify-1.6.1.1.patch tar zxvf gmail-notify-1.6.1.1.tar.gz
(cd gmail-notify ; patch -p1 < ../gmail-notify-1.6.1.1.patch)
rm gmail-notify-1.6.1.1.tar.gz
Then run gmail-notify.
gmail-notify/notifier.py
9 · 07

Ushare on Gentoo Linux

Ushare is a UPnP media server on linux. I use it to browse media files from my Xbox. There is no official gentoo ebuild. Sunrise Gentoo overlay provides an ebuild for Ushare, it requires some modifications to be used. I noticed some problems:
  1. Ushare daemon is configured to run as root. Without being paranoid, I don't want to entrust a root daemon which manipulate my precious media directory.
  2. Boot script in init.d directory is written for debian, so it does not work at all on Gentoo.
  3. Default configuration file contains some wrong variable names. So this configuration directives are ignored.
I rewrote the init.d script to work on Gentoo and to launch ushare daemon as nobody user. To sum up, Ushare can be deployed rapidly as follow: 1. Checkout Sunrise overlay with layman
emerge -v layman
layman -a sunrise
echo source /usr/portage/local/layman/make.conf >> /etc/make.conf
echo media-video/ushare >> /etc/portage/package.keywords
emerge -v ushare
2. Replace the Ushare boot script /etc/init.d/ushare by my script:
#!/sbin/runscript
#- by shad
DAEMON="/usr/bin/ushare"
NAME="ushare"
CONFIGFILE="/etc/ushare.conf"
OPTS="-f $CONFIGFILE"
PIDFILE="/var/run/ushare.pid"
USER="nobody"
[ -x $DAEMON ] || exit 0
start() {
ebegin "Starting $NAME"
start-stop-daemon --start --quiet --background --pidfile $PIDFILE \
--make-pidfile --exec /bin/su -- --command "$DAEMON $OPTS" $USER
eend $?
}
stop() {
ebegin "Stopping $NAME"
start-stop-daemon --stop --quiet --pidfile $PIDFILE
eend $?
}
3. The last thing to check is the name of configuration variables in /etc/ushare.conf. Make sure each variable starts with the "USHARE_" prefix.
Then,
/etc/init.d/ushare start
and watch your favorite movie on your Xbox 360 :)
4 · 02

Windows Vista: BOOTMGR is missing!

I bought an additional hard drive last week to increase my storage capacity and to add a partition to backup data. I decided to move my Windows Vista installation to the second harddrive. Linux and grub are installed on the first one. Vista creates a Boot directory when it setups the MBR. I noticed that Vista does not create this directory when it is installed on the second harddrive, probably because the boot loader is on the first one. So after I restored grub to handle both windows and linux, when I tried to boot Vista, I saw the message "BOOTMGR is missing!". The boot directory cannot be seen on Windows systems, I verified its presence on my Linux system with the Windows partition mounted. I found a little trick to force windows Vista to create boot directory and bootmgr, I configured the bios to disable the first harddrive. Then I repaired the windows Vista installation with the dvd, the repair program created the boot directory and bootmgr program. Finally, I re-enabled the first harddrive. It's important to add a small setting to grub configuration to make Windows believe it is launched from the first harddrive. Grub is able to change the bios harddrives order virtually.
title=Windows Vista
rootnoverify (hd1,0)
map (hd0) (hd1)
map (hd1) (hd0)
chainloader +1
24 · 01

Duplicity: simple, efficient and secure backup solution for Unix

Backuping data is a real problem. Investing 2 RAID 1 harddrives is a little expensive for a workstation. Duplicity is able to do incremental backups with the rsync algorithm. All backuped data are encrypted with gpg. All duplicity options are available on the official website. I wrote a small script for automate backup on my workstation. backup.sh:
#!/bin/sh
ROOT="/root/backup"
DISTANT="ssh://user@zaphod.eu//home/user"
PASSPHRASE="xxxxxxxxxxxx"
KEEP_ARCHIVE="2M" # 2 Months
FILELIST="files.lst"
export PASSPHRASE
duplicity       --include-globbing-filelist "${ROOT}/${FILELIST}" \
--exclude '**' \
--full-if-older-than "${KEEP_ARCHIVE}" / "${DISTANT}"
duplicity remove-older-than ${KEEP_ARCHIVE} ${DISTANT}
Then a small file list specifies what has to be backuped or not.
files.lst:
- /home/shad/p0rn
- /home/shad/tmp
+ /etc
+ /home/shad
According to duplicity documentation, a line beginning with a '+' specify a directory or a file to include and '-' for exclude. Be aware of list order.
It remains to add a cron entry for a weekly schedule:
0 0 * * 1 backup.sh | mail -s "Backup Report" root@zaphod.eu
Now your worksation is secured, you can restore any files to any date within the backup delay.
24 · 10

Gnump3d: New release is imminent.

Steve Kemp, gnump3d founder and current maintainer is going to release a new version of gnump3d. This release will introduce some changes:
  • Password authentication is completely going away, due to some problems, especially discovery of a new hole which can be verified with netcat:
GET / HTTP/1.0
-> All looks good. You'll get a 403 header back.
Now try this malformed request instead:
GET /
-> Password auth bypassed :(
This hole can be explained by the home-made web server implemented.
  • "Split warning" will be removed when gnump3d is starting (index updating).
  • Some other bugs reported by mail will be fixed.
    Media_httpfeedsfeedbu_bhtnf
15 · 07

PwrCtl 0.2 released

I have just release a new version of PwrCtl (0.2), some new features has been added :

  • Server notifying over UDP multicast: each server notify its presence on a multicast address to be displayed on the client interface (only available over Wifi, make sure multicast filtering is disable on your router).
  • Error handling improved: client is now able to auto-reconnect after a network problem.
  • Client session to keep context after reconnection: the client keep a session id, delivered by the server, to get back its context (profile, controller instance...)
  • Support of VLC and Windows Media Player for Windows.
  • Platform handling on server controller has been fixed.

You can get it now on download server.

All documentation has been updated on the wiki page.

Media_httpfeedsfeedbu_dooht
20 · 06

HTTP digest authentication for gnump3d

Last month, I wrote a patch for gnump3d authentication, to add support of HTTP digest authentication. This patch has been included in the last release (2.9final). At present, this release is available in some linux distributions, but not in all of them (like gentoo).

If you need this feature, you will be able to find the patch here.

Media_httpfeedsfeedbu_xpdwt
19 · 06

Spam in dotClear1

I receive a lot of spam comments for few months. They contain almost the same data, a list of URLs. So I decided to prohibit URLs in comments. In the future, if you want to give some URLs in your comments, please strip "http://" in front of it. If your are interested, I've just added this code near line 269 of the file layout/prepend.php of dotclear 1.2.6 :
if (stripos($in_content, 'http://') !== false)
{
    $form_err = 'Url in comments are not allowed for spam reasons, please strip "http://" in front of your URL.';
}
elseif ($blog->addComment($post_id,$c_nom,$c_mail,$c_site,
        $in_content,0,dc_time_delta,dc_comments_pub) === false)
{
...
If this small change is sufficient, maybe I'll publish comments directly.
EDIT: Due to dotclear2 migration, comments are directly published and url are allowed.

Pages