phaqphaq

“a geeks daily life”

Archive for the 'Hacks' Category

Replacing stock mini PCIe WiFi by DW1390 WiFi on eeePC 1000H

Saturday, August 15th, 2009

This february I had my 30th birthday. My boss surprised me with an eeePC 1000H as an unexpected as well as also a very cool gift :-)

Ok, I must admit, that I took a glimpse at the tiny netbooks more than once. My dream was to actually run it with OS X instead of Windows or Linux.

So, just the next-day my netbook was OS X-ified (a topic, which I’ll cover later on), only to notice some more or less annoying issues.

One of the most annoying issues was the stock WiFi, which required a very ugly 3rd party tool for configuration and was so absoluty not OS X-alike.
(more…)

ras_init.vbs: Override And Restore Routes With Windows RAS

Wednesday, June 6th, 2007

When initiating a PPP/PPTP connection through Windows RAS you will usually end up with an altered network default route which will redirect all and every traffic through PPP/PPTP.

There are many cases however where such a behaviour is simply not desired, considering Windows RAS providing you with no way to circumvent this, you’re on your own for once more.

I wrote this script, ras_init.vbs, out of the requirement to restore my default route for normal connections and route only specific hosts and networks through PPP/PPTP.

ras_init.vbs is released under the terms of the GNU GPL, version 2. Any feedback is appreciated.

Current Relese:

ras_init-0.3.zip

Older Releases:

ras_init-0.2.zip

Change Log:

r0.3 2007/06/06

  • fixed a bug with wrong RAS_Routes array enumeration
  • changed script to figure out language settings on its own
  • addedd support for RAS_Name, RAS_User and RAS_Pass attributes to include whitespace characters
  • added support for Windows Vista (requires administrative privileges though)

r0.2 2006/06/16

  • add support for interactive/non-interactive mode

r0.1 2006/06/13

  • initial release
  • tested on Windows 2000/XP
  • searches through all interfaces and looks for the expected RAS subnet address
  • removes RAS default route and replace it by your local default route
  • optionally set up host/network routes for routing through RAS

FreeBSD patch: enable fsck in mdmfs

Wednesday, July 26th, 2006

This patch is actually a follow-up development to my article on implementing filesystem allocation limits on FreeBSD jails.

My previous article basically lined out how to place jails inside a vnode-backed memory device to enforce filesystem allocation limits. This became possible through a new flag introduced to mdmfs in FreeBSD-CURRENT which allowed to skip ‘newfs’ (which requires mdmfs actually to be called mount_md to work properly).

This solution is quiet handy as it will automagically mount the container volumes as required. But since we do not live in a perfect world – and computers ain’t perfect either – crashes do happen. File system corruption on volumes will prevent jails to startup as their (virtual) root device will fail to mount.
This is where this patch comes in. It will enable mdmfs to optionally run an fsck on given volumes.

To apply the patch, create a new temporary build directory first:

#mkdir /root/mount_md
#cd /root/mount_md

Then get the original source code from CVS. Maybe it’s easiest to get this particular release through WebCSV at http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/sbin/mdmfs/mdmfs.c?rev=1.27.

Save this file to your previously created build directory.

If you have wget at hands you can also download it directly.

#wget -user-agent=’Mozilla/5.0′ ‘http://www.freebsd.org/cgi/cvsweb.cgi/~checkout~/src/sbin/mdmfs/mdmfs.c?rev=1.27′ -output-document=/root/mount_md/mount_md.c

Download and apply the patch: mount_md.c.diff

#wget -user-agent=’Mozilla/5.0′ ‘http://www.phunsites.net/wp/wp-content/uploads/2006/07/mount_md.c.diff.txt’ -output-document=/root/mount_md/mount_md.c.diff

#patch < /root/mount_md/mount_md.c.diff

Compile the source:

#gcc /root/mount_md/mount_md.c -o /root/mount_md/mount_md

Then copy the file to some location you like, eg. /usr/sbin.

#cp /root/mount_md/mount_md /usr/sbin/mount_md
Make sure you call the file as given in the example. It won’t work otherwise.

Special care must be taken that you DO NOT replace your existing mdmfs binary file by this new version. DO NOT overwrite it. Do not rename this patch to mdmfs. Use the names provided in this example instead.

Setup Jail’s fstab

Now check out your jail’s fstab and look for this line:

md /var/jails/192.168.0.1 md rw,-P,-F/mnt/r5_vol1/jails/192.168.0.1/rootfs.volume

Change it as follows:

md /var/jails/192.168.0.1 md rw,-P,-F/mnt/r5_vol1/jails/192.168.0.1/rootfs.volume,-Tufs

or

md /var/jails/192.168.0.1 md rw,-P,-F/mnt/r5_vol1/jails/192.168.0.1/rootfs.volume,-tufs

The difference in the two lies in the ‘-T’ or ‘-t’ argument. Both enable fsck before mounting the volume, hence ‘-T’ runs ‘fsck -y’ while ‘-t’ does not.

You need also to provide the filesystem type with either option for fsck to work properly.

Policy Filter for ClamSMTP (pf-clamsmtp)

Monday, May 1st, 2006

pf-clamsmtp is a perl-written policy filter for use with Postfix and clamsmtp primarily written for one purpose: pass messages to the clamsmtp virus filter only if they don’t exceed a given size.

The reason for doing so was simple: traditional tools like MailScanner or AMaViS put to much of a burden on systems when simple virus filtering is desired. Also it doesn’t make sense to scan today’s huge megabyte-sized messages: first, most mail viruses rarely exceed a few kilobytes in size, second, scanning huge messages has a big payload and may expose a system to certain race conditions (eg. out of memory, disk space, etc).

pf-clamsmtp is based on a sample policy daemon included with Postfix and developped to work together with ClamSMTP. Sample configurations are included with the release tarball. pf-clamsmtp is released under the terms of the GNU GPL, version 2.

Policy Filter for ClamSMTP (pf-clamsmtp)

Any feedback is appreciated.

Courier IMAP Login Exec (cile)

Friday, March 24th, 2006

Courier IMAP Login Exec (abbreviated ‘cile’) is a small patch against the popular Courier IMAP server.

It basically adds a ‘execute script on login’ feature to both pop3d and imapd.

The idea behind this is to allow automatic server side tasks to be run upon user login, eg. to check (and fix) the Maildir structure, create usage reports, expunge old mail, etc.

I have therefore created a patch which adds this functionality to Courier IMAP, which you may download and use free of charge. The patch is licensed unter the terms of the GNU GPL, version 2.

There are two releases available:

cile-generic 0.1

Take the ‘cile-generic’ package if you plan to apply this patch against the original source tarball.

cile-ports 0.1

Take the ‘cile-ports’ if you plan to apply this patch against the FreeBSD ports tree.

Both releases contain the same patches, they only differ in packageing and the way they are applied.

Any feedback is appreciated.