2012-01-07

WNDR3800 wireless performance

After looking at wired performance, I've got a spin at wireless:
Test conditions were as follows:

Router Firmware Version: V1.0.0.24
PC 1: notebook with Intel PRO/Wireless 4965 AG
PC 2: desktop with nVidia Corporation CK804 Ethernet (Gigabit speed)
PC 1 was within one meter from the router

On PC 1:
# dd if=/dev/zero bs=4096 count=102400 | nc 192.168.1.31 1999

On PC 2:
# nc -l 1999 | dd of=/dev/null

Speed reported is from dd output on PC 1:


Speed MB/s
2.4Ghz@54Mbs  2.6
2.4Ghz@130Mbs8.1
2.4Ghz@300Mbs9.3
5Ghz@300Mbs9.0



2012-01-06

WNDR3800 backdoor

The Netgear WNDR3800 firmware is a version of OpenWRT, and that's one of the reasons I've bought this router.
While being open is a good thing, being wide open maybe it's not.

This firmware has a backdoor, enabled by a simple utility (the windows version is available directly from the Netgear support site).
Once executed, it gives root access to the router without any authentication.
Consequences may vary from simple denial of service (you can reboot at will), or something more elaborate: download the /etc/shadow file, run John the Ripper, and get the admin password. Then, logging on with the web interface, you can flash a full version of OpenWRT, install tcpdump and capture all unencrypted traffic.

Problem is that the backdoor can be enabled by any device connected to the router, even via wireless; so be aware that allowing someone to simply use your connection, means giving them full root access.
The backdoor is not accessible from the Guest Network, so if you are going to allow someone to use your wireless, at least give them only the Guest Network.

USB car audio crash

All of a sudden, the Sony car stereo of my Ford C-Max refused to read the USB Flash Drive I've been using for more than a year.



The USB stick was untouched for a long time, no new tunes were added and I don't even remember the last time I've pulled it out of the plug.
The display was struck on the name of the last song played and every attempt of changing song resulted in an endless "Loading Data" screen.

Even the classic joke of exit and re-enter the car, gave no results :-)

The USB stick was perfectly readable on a PC, songs were not corrupted and played flawlessy on my home stereo.
I even reformatted it and loaded back all the songs, but the result was the same.

As a last resort I tried another USB stick: the car stereo went back to life, and after that, even the original USB stick worked again.

2012-01-05

Netgear Genie... oh really?

A runner up for the first place in the User Interface Bad Design Contest: the Netgear Genie.
I was setting up wifi scheduling as I did on my old router, but I've found that the schedules were off by one hour.
No big deal, maybe the router defaulted to GMT, but where did they put the time settings?
Maybe under Administration?
Even Advanced Setup would be somewhat logical...
But no... it seems that to Netgear engineers, time belongs to security.



2012-01-04

Netgear WNDR3800 switch performance

I'm trying the WNDR3800.
Some reviews are reporting less than stellar performance on the gigabit switch.
I've done some testing myself.
Using 2 linux pcs, with gigabit ethernet ports, I've put the first in receiving mode:

# nc -l 1999 >/dev/null

and then I started sending data from the second one:

# cat /dev/zero | nc 192.168.1.2 1999

The result is well over 110 MB/s:



Then, I've repeated the test using a straight cable connection between the two machines:


The result is pretty much the same, so the switch part of the WNDR3800 does not significantly impact performances.

2012-01-01

Realtime monitoring of syslog messages

Swatch is perl script that continuously monitor log files and acts upon patterns that may show up.
Based on some previous work, I wrote some scripts to use it as a daemon.

The following packages are needed from the EPEL repositories:
swatch-3.2.3-2.el5.noarch.rpm
perl-Mail-Sendmail-0.79-9.el5.1.noarch.rpm

While these are from the base repositories
perl-DateManip
perl-Date-Calc
perl-TimeDate

Here is the /etc/init.d/swatch

#!/bin/sh
#
# swatch: watch system log
#
# chkconfig: 345 10 99
# description: The Simple WATCHer is an automated monitoring tool \
# that is capable of alerting system administrators \
# of anything that matches the patterns described \
# in the configuration file, whilst constantly searching \
# logfiles using perl.
#
# processname: swatch
# config: /etc/sysconfig/swatch/swatch
# pidfile: /var/run/swatch.pid

CHECK_LOG="undefined_logfile"
SWATCH_CONF="undefined_conf"
SWATCH_BIN="/usr/bin/swatch"
SWATCH_PID_FILE="/var/run/swatch.pid"
SWATCH_SCRIPTDIR="/var/run"
SWATCH_LOG="/var/log/swatch"

. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/swatch/swatch ]; then
        . /etc/sysconfig/swatch/swatch
else
        echo "/etc/sysconfig/swatch/swatch does not exists."
        exit 0
fi

if [ ! -x ${SWATCH_BIN} ]; then
        echo "File ${SWATCH_BIN} not installed!"
        exit 0
fi

if [ ! -f ${SWATCH_CONF} ]; then
        echo "File ${SWATCH_CONF} does not exist."
        exit 0
fi

prog=swatch
RETVAL=0

start() {
        echo -n $"Starting $prog: "
        daemon "$SWATCH_BIN --daemon -c $SWATCH_CONF -t $CHECK_LOG --pid-file=$SWATCH_PID_FILE --script-dir=$SWATCH_SCRIPTDIR >>$SWATCH_LOG"
        RETVAL=$?
        if [ $RETVAL = 0 ]; then
                success
        else
                failure
        fi
        echo
        return $RETVAL
}

stop() {
        echo -n $"Stopping $prog: "
        killproc "$SWATCH_BIN"
        RETVAL=$?
        if [ $RETVAL = 0 ]; then
                success
        else
                failure
        fi
        echo
        return $RETVAL
}

case "$1" in
        start)
                start
                ;;
        stop)
                stop
                ;;
        status)
                status $prog
                RETVAL=$?
                ;;
        restart)
                stop
                start
                RETVAL=$?
                ;;
        *)
                echo $"Usage: $0 {start|stop|status|restart}"
                exit 1
                ;;
esac

exit $RETVAL

The config files:
Where to watch: /etc/sysconfig/swatch/swatch

# log to watch
CHECK_LOG="/var/log/messages"

# regular expressions
SWATCH_CONF="/etc/sysconfig/swatch/swatchrc"

What to watch: /etc/sysconfig/swatch/swatchrc

# swatch config
watchfor   /regex_to_watch/
        mail addresses=user\@domain,subject=swatch_alert

And the logrotate stuff: /etc/logrotate.d/swatch

/var/log/swatch {
    postrotate
        /etc/init.d/swatch restart 2> /dev/null > /dev/null || true
    endscript
}

WiFi toggle on Asus WL-550gE


I don't feel confortable sleeping with my wifi on, so here is a script to turn it off at night:

First I created 2 scripts, one to turn it off:

# vi /root/wifi-off

#!/bin/sh
 
uci set wireless.@wifi-device[0].disabled=1
wifi
echo wifi disabled

And one to turn it back on:

# vi /root/wifi-on

#!/bin/sh
 
uci set wireless.@wifi-device[0].disabled=0
wifi
echo wifi enabled


Then I started up wifi at boot

# vi /etc/rc.local

# Put your custom commands here that should be executed once
# the system init finished. By default this file does nothing.

/root/wifi-on

exit 0


Crontab:

# crontab -e

 0  7 * * * /root/wifi-on
59 23 * * * /root/wifi-off


The cron service is not enabled by default in OpenWRT:

# /etc/init.d/cron enable
# /etc/init.d/cron start

Good night...